Hello World AVS
Welcome to the Hello World AVS. This project shows you the simplest functionality you can expect from an AVS. It will give you a concrete understanding of the basic components. For new users, please find this video walkthrough of the hello world AVS repository.
That's it. This simple flow highlights some of the core mechanics of how AVSs work.
[!WARNING] This example does not use the new operator-sets workflow. Please refer to ELIP-002 for more details. For an example of the new workflow, check out the Incredible Squaring examples (Go version here, Rust version here).
The example includes a simple slashing condition: "a task MUST be responded by enough operators before N blocks have passed since the task creation". You can modify the OPERATOR_RESPONSE_PERCENTAGE value in the .env file to adjust the chance of an operator responding to a task.
In case this condition isn't satisfied by some operator, anyone can permissionlessly slash them via calling HelloWorldServiceManager.slashOperator.
For the Rust example, we have a challenger that listens for new tasks and checks whether the operators have responded. If not, challenger is authorized to slash the operator.
The following instructions explain how to manually deploy the AVS from scratch including EigenLayer and AVS specific contracts using Foundry (forge) to a local anvil chain, and start Typescript Operator application and tasks.
This section describes the tooling required for local development.
Install dependencies:
On Nix platforms, if you already have the proper Nix configuration, you can build the project's artifacts inside a nix develop shell
nix developOtherwise, please refer to installed and configured section.
In terminal window #1, execute the following commands:
# Install npm packages
npm install
# Start local anvil chain
npm run start:anvilOpen a separate terminal window #2, execute the following commands
# Setup .env file
cp .env.example .env
cp contracts/.env.example contracts/.env
# Updates dependencies if necessary and builds the contracts
npm run build:forge
# Deploy the EigenLayer contracts
npm run deploy:core
# Deploy the Hello World AVS contracts
npm run deploy:hello-world
# (Optional) Update ABIs
npm run extract:abis
# Start the Operator application
npm run start:operatorOpen a separate terminal window #3, execute the following commands
# Start the createNewTasks application
npm run start:trafficIn a terminal, start a new instance of anvil and deploy the core and avs contracts
# Start anvil
npm run start:anvil
# Deploy the EigenLayer contracts
npm run deploy:core
# Deploy the Hello World AVS contracts
npm run deploy:hello-world
In another terminal, run:
# Create distribution roots
npm run create-distributions-root
# Claim created distribution
npm run claim-distributionsTo run operator directed rewards distribution, run:
#Create distribution roots
npm run create-operator-directed-distributions-root
# Claim created rewards distribution
npm run claim-distributionsFor Rust example, we have a simple operator that monitors new tasks and responds to them, a spammer that generates random tasks and a challeger that listens for new tasks and checks the operators response, if found that operator did not respond to the task, it will slash the operator.
In terminal window #1, execute the following commands:
# Start local anvil chain
anvilOpen a separate terminal window #2, execute the following commands
# Setup .env file
cp .env.example .env
cp contracts/.env.example contracts/.env
# Builds the contracts
make build-contracts
# Deploy the EigenLayer contracts
make deploy-eigenlayer-contracts
# Deploy the Hello World AVS contracts
make deploy-helloworld-contractsIn terminal window #2, execute the following command
# Start the Challenge Manager
make start-rust-challengerIn terminal window #3, execute the following command
# Start the Operator
make start-rust-operatorOpen a separate terminal window #4, execute the following command
# Start sending tasks
make spam-rust-tasks# Build contracts
make build-contracts
# Starts anvil in the background with the --dump-state flag, builds and deploys the
# contracts, and generates a state.json file for use in tests.
make build-anvil-state-with-deployed-contractscargo test --workspaceFor help and support deploying and modifying this repo for your AVS, please:
--revert-strings debug flag via the following commands and retest: npm run deploy:core-debug && npm run deploy:hello-world-debugforge verify-contract --chain-id 17000 --num-of-optimizations 200 src/YourContract.sol:YourContract YOUR_CONTRACT_ADDRESScast call --trace "trace_replayTransaction(0xTransactionHash)").If you're planning to build an AVS and would like to speak with a member of the EigenLayer DevRel team to discuss your ideas or architecture, please fill out this form and we'll be in touch shortly: EigenLayer AVS Intro Call
ECDSAServiceManagerBase implementation in HelloWorldServiceManager.sol to a BLS style architecture using RegistryCoordinator.The architecture can be further enhanced via:
No open issues yet, or sync has not completed.