Skip to main content

Quick Start

This guide will get you up and running with a local Relay Contracts deployment in under 10 minutes.

Prerequisites

  • Docker installed
  • Node.js and npm/yarn
  • Foundry installed
  • Basic familiarity with Ethereum development

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:

  1. InitSetup: Deploy core contracts
  2. MasterSetup: Configure network and register operators
  3. GenesisGeneration: Create initial validator set
  4. GenesisSetup: Initialize settlement contracts

What Gets Deployed

After successful deployment, you'll have:

  • 5 Core Contracts:

    • MyNetwork: Network registry integration
    • VotingPowerProvider: Manages voting power with extensions
    • MyKeyRegistry: Handles operator keys (BLS + ECDSA)
    • MyValSetDriver: Validator set management
    • MySettlement: 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:

  1. Understand the deployment flow - See Deployment Flow Deep Dive
  2. Explore extensions - Extension contracts for custom Voting Power providers logic
  3. Customize for your use case
  4. Integrate with Relay binary - See Network Integration