Automated DevNet Spawning: Bash & JavaScript
Migrate to Virtual TestNets
For new projects, we recommend starting with TestNets.
For automatic migration of DevNets to TestNets, .
Through the steps below, you can seamlessly spawn DevNets in your development workflow using either Bash or JavaScript.
Prerequisites
Before proceeding, ensure your system meets these requirements:
bash
and/ornode
installed on your system.- Tenderly CLI installed and authenticated.
Clone repository with scripts
Clone the GitHub repository and navigate to the spawn-devnet-auto
directory:
git clone git@github.com:Tenderly/devnet-examples.git
cd devnet-examples/spawn-devnet-auto
You will find two directories with code for spawning DevNets:
- a bash version:
spawn-devnet.sh
- a JS version:
spawn-devnet.js
Spawning via Bash
Navigate to bash
folder
cd ./bash
Set up environment variables
Create an .env
file in your project directory and include the necessary environment variables:
TENDERLY_DEVNET_TEMPLATE=your_template
TENDERLY_PROJECT_SLUG=your_project_slug
Run the spawn-devnet.sh
script
To run the script, use the following command in your terminal:
./spawn-devnet.sh
The script spawns a DevNet, extracts the RPC URL, and sets it as an environment variable in your .zshrc
file.
Spawning via JavaScript
Navigate to the js directory
cd ./js
Set up an .env
file
Create a .env
in your project root, and include the following values:
TENDERLY_ACCESS_KEY=your_access_key
TENDERLY_PROJECT_SLUG=your_project_slug
TENDERLY_DEVNET_TEMPLATE=your_devnet_tempalte
TENDERLY_ACCOUNT_ID=your_account_id
Run the spawn-devnet
script
To run the script, use the following command in your terminal:
yarn spawn-devnet
The script spawns a DevNet, extracts the RPC URL, and updates it in your .env
file.