Automated DevNet Spawning: Bash & 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 GitHub repository:
example
git clone git@github.com:Tenderly/devnet-examples.git
Navigate into the cloned repository:
example
cd devnet-examples/spawn-devnet-auto
You will find two directories with code for spawning DevNets: a bash (spawn-devnet.sh
) and other JS directory (spawn-devnet.js
).
Bash Script Example
- Navigate to
bash
folders:
example
cd ./bash
```
2. Create a `.env` file in your project directory and include the necessary environment variables:
```bash filename="example" showLineNumbers
TENDERLY_DEVNET_TEMPLATE=your_template
TENDERLY_PROJECT_SLUG=your_project_slug
```
3. To run the script, use the following command in your terminal:
```bash filename="example" showLineNumbers
./spawn-devnet.sh
```
4. The script spawns a DevNet, extracts the RPC URL, and sets it as an environment variable in your `.zshrc` file.
## JavaScript Script Example
1. Navigate to the js directory
```bash filename="example" showLineNumbers
cd ./js
```
2. Create a `.env` in your project root, include the following values:
```bash filename="example" showLineNumbers
TENDERLY_ACCESS_KEY=your_access_key
TENDERLY_PROJECT_SLUG=your_project_slug
TENDERLY_DEVNET_TEMPLATE=your_devnet_tempalte
TENDERLY_ACCOUNT_ID=your_account_id
```
3. To run the script, use the following command in your terminal:
```bash filename="example" showLineNumbers
yarn spawn-devnet
```
4. The script spawns a DevNet, extracts the RPC URL, and updates it in your `.env` file.
Through the above steps, you can seamlessly spawn DevNets in your development workflow using either **Bash** or **JavaScript**.