Skip to content

Crucible Quick Reference

One-page cheat sheet for daily Crucible tasks. See also: CLI Reference (full), Simple Operations (detailed walkthroughs)


Setup & Environment

# Install
uv sync                              # Install Python dependencies

# Validate environment
crucible doctor                       # Check Python, Foundry, config, RPCs
crucible doctor --fix                 # Auto-fix common issues

# Initialize workspace
crucible init                         # Create runtime directories

# Configure RPC in .env
echo 'ETH_RPC_URL=https://rpc.ankr.com/eth/YOUR_KEY' >> .env

Forking Chains

# Single chain (Ethereum, port 8545)
crucible fork --topology single

# Multi-chain (Ethereum + Polygon, ports 8545 + 8546)
crucible fork --topology dual

# Bridge topology (Ethereum + Polygon + bridge plugin)
crucible fork --topology bridge

# With longer timeout for slow RPCs
crucible fork --topology dual --fork-timeout 600

# Blank fork (no archive RPC needed — standalone EVM)
# First set fork_block: null in testbed.local.yaml, then:
crucible fork --topology single

# See what's running
crucible status
crucible status --disk               # Include disk usage

Running Experiments

# Run with matching topology
crucible experiment run experiments/nomad_replay.yaml --no-baseline

# Skip baseline verification (first run on a machine)
crucible experiment run experiments/demo_experiment.yaml --no-baseline

# Skip fidelity enforcement (development only)
crucible experiment run experiments/nomad_replay.yaml --no-baseline --no-fidelity

# Name your run for easy identification later
crucible experiment run experiments/nomad_replay.yaml --name "my-nomad-test"

Common Experiments & Their Topologies

Experiment Topology Chains Needed
demo_experiment.yaml single Ethereum
nomad_replay.yaml bridge Ethereum + Polygon
wormhole_replay.yaml bridge Ethereum + Polygon
poly_network_replay.yaml bridge Ethereum + Polygon + BSC
horizon_replay.yaml single Ethereum
bnb_token_hub_replay.yaml single_bsc BSC

Topology mismatch: If you fork with --topology single but the experiment expects bridge, the attack executes but the L2 fidelity check will fail. Either match the topology, or use --no-fidelity for development.


Ad-Hoc Chain Interaction (cast)

export RPC=http://127.0.0.1:8545

# Query
cast balance 0xAddress --rpc-url $RPC
cast code 0xContract --rpc-url $RPC                # "0x" = EOA, bytecode = contract
cast storage 0xContract 0x0 --rpc-url $RPC
cast call 0xToken "totalSupply()(uint256)" --rpc-url $RPC
cast block-number --rpc-url $RPC

# Send transactions (auto-impersonate enabled)
cast rpc anvil_setBalance 0xAddress $(cast to-wei 100 ether) --rpc-url $RPC
cast send 0xToken "transfer(address,uint256)" 0xTo 1000 \
  --unlocked --from 0xOwner --rpc-url $RPC

# EVM manipulation
cast rpc evm_increaseTime 86400 --rpc-url $RPC     # +1 day
cast rpc evm_mine --rpc-url $RPC                    # mine block
cast rpc anvil_setStorageAt 0xContract 0xSlot 0xValue --rpc-url $RPC

# Impersonation
cast rpc anvil_impersonateAccount 0xAddress --rpc-url $RPC
cast send --from 0xAddress --unlocked --to 0xContract "fn()" --rpc-url $RPC
cast rpc anvil_stopImpersonatingAccount 0xAddress --rpc-url $RPC

Managing State

# Named snapshots
crucible snapshot create my_state
crucible snapshot restore my_state --chain ethereum

# Three-tier reset (fastest → slowest)
crucible reset --scenario single --mode soft        # <5s  — reload saved state
crucible reset --scenario single --mode medium      # <30s — restart Anvil + restore
crucible reset --scenario single --mode hard        # <5min — re-fork from RPC

Artifacts & Results

# List completed runs
crucible history
crucible history --outcome success                  # Filter by outcome
crucible history --tag nomad --limit 5              # Filter by tag, limit

# View artifacts
cat logs/<experiment>/<run_id>/report.md
cat logs/<experiment>/<run_id>/run_manifest.json | jq .provenance

# Compare two runs (determinism check)
crucible diff DS-2026-00182 DS-2026-00183
# All 4 must be true: storage_equal, events_equal, gas_equal, balances_equal

# Export for publication
crucible export DS-2026-00182

# Verify exported bundle
crucible verify datasets/DS-2026-00182/

Cleaning Up

crucible clean                           # Stop chains, remove meta files
crucible clean --all                     # + remove cache, checkpoints, snapshots
crucible clean --cache                   # Remove fork cache only
crucible clean --logs                    # Remove old log directories
crucible clean --logs-older-than 7       # Remove logs older than 7 days
crucible clean --states                  # Remove non-baseline snapshots
crucible clean --checkpoints             # Remove experiment checkpoints

Common Pitfalls

Symptom Cause Fix
insufficient funds Address not funded anvil_setBalance first
Connection refused No Anvil running, or wrong port Run crucible fork first, check port
Fidelity check fails on bridge experiment --topology single but experiment needs bridge Match topology (see topologies) or add --no-fidelity
assertions failed Attack didn't produce expected state Run with --no-fidelity to isolate
baseline manifest not found First run on this machine Add --no-baseline
Port 8545 already in use Previous process still running crucible clean or pkill -9 -f anvil
Cold fork too slow First time forking this block Use --fork-timeout 600, subsequent runs use cache
No module named 'pydantic' .venv not synced uv sync

Docker

# Build
docker compose build orchestrator

# Fork + run experiment in one container
docker compose run --rm --entrypoint bash orchestrator -c "
  rm -f states/*.meta.json && \
  uv run crucible fork --topology single && \
  uv run crucible experiment run experiments/demo_experiment.yaml --no-baseline
"

# Run tests in container
docker compose run --rm --entrypoint bash orchestrator -c "
  cd /workspace && uv run pytest tests/unit/ -q --tb=line
"

# Launch dashboard
# Launch dashboard (Docker)
docker compose up -d dashboard

# Launch dashboard (local)
crucible dashboard

# Launch Jupyter for artifact analysis
crucible notebook

Topology Profiles Available

Profile File Chains Bridge
single topologies/single.yaml Ethereum None
dual topologies/dual.yaml Ethereum + Polygon None
bridge topologies/bridge.yaml Ethereum + Polygon demo_bridge
single_bsc topologies/single_bsc.yaml BSC None
nomad_bridge topologies/nomad_bridge.yaml Ethereum + Polygon nomad_bridge
wormhole_bridge topologies/wormhole_bridge.yaml Ethereum + Polygon wormhole_bridge
poly_network_bridge topologies/poly_network_bridge.yaml Ethereum + Polygon + BSC poly_network_bridge
harmony_bridge topologies/harmony_bridge.yaml Ethereum + Harmony bridge
poly_network_full topologies/poly_network_full.yaml Ethereum + Polygon + BSC None

Key Files & Directories

Path Purpose
testbed.yaml Main configuration (fork blocks, RPCs, chains)
testbed.local.yaml Per-user overrides (gitignored)
.env RPC API keys (gitignored)
states/ Chain snapshots, meta files, baselines
logs/<experiment>/<run_id>/ Experiment artifacts (JSONL, report, manifest)
.fork_cache/ Anvil RPC response cache (gitignored)
topologies/*.yaml Topology profile definitions
experiments/*.yaml Experiment definitions

Need more detail? See Simple Operations for step-by-step ad-hoc workflows, CLI Reference for all commands and flags, or Troubleshooting for error recovery.