Layr-Labs / hello-world-avs

Hello World AVS
MIT License
58 stars 53 forks source link

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.

Architecture

hello-world-png

AVS User Flow

1) AVS consumer requests a "Hello World" message to be generated and signed. 2) HelloWorld contract receives the request and emits a NewTaskCreated event for the request. 3) All Operators who are registered to the AVS and has staked, delegated assets takes this request. Operator generates the requested message, hashes it, and signs the hash with their private key. 4) Each Operator submits their signed hash back to the HelloWorld AVS contract. 5) If the Operator is registered to the AVS and has the minimum needed stake, the submission is accepted.

That's it. This simple flow highlights some of the core mechanics of how AVSs work.

Local Devnet Deployment

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.

Install dependencies:

Start Anvil Chain

In terminal window #1, execute the following commands:


# Install npm packages
npm install

# Start local anvil chain
npm run start:anvil

Deploy Contracts and Start Operator

Open 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

# 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:operator

Create Hello-World-AVS Tasks

Open a separate terminal window #3, execute the following commands

# Start the createNewTasks application 
npm run start:traffic

Help and Support

For help and support deploying and modifying this repo for your AVS, please:

  1. Open a ticket via the intercom link at support.eigenlayer.xyz.
  2. Include the necessary troubleshooting information for your environment:

Disclaimers

Appendix (Future Capabilities In Progress)

Adding a New Strategy

Potential Enhancements to the AVS (for learning purposes)

The architecture can be further enhanced via:

Rust Operator instructions

Automated deployment (uses existing state file)

  1. Run make start-chain-with-contracts-deployed

    • This will build the contracts, start an Anvil chain, deploy the contracts to it, and leaves the chain running in the current terminal
  2. Run make start-rust-operator

  3. Run make spam-rust-tasks

Tests are supported in anvil only . Make sure to run the 1st command before running the tests:

cargo test --workspace

Existing Holesky Testnet Deployment

Contract Name Holesky Address
Hello World Service Manager 0x3361953F4a9628672dCBcDb29e91735fb1985390

Please see Current Testnet Deployment for additional deployed addresses.

You don't need to run a deployment script for holesky testnet, the contracts are already deployed.

  1. Use the HOLESKY_ namespace env parameters in the code , instead of normal parameters.

  2. Run make start-rust-operator

  3. Run make spam-rust-tasks