Deploy Relayer
The Relayer is a key component that facilitates cross-layer communication between Layer 1 and Layer 2, such as submitting proofs or syncing finalized state. It ensures that Surge’s L2 state transitions are correctly reflected and verified on L1.
This guide walks you through deploying and configuring the Surge Relayer.
To understand how the Relayer fits into the broader system, check the Surge Architecture documentation.
Step 1: Clone the Repository
Clone the Surge Taiko Mono repository to your local environment and navigate into it:
git clone https://github.com/NethermindEth/surge-taiko-mono.git
cd surge-taiko-mono/
Step 2: Navigate to the Relayer Directory
cp packages/relayer
Step 3: Environment Configuration
Create your environment configuration file (.env
) by copying the provided sample:
cp .env.devnet .env
The .env.devnet
file contains default values for L1_RPC_URL
and L2_RPC_URL
based on the configuration steps completed earlier. These defaults are suitable for most setups, but feel free to update them to match your own environment if needed.
Step 4: Relayer Deployment
Deploy the relayer components in the following sequence:
Step 1: Initialize Components
Run the command to start necessary services:
docker compose --profile init up -d
This starts essential services such as the relayer database and queue.
Step 2: Run Database Migrations
Allow some time (20 seconds recommended) for services to initialize, then execute migrations:
# Wait for services to initialize
sleep 20
# Execute migrations
docker compose --profile migrations up
This step establishes your database schema and initial configurations required by the relayer.
Step 3: Start Relayer Service
Launch the main relayer services, connecting both L1 and L2:
docker compose --profile l1 --profile l2 --profile api up -d
This will activate the relayer service along with API interfaces.
Verification
Post-deployment verification steps:
- Ensure the database initialization succeeded.
- Confirm database migrations completed without errors.
- Validate the relayer is running and properly connected to L1 and L2.
Health Checks
Use the following commands to verify component health:
# List running containers
docker compose ps
# View logs for specific components, e.g., L1 processor
docker logs relayer-l1-processor
# Monitor database logs
docker compose logs db -f --tail=100
# Review migration logs for errors.
docker compose logs migrations
Ensure all relayer components are fully operational before proceeding with network operations. The relayer is a critical component for cross-layer communication.