Quick Start
This guide will get you up and running with a local Relay Contracts deployment in under 10 minutes.
Prerequisites
1. Repository Setup
# Clone the repository with submodules
git clone --recurse-submodules https://github.com/symbioticfi/relay-contracts.git
cd relay-contracts
# Install dependencies
npm install
# or
yarn install
2. Environment Configuration
# Create environment file
cp .env.example .env
Edit .env
with key parameters:
# Number of operators in your network (default: 4)
OPERATORS=4
# Signature verification type (0 = ZK, 1 = Simple)
VERIFICATION_TYPE=1
# Epoch duration in seconds (default: 60 for testing)
EPOCH_DURATION=60
# Slashing window in seconds (default: 1200)
SLASHING_WINDOW=1200
# Block time for Anvil (optional, default: 1)
BLOCK_TIME=1
# Deployment buffer time (optional, default: 10)
DEPLOYMENT_BUFFER=10
3. Local Development Environment
Build Docker Image
docker build -t symbiotic-anvil .
Start Anvil Node with Symbiotic Core
# Start the node in background
docker run --rm -d -p 8545:8545 --env-file .env --name symbiotic-node symbiotic-anvil
# Verify it's running
curl -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
http://localhost:8545
This sets up:
- Local Anvil node on port 8545
- Pre-deployed Symbiotic Core contracts (operators, vaults, tokens)
- Test accounts with ETH balances
- Development-friendly block times
4. Deploy Network Middleware
Run the complete deployment sequence:
# Deploy and configure the network
docker run --rm -it --env-file .env --network host symbiotic-anvil yarn deploy:network
This executes the full 4-step deployment:
- InitSetup: Deploy core contracts
- MasterSetup: Configure network and register operators
- GenesisGeneration: Create initial validator set
- GenesisSetup: Initialize settlement contracts
What Gets Deployed
After successful deployment, you'll have:
-
5 Core Contracts:
MyNetwork
: Network registry integrationVotingPowerProvider
: Manages voting power with extensionsMyKeyRegistry
: Handles operator keys (BLS + ECDSA)MyValSetDriver
: Validator set managementMySettlement
: Signature verification and state commitment
-
Test Data:
- 4 registered operators with keys
- Mock vaults with stake
- Initial validator set committed
- Ready for Relay binary integration
5. Verify Deployment
Check that everything is working:
# Run contract tests
forge test
# Check coverage
forge coverage
6. Explore the System
Contract Addresses
Deployment outputs all contract addresses.
Save these for integration. For Relay binary to run, you will need ValSetDriver
address
Key Integration Points
- ValSetDriver: Primary interface for Relay binary
- Settlement: Where applications verify signatures
- VotingPowerProvider: Manages operator participation
7. Clean Up
When done testing:
# Stop the Anvil node
docker stop symbiotic-node
# Remove containers if needed
docker container prune
Next Steps
Now that you have a working deployment:
- Understand the deployment flow - See Deployment Flow Deep Dive
- Explore extensions - Extension contracts for custom Voting Power providers logic
- Customize for your use case
- Integrate with Relay binary - See Network Integration