Running a Verifier

Running a Verifier

While AMP starts as a managed network, the protocol is designed for decentralization. Studios or third-party infrastructure providers can run their own AMP Verifiers to earn fees and support the network.

Warning: Running a verifier is currently in Alpha. The instructions below are for advanced users and developers looking to test the infra locally or on Fuji.

Hardware Requirements

  • CPU: 4+ Cores (High clock speed preferred for ASYNC_VERIFIER replays).
  • RAM: 8GB minimum.
  • Disk: NVMe SSD (for sled-backed settlement queue and transcript logging).
  • Network: Low latency, stable IP.

Configuration

The Verifier (amp-server) is configured via environment variables:

VariableDescriptionDefault
AMP_LISTEN_ADDRTCP listen address for Cap'n Proto RPC0.0.0.0:5555
AMP_AVAX_RPCAvalanche RPC endpointhttps://api.avax-test.network/ext/bc/C/rpc
AMP_REGISTRY_ADDRAMPRegistry contract address(required)
AMP_VERIFIER_KEYPrivate key for signing attestations (hex)(required)
AMP_MATCH_TICK_MSMatchmaker tick interval in ms50
AMP_MATCH_TTL_MSMatch time-to-live in ms3600000 (1h)
AMP_MAX_ACTIVE_MATCHESMaximum concurrent matches10000
AMP_LOG_LEVELLog level (trace/debug/info/warn/error)info
RUST_LOGStandard Rust log filteramp_server=info

Build & Run

From Source

# Build
cargo build --release --bin amp-server

# Run
AMP_LISTEN_ADDR=0.0.0.0:5555 \
AMP_AVAX_RPC=https://api.avax-test.network/ext/bc/C/rpc \
AMP_REGISTRY_ADDR=0x27E02ebA98D2A50Cd1079b0a611320b05A278005 \
AMP_VERIFIER_KEY=0x... \
./target/release/amp-server

With Docker

docker build -t amp-server -f amp-server/Dockerfile .
docker run -d \
  -e AMP_LISTEN_ADDR=0.0.0.0:5555 \
  -e AMP_AVAX_RPC=https://api.avax-test.network/ext/bc/C/rpc \
  -e AMP_REGISTRY_ADDR=0x27E02ebA98D2A50Cd1079b0a611320b05A278005 \
  -e AMP_VERIFIER_KEY=0x... \
  -p 5555:5555 \
  amp-server

Local Development (Anvil)

For local testing, use the provided script to spin up a local Avalanche fork:

./scripts/start-localnet.sh

This starts Anvil with the AMP contracts deployed and configures default verifier keys.

Settlement Relayer

The amp-relayer runs alongside the verifier to submit settled outcomes on-chain. It features:

  • Sled-backed queue: Persistent settlement queue survives restarts.
  • EIP-1559 gas: Dynamic gas pricing with automatic fee bumping.
  • Nonce tracking: Per-account nonce management for concurrent transactions.
  • Retry with backoff: Failed transactions are retried up to 5 times with exponential backoff (500ms -- 4s).
  • Dead-letter queue: Permanently failed settlements are logged for manual intervention.
  • Graceful shutdown: In-flight transactions complete before the process exits.
cargo build --release --bin amp-relayer

AMP_RELAYER_RPC=https://api.avax-test.network/ext/bc/C/rpc \
AMP_RELAYER_REGISTRY=0x27E02ebA98D2A50Cd1079b0a611320b05A278005 \
AMP_RELAYER_KEY=0x... \
./target/release/amp-relayer

Registration

To be recognized by the AMPSettlement contract, your Verifier's public key must be whitelisted in the AMPRegistry. For the Beta/Fuji phase, contact the AMP team to have your address added to the allowed verifier set.