Developers
Build an Eigenlayer AVS
Eigenlayer BLS Template

Building AVS with the EigenLayer BLS Template

Introduction

This will guide you through the process of utilizing our BLS Template for starting your own AVS with BLS-oriented Smart Contracts. The Incredible Squaring AVS is an example of an AVS that uses BLS contracts.

Prerequisites

Complete Workflow

1. Installation

cargo install cargo-tangle --git https://github.com/tangle-network/gadget --force

2. Creating Your Project

To create a new BLS AVS, use the following command:

cargo tangle blueprint create --name <blueprint_name> --eigenlayer bls

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

If you're using the template as is

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.

AddressValue
Registry Coordinator0xc3e53f4d16ae77db1c982e75a937b9f60fe63690
Pauser RegistryObtained from beginning of Deployment output
Initial Owner0x70997970C51812dc3A010C7d01b50e0d17dc79C8
Aggregator0xa0Ee7A142d267C1f36714E4a8F75612F20a79720
Generator0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65
AVS Directory0x0000000000000000000000000000000000000000
Rewards Coordinator0x0000000000000000000000000000000000000000
Stake Registry0x5fc8d32690cc91d4c39d9d3abcbd16989f875707
Tangle Task ManagerObtained 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 address
  • OPERATOR_STATE_RETRIEVER_ADDRESS: Operator State Retriever contract address
  • DELEGATION_MANAGER_ADDRESS: Delegation Manager contract address
  • SERVICE_MANAGER_ADDRESS: Service Manager contract address
  • STAKE_REGISTRY_ADDRESS: Stake Registry contract address
  • STRATEGY_MANAGER_ADDRESS: Strategy Manager contract address
  • AVS_DIRECTORY_ADDRESS: AVS Directory contract address
  • REWARDS_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 contracts are named TangleServiceManager.sol, TangleTaskManager.sol, and ITangleTaskManager.sol by default. 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

The aggregator key is - 47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a The task generator key is - 2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6

pub const ANVIL_PRIVATE_KEYS: [&str; 10] = [
    "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
    "59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
    "5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
    "7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6",
    "47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
    "8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
    "92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e",
    "4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356",
    "dbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97",
    "2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
];