This README outlines the technical configuration for deploying and testing the fossil-light-client
in a local development environment.
Before getting started, you'll need Docker and Docker Compose installed on your system.
- Windows & Mac: Download and install Docker Desktop
- Linux: Follow the official installation instructions for your distribution
- After installation on Linux, remember to follow the post-installation steps to run Docker without sudo
If you're on Linux, you'll need to install Docker Buildx:
# Create docker cli plugins directory
mkdir -p ~/.docker/cli-plugins/
# Download buildx binary
curl -L https://github.com/docker/buildx/releases/download/v0.12.1/buildx-v0.12.1.linux-amd64 -o ~/.docker/cli-plugins/docker-buildx
# Make it executable
chmod +x ~/.docker/cli-plugins/docker-buildx
After installation, verify that Docker is properly installed:
docker --version
docker compose version
docker buildx version # Should work after installing buildx
You should see version numbers for both commands. If you get any errors, consult the Docker troubleshooting guide.
The easiest way to get started is using Docker. This method handles all dependencies and environment setup automatically.
- Docker
- Docker Compose
- Docker Buildx (for Linux users)
First, build all required Docker images:
# Make the build script executable
chmod +x scripts/build-images.sh
# Build all images
# For normal build:
./scripts/build-images.sh
# For verbose build output:
./scripts/build-images.sh --verbose # or -v
This will build the following images:
- anvil: Ethereum development node
- katana: StarkNet development node
- deploy: Deployment container for contracts
- build-mmr: MMR builder service
- relayer: Block hash relayer service
- client: Fossil light client
Note: The
--verbose
flag shows detailed build progress and is useful for debugging build issues.
The application is split into two parts: core infrastructure and services. They need to be run in a specific sequence.
First, start the core infrastructure services (Ethereum node, StarkNet node, and deployments):
# Start anvil, katana, and run deployments
docker-compose up -d
# Wait for all deployments to complete
# You can check logs with:
docker-compose logs -f
After the core infrastructure is running and deployments are complete, run the additional services in sequence:
# 1. Run MMR Builder
docker-compose -f docker-compose.services.yml run --rm mmr-builder
# 2. Start the Relayer
docker-compose -f docker-compose.services.yml up -d relayer
# 3. Start the Client
docker-compose -f docker-compose.services.yml up -d client
You can monitor the services using:
# Check all running containers
docker ps
# View logs for specific services
docker-compose logs -f # For core infrastructure
docker-compose -f docker-compose.services.yml logs -f # For services
# View logs for specific container
docker logs -f <container-name>
To stop and remove all containers:
# Stop core infrastructure
docker-compose down
# Stop services
docker-compose -f docker-compose.services.yml down
# Remove the docker network
docker network rm fossil-network
If you see warnings about orphaned containers:
docker-compose -f docker-compose.services.yml up -d --remove-orphans
To reset everything and start fresh:
# Stop and remove all containers
docker-compose down
docker-compose -f docker-compose.services.yml down
# Remove all related containers (optional)
docker rm $(docker ps -a -q --filter name=fossil-light-client)
# Start again from step 1
To check existing networks:
docker network ls
To clean up and recreate the network:
# Remove existing network (if any)
docker network rm fossil-network
# Network will be automatically created when running docker-compose up
If you need to run the components locally without Docker, follow these instructions.
Required toolchain components:
-
Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Risc0 zkVM toolchain:
curl -L https://risczero.com/install | bash rzup
-
Dojo framework:
curl -L https://install.dojoengine.org | bash dojoup
-
Foundry development framework:
curl -L https://foundry.paradigm.xyz | bash foundryup
-
Load environment configuration:
source .env
-
Initialize Anvil instance with mainnet fork:
anvil --fork-url $ETH_RPC_URL --block-time 12
Technical Note: Configure
${ETH_RPC_URL}
inanvil.env
with an RPC endpoint (Infura/Alchemy) for mainnet state replication.
-
Source environment variables:
source .env
-
Configure
anvil.messaging.json
with fork block parameters from Anvil initialization output. -
Initialize Katana with L1 messaging bridge:
katana --messaging $ANVIL_CONFIG --disable-fee --disable-validate
-
Initialize environment:
source .env
-
Execute deployment pipeline:
./scripts/deploy.sh
The MMR builder supports several options for controlling how the MMR is built:
# Build MMR with default settings (from latest finalized block)
cargo run --bin build_mmr --release
# Build from a specific start block
cargo run --bin build_mmr --release -- --start-block <BLOCK_NUMBER>
# Build from the latest onchain MMR block
cargo run --bin build_mmr --release -- --from-latest
# Control batch size
cargo run --bin build_mmr --release -- --batch-size <SIZE>
# Process specific number of batches
cargo run --bin build_mmr --release -- --num-batches <COUNT>
# Skip proof verification
cargo run --bin build_mmr --release -- --skip-proof
# Combine options (examples)
cargo run --bin build_mmr --release -- --from-latest --num-batches 10
cargo run --bin build_mmr --release -- --start-block 1000 --batch-size 512
Available options:
--start-block, -s
: Start building from this block number--from-latest, -l
: Start building from the latest onchain MMR block--batch-size
: Number of blocks per batch (default: 1024)--num-batches, -n
: Number of batches to process--skip-proof, -p
: Skip proof verification--env-file, -e
: Path to environment file (default: .env)
Note: --from-latest
and --start-block
cannot be used together.
Execute client binary:
cargo run --bin client --release
The client supports the following options:
# Run with default settings (5 second polling interval)
cargo run --bin client --release
# Run with custom polling interval (in seconds)
cargo run --bin client --release -- --polling-interval 10
# Use a specific environment file
cargo run --bin client --release -- --env-file .env.local
Available options:
--polling-interval
: Time between polls in seconds (default: 5)--env-file, -e
: Path to environment file (default: .env)
Execute relayer process:
./scripts/run_relayer.sh