Devkit Quickstart Testnet Guide

This quickstart guide will get an AVS up and running on Sepolia and Base Sepolia using devkit. Devkit is a tool that streamlines AVS development, providing a strong local development loop that enables rapid prototyping, testing, and deployment in live environments. Devkit cuts AVS development time from weeks to hours.

This guide uses the Hourglass Framework, for a deeper dive into the architecture, refer to here. This framework allows you to build things like oracles or co-processors with ease. Within the guide we will:

  1. Create an AVS project and test it on devnet.
  2. Deploy the AVS on Sepolia and Base Sepolia
  3. Create EigenLayer Operators and register them to the AVS.
  4. Create and verify a task on Base Sepolia.

If you have any questions while working on this tutorial, get in touch with our team here

Requirements

Before we begin, ensure that you have met the requirements below, including installed software, funded Ethereum accounts and access to RPC providers.

Guide

Create project

The first step is to create your AVS project, this will contain the contracts and code run by Operators. 

Create your AVS project. This will create an AVS project in the current directory. Run:

    1. devkit avs create sepolia-deployment
    2. Navigate to the project, run: cd ./sepolia-deployment

Edit code

Devkit abstracts away the AVS infrastructure, allowing you to focus on your differentiating business logic. A Go project is vendored which you will extend. We won’t cover it in this guide, but it is recommended to add testing in cmd/main_test.go.

Edit cmd/main.go this is where you will place the Operator’s business logic. Edit HandleTask, which performs work over the bytes. Add: 

resultBytes = []byte("Hello, World!")

Run local devnet

To enable fast iteration and experimentation, you can run your AVS within a local devnet (this is using Anvil under the hood). This forms your local development loop. 

Ensure docker is running. 

  1. Set the RPC urls. Run:
    1. cp .env.example .env
    2. Set the the Sepolia RPC as the L1_FORK_URL and Base Sepolia RPC as the L2_FORK_URL
  2. Build your project. Run:
    1. devkit avs build
  3. Start devnet. Run:
    1. ddevkit avs devnet start
  4. Make a test call. Run:
    1. devkit avs call signature="(uint256,string)" args='(5,"hello")'

Deploy to testnet

Once you have verified your AVS flow on local devnet, the next step is to deploy to Sepolia. Devkit manages this for you through contexts, which is akin to a project manifest.

  1. Create a testnet context. Run:
    1. devkit avs context create --context testnet 
    2. Follow the wizard steps. Use https://example.com/metadata.json for metadata
  2. Deploy the contracts on testnet. Run:
    1. devkit avs deploy contracts l1 

Prepare a release

Your AVS software (Go code) that you wrote needs to be made available for Operators to run; we will push the artefacts to ghcr and store the information onchain.

  1. Authenticate access with a Github access token. Following the steps here. Run:
    1. echo $GITHUB_TOKEN | docker login ghcr.io -u <YOUR GH USERNAME> --password-stdin
  2. Set the metadata URI for your Operator Sets. Run: 
    1. devkit avs release uri --metadata-uri "https://example.com/metadata.json" --operator-set-id 0
    2.  devkit avs release uri --metadata-uri "https://example.com/metadata.json" --operator-set-id 1
  3. Build the project. Run:
    1. devkit avs build
  4.  Publish release on ghcr. Run:
    1. devkit avs release publish  --upgrade-by-time 2050000000 --registry ghcr.io/<GH username>/sepolia
    2. Make the registry public under the settings of the package

Run hgctl

With the AVS contracts deployed, we need to create Operators and register them with the AVS. Hgctl is a tool to manage Operator infrastructure, resources and tasks,

  1. Create the environment. Run:  
    1. hgctl context create sepolia 
    2. Follow the prompted steps, use the same RPC urls from Devkit
  2. Create an ECDSA keypair for the Operator. Run:
    1. hgctl keystore create --name=tutorial-operator-0 --type=ecdsa
      1. This will be the key for the Operator in Operator Set 0
    2. hgctl keystore create --name=tutorial-operator-1 --type=ecdsa
      1. This will be the key for the Operator in Operator Set 1
  3. Set the environment and signer. Run:
    1. export OPERATOR_PRIVATE_KEY =<ECDSA PRIV KEY>
    2. export SYSTEM_PRIVATE_KEY=<ECDSA PRIV KEY>
    3. export SYSTEM_ECDSA_ADDRESS=<ECDSA PUBKEY>
    4. Run:  hgctl signer
    5. For: “Select Operator Signer Type” select “Private Key”
    6. For: “Select Key Type” select “ECDSA” then “Private Key”
  4. Set the Operator address and AVS address. Run:
    1. hgctl context set --avs-address=<The same AVS address from Devkit (AVS PUBKEY)>
    2. hgctl context set --operator-address=<The ECDSA public key of the Operator> Set this to the public key of tutorial-operator-0 (you can get this address from the output of the key generation command in your console)
  5. Fund the Operator address with Sepolia Eth and stETH
    1. Use the deposit function here to get stETH by depositing Sepolia Eth

Allow list the Operator from devkit. Run:

  1. Retrieve the AVS Task Registrar address from testnet.yaml under deployed_l1_contracts under the name taskAVSRegistrar
  2. Run the following Cast command:
cast send <TASK REGISTRAR ADDRESS>\
  "addOperatorToAllowlist((address,uint32),address)" \
  "(<AVS ADDRESS>, 0)" \
  <OPERATOR ADDRESS>\
  --rpc-url <L1 RPC URL> \
  --private-key <AVS PRIVATE KEY>

Register the Operator with the AVS:

  1. Register the Operator. Run:
    1.  hgctl el register-operator --metadata-uri https://example.com/operator/metadata.json –allocation-delay 0
  2. Deposit stETH into the stETH strategy. Run:
  3. hgctl el deposit --strategy=0x8b29d91e67b013e855EaFe0ad704aC4Ab086a574 --token-address=0x00c71b0fCadE911B2feeE9912DE4Fe19eB04ca56 --amount='0.001 ether'
  4. Register the Operator’s key for the Operator Set. Run: 
    1. hgctl el register-key
  5. Register the Operator for the AVS Operator Set 0. Here we provide the URL the container will run on (this is so other services can locate your Operator). Run:
    1. hgctl el register-avs --socket host.docker.internal:9000
  6. Wait 15-20 minutes to account for the configuration delay on the AllocationManager. 
  7. Allocate Stake to the AVS Operator Set 0. Run:
    1. hgctl el allocate  --strategy 0x8b29d91e67b013e855EaFe0ad704aC4Ab086a574 --magnitude 1e13

Deploy Aggregator:

  1. Ensure docker is running
  2. Deploy the aggregator. Run:
    1. hgctl deploy aggregator 
  3. Register the AVS on the aggregator. Run:
grpcurl -plaintext \
 -d '{
  "avs_address": <AVS ADDRESS>,
  "chain_ids": [11155111, 84532]
 }' \
 localhost:9010 \
 eigenlayer.hourglass.v1.AggregatorManagementService/RegisterAvs

Deploy Executor:

  1. Deploy the Executor. Run:
    1. hgctl context set --operator-set-id=1
    2. hgctl signer remove
    3. export OPERATOR_PRIVATE_KEY =<ECDSA PRIV KEY>
    4. export SYSTEM_PRIVATE_KEY=<ECDSA PRIV KEY>
    5. export SYSTEM_ECDSA_ADDRESS=<ECDSA PUBKEY>
    6. hgctl signer
      1. For: “Select Operator Signer Type” select “Private Key”
      2. For: “Select Key Type” select “ECDSA” then “Private Key”
    7. hgctl context set --operator-address=<The ECDSA public key of the Operator>
    8. hgctl el register-operator --metadata-uri https://example.com/operator/metadata.json –allocation-delay 0
    9. hgctl el deposit --strategy=0x8b29d91e67b013e855EaFe0ad704aC4Ab086a574 --token-address=0x00c71b0fCadE911B2feeE9912DE4Fe19eB04ca56 --amount='0.001 ether'
    10. hgctl el register-key
    11. hgctl el register-avs --socket host.docker.internal:9090
    12. hgctl el allocate  --strategy 0x8b29d91e67b013e855EaFe0ad704aC4Ab086a574 --magnitude 1e13
  2. Deploy the executor for Operator Set 1. Run:
    1. hgctl deploy executor
  3. Deploy the performer for Operator Set 1. Run:
    1. hgctl deploy performer

Interact with it on Base

The last step is to verify a task on Base Sepolia.

  1. Deploy the L2 contracts from your AVS project (sepolia-deployment) run:
    1. devkit avs deploy contracts l2 
  2. Submit a transaction to Base. Run:
    1. devkit avs call signature="(uint256,string)" args='(5,"hello")'

Congratulations, you have successfully deployed your AVS and verified your task on Base Sepolia. Eigen Labs is committed to making the AVS devex a smooth process, empowering developers to build differentiating AVSs. This guide has focused on the E2E development lifecycle for AVS management and provides the foundation for you to extend the logic to your needs. We are excited to see what you can build!

Eigen Labs appreciates your feedback, please raise any issues you have with Devkit or hgctl 

https://github.com/Layr-Labs/devkit-cli/issues 

https://github.com/Layr-Labs/hourglass-monorepo/issues