CLI for compute operations
npm install @eigenlayer/compute-cliBuild decentralized compute services. Generate server implementations and smart contracts from Solidity interfaces, then deploy them to EigenCompute.
> ⚠️ Alpha Software: This CLI is in early development. APIs and generated code may change between versions.
``bash`
npm install -g @eigenlayer/compute-cli
`bash`
compute init my-service
This creates a new project with:
- Template Solidity interface (IMyServiceSpec.sol)
- Foundry project structure
- Package.json with gen script
`bash`
cd my-service
Edit the generated interface file to add your compute functions:
`solidity`
// IMyServiceSpec.sol
interface IMyServiceSpec {
function calculateSum(uint256 a, uint256 b) external returns (uint256);
// Add your functions here
}
`bash`
npm run gen
This generates:
- Complete server implementation (Rust)
- Smart contracts for EigenCompute
- Docker configuration
- Deployment scripts
Server logic (e.g., src/main.rs for Rust):
`rust`
// Find the generated function stub and add your implementation
async fn calculate_sum(a: U256, b: U256) -> Result
Ok(a + b) // Your compute logic here
}
Contract customization:
- Modify contracts/src/MyService.sol for additional on-chain logic
- Add access controls, state variables, or events as needed
`bash`
export PRIVATE_KEY=0x123...
npm run deploy
Choose to deploy:
- Offchain only: Docker image to EigenDA
- Onchain only: Smart contract with forge
- Both: Complete deployment
That's it! Your decentralized compute service is ready.
---
Run without arguments for a guided experience:
`bash`
compute
`bash`
compute init [project-name] [-l language] [-o directory]
`bash`
compute gen [interface.sol] [-l language] [-o directory]
`bash`
compute deploy [options]
1. Users call your deployed contract
2. Operators execute using your generated server
3. Results return to your contract with proofs
4. Contract acts on computed results
---
- Rust (rust, rs) - Fully supportedpython
- Python (, py) - Alpha supporttypescript
- TypeScript (, ts) - Coming soongolang
- Go (, go) - Coming soon
You can modify the generated server code to build your application. However, there are some resource constraints you need to be aware of.
Currently we only support building for x86_64/amd64 architecture and only allow certain external calls
The following external calls are allowed. If you need access to them, read from these environment variables in your application:
- ETH_RPC_URL (Ethereum RPC URL)
- ARBITRUM_RPC_URL (Arbitrum RPC URL)
- BASE_RPC_URL (Base RPC URL)
- DA_PROXY_URL (EigenDA proxy URL)
``
my-service/
├── src/ # Server implementation
├── contracts/ # Smart contracts
├── Dockerfile # Container config
└── package.json # Project config
#### Networks
- base-sepolia (default) - EigenLayer testnetlocalhost
- - Local development
- Custom chains - Via chain ID and RPC URL
#### Deploy Command Options
`bash`
compute deploy
--network
--dockerfile
--image
--contract-path
--private-key
--offchain # Deploy only Docker image
--onchain # Deploy only smart contract
--all # Deploy both (same as no flag)
- Node.js 16+
- For development: Rust toolchain, Foundry
- For deployment: Docker, private key with funds
#### Testing Locally
`bash`
cd my-service
cargo run # Run server
docker build -t my-service . # Test with Docker
#### Contract Development
`bash`
cd my-service/contracts
forge soldeer install # Install dependencies
forge build # Compile
forge test # Run tests
#### Updating Your Deployment
`bash`
cd my-service
npm run deploy:offchain # Update server logic (keeps same contract)
npm run deploy:onchain # Deploy new contract instance
npm run deploy # Deploy both (new contract + server)
Note: Use deploy:offchain when you've only changed computation logic but kept the same interface. Your existing contract will automatically use the updated server code.
#### Using npx (No Installation)
`bash`
npx @eigenlayer/compute-cli init
npx @eigenlayer/compute-cli gen interface.sol
npx @eigenlayer/compute-cli deploy
- init → initialize, newgen
- → generate, create
Server Code:
- Complete async implementation
- Type definitions from Solidity
- Docker configuration
Smart Contracts:
- EigenCompute receiver contract
- Implementation contract
- Deployment scripts
- Foundry configuration
- PRIVATE_KEY - Required for deployment
- Custom RPC endpoints and contract addresses available via flags
See examples/` directory for sample projects.
BUSL-1.1