Building AVS with the EigenLayer ECDSA Template
Introduction
This guide will walk you through the process of utilizing our ECDSA Template to initiate your own AVS with ECDSA-oriented Smart Contracts. For reference, the Tangle AVS (opens in a new tab) demonstrates an implementation of an AVS using ECDSA contracts.
Prerequisites
cargo-tangle
CLI- docker desktop (opens in a new tab)
- foundry (opens in a new tab) (stable)
- rust (opens in a new tab)
Complete Workflow
1. Installation
cargo install cargo-tangle --git https://github.com/tangle-network/gadget --force
2. Creating Your Project
To create a new ECDSA AVS, use the following command:
cargo tangle blueprint create --name <blueprint_name> --eigenlayer ecdsa
Replace <blueprint_name>
with your desired AVS name. You'll be prompted with configuration questions - if unsure, the default selections are recommended.
3. Building Your AVS
cargo build --release
4. Deploying Your Contracts
For local development:
# Deploy to local devnet
cargo tangle blueprint deploy eigenlayer \
--devnet \
--ordered-deployment
For testnet deployment:
# Deploy to testnet
cargo tangle blueprint deploy eigenlayer \
--network testnet \
--rpc-url <YOUR_RPC_URL> \
--ordered-deployment
Addresses for deployment
If you're using the template as is, you can find the addresses of the contracts you need in your project's settings.env file. Others are below.
Address | Value |
---|---|
Registry Coordinator | 0xc3e53f4d16ae77db1c982e75a937b9f60fe63690 |
Pauser Registry | Obtained from beginning of Deployment output |
Initial Owner | 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 |
Aggregator | 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 |
Generator | 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 |
AVS Directory | 0x0000000000000000000000000000000000000000 |
Rewards Coordinator | 0x0000000000000000000000000000000000000000 |
Stake Registry | 0x5fc8d32690cc91d4c39d9d3abcbd16989f875707 |
Tangle Task Manager | Obtained in Deployment output |
Once all contracts have been deployed, you will notice that it continues running to keep the testnet alive.
Deployment Options
--rpc-url <URL>
: HTTP RPC endpoint (required unless using --devnet)--contracts-path <PATH>
: Path to contracts directory (defaults to "./contracts")--ordered-deployment
: Interactive ordered deployment-w, --network <NETWORK>
: Target network (local, testnet, mainnet)--devnet
: Start local Anvil devnet-k, --keystore-path <PATH>
: Keystore path (defaults to ./keystore)
5. Running Your Service
cargo tangle blueprint run \
-p eigenlayer \
-u <YOUR_RPC_URL> \
(OPTIONAL) --keystore-path ./test-keystore
Run Options
-p, --protocol eigenlayer
: Specify Eigenlayer protocol-u, --rpc-url <URL>
: HTTP RPC endpoint URL (required)-k, --keystore-path <PATH>
: Keystore path (defaults to ./keystore)-b, --binary-path <PATH>
: AVS binary path (optional)-w, --network <NETWORK>
: Network to connect to-d, --data-dir <PATH>
: Data directory path (defaults to ./data)-n, --bootnodes <NODES>
: Optional bootnodes-f, --settings-file <PATH>
: Protocol settings file path (defaults to ./settings.env)
6. Required Environment Variables
Your settings.env file must include:
REGISTRY_COORDINATOR_ADDRESS
: Registry Coordinator contract addressOPERATOR_STATE_RETRIEVER_ADDRESS
: Operator State Retriever contract addressDELEGATION_MANAGER_ADDRESS
: Delegation Manager contract addressSERVICE_MANAGER_ADDRESS
: Service Manager contract addressSTAKE_REGISTRY_ADDRESS
: Stake Registry contract addressSTRATEGY_MANAGER_ADDRESS
: Strategy Manager contract addressAVS_DIRECTORY_ADDRESS
: AVS Directory contract addressREWARDS_COORDINATOR_ADDRESS
: Rewards Coordinator contract address
7. Testing
To verify your setup:
cargo test
Troubleshooting
Common Deployment Issues
- Verify RPC endpoint accessibility
- Confirm network specification (local, testnet, mainnet)
- Check contract constructor arguments
- Ensure sufficient deployment funds
Service Issues
- Verify settings.env contains all required addresses
- Confirm contract addresses match chosen network
- Check binary build features
- Verify network connectivity and RPC endpoint
Customizing Your AVS
The template provides a foundation that you can build upon:
- The default contract is named TangleServiceManager.sol (with related test files TestTangleServiceManager.sol and TangleServiceManager.t.sol). Use find-and-replace to rename as needed.
- For event listener examples, see event listeners documentation.
- For job implementation details, consult the jobs documentation.
Development Keys
pub const ANVIL_PRIVATE_KEYS: [&str; 10] = [
"ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
"5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
"7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6",
"47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
"8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
"92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e",
"4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356",
"dbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97",
"2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
];