Deploying and running an Eigenlayer AVS from the BLS Template
The following is a step-by-step guide for deploying and running an AVS using the cargo-tangle CLI.
Prerequisites
cargo-tangleCLI- docker desktop
- foundry (stable)
- rust
Generating the AVS from the Template
Run the following command, answering each prompt for project information. For anything you aren’t certain about, the default selection is a safe choice. This command creates a BLS AVS called my-avs.
cargo tangle blueprint create --name my-avs --eigenlayer blsNow that you have generated your AVS project, move to the newly created directory.
cd my-avsDeploying the AVS to a local testnet
The AVS is fully ready to be deployed, perfect for testing locally. The following command will start a local testnet in the background and deploy the AVS’s necessary contracts.
cargo tangle blueprint deploy eigenlayer \
--devnet \
--ordered-deploymentIn this case, you want to deploy the contracts in an ordered manner. Specifically, you need to deploy the TangleTaskManager before the TangleServiceManager, since the Service Manager takes the Task Manager’s address as a constructor argument.
When you deploy the TangleTaskManager, you are also given the option to initialize it. You want to make sure you do this, supplying the initialization arguments when prompted.
You will be prompted for each contract’s constructor arguments (if it has any). You can find the addresses of the contracts you need in your project’s settings.env file. Below is a complete list of addresses you will need. Some are zero addresses because they aren’t actually used.
Default Addresses for demo deployment
| Address | Value |
|---|---|
| Registry Coordinator | Obtained from Deployment output |
| Pauser Registry | Obtained from Deployment output |
| Initial Owner | 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 |
| Aggregator | 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 |
| Generator | 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 |
| AVS Directory | 0x5fc8d32690cc91d4c39d9d3abcbd16989f875707 |
| Rewards Coordinator | 0xb7f8bc63bbcad18155201308c8f3540b07f84f5e |
| Stake Registry | 0x4c5859f0f772848b2d91f1d83e2fe57935348029 |
| Tangle Task Manager | Obtained from Deployment output |
Once all contracts have been deployed, you will notice that it continues running to keep the testnet alive.
Running the AVS
In a new terminal, run the following command in the project’s directory (make sure to replace the task manager address and the RPC URL with the values obtained from your deployment output):
TASK_MANAGER_ADDRESS=<ADDRESS_FROM_OUTPUT> cargo tangle blueprint run \
-p eigenlayer \
-u <URL_FROM_DEPLOYMENT_OUTPUT> \
--keystore-path ./test-keystoreRunning this once, will register the example operator (it uses Anvil’s account 0 by default) and then exit the process. Once the registration is complete, you simply need to run the same command again. Upon running the command for a second time, you should see “Successfully ran job function!” printed to the terminal, signifying that the job function was successfully executed!