Overview
Thetenderly devnet spawn-rpc command creates a JSON-RPC endpoint for your DevNet, allowing you to connect development tools, frameworks, and scripts to your local blockchain development environment.
Usage
Description
This command spawns a DevNet RPC endpoint that represents the JSON-RPC interface for your development blockchain. The RPC endpoint can be used with tools like Hardhat, Foundry, web3.js, ethers.js, and other Ethereum development frameworks.A template must be specified when spawning a DevNet RPC. Templates define the initial configuration and state of your development network.
Flags
Required Flags
The DevNet template slug to apply when spawning the DevNet RPC. Templates define the network configuration and initial state.
Optional Flags
The Tenderly account username or organization slug. If not provided, the system reads
account_id from tenderly.yaml.The DevNet project slug. If not provided, the system reads
project_slug from tenderly.yaml.The Tenderly access key for authentication. If not provided, the system reads
access_key from tenderly.yaml or uses the stored authentication token.The Tenderly JWT token for authentication. If not provided, the system reads
token from tenderly.yaml or uses the stored authentication.Return only the URL without additional logging output. Useful for scripting and automation.
Examples
Basic Usage
Spawn a DevNet RPC using a template with default project settings fromtenderly.yaml:
Specify Account and Project
Explicitly set the account and project for the DevNet:Use Access Key Authentication
Spawn a DevNet with explicit access key authentication:Return URL for Scripting
Get only the RPC URL for use in scripts or CI/CD pipelines:Authentication
The command requires authentication through one of the following methods (in order of precedence):For security best practices, avoid hardcoding credentials in scripts. Use environment variables or secure secret management in CI/CD environments.
Configuration Precedence
When multiple configuration sources are available, the command follows this precedence order:- Command-line flags - Highest priority
- tenderly.yaml file - Project-level configuration
- Global configuration - From
tenderly loginsession
Error Handling
Missing Template
If the--template flag is not provided:
Missing Account
If no account is found in flags or configuration:tenderly login or provide the --account flag.
Missing Project
If no project is found in flags or configuration:tenderly use project or provide the --project flag.
Missing Authentication
If neither access key nor token is available:tenderly login or provide authentication credentials.
Use Cases
Local Development
Spawn a DevNet for local smart contract development:Integration Testing
Create isolated DevNets for integration tests:Multi-Network Testing
Spawn multiple DevNets for cross-chain testing:Related Commands
DevNets Overview
Learn more about Tenderly DevNets
Login
Authenticate with Tenderly
Initialize
Set up a Tenderly project
Configuration
Configure tenderly.yaml
Next Steps
Integrate with your framework
Configure your development framework (Hardhat, Foundry, etc.) to use the DevNet RPC endpoint.