Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Quickstart

This runs the full stack locally: Postgres, Redis, the API server, and the payment monitor.

Prerequisites

  • Rust (version pinned via rust-toolchain.toml in the repo)
  • PostgreSQL 14+
  • Redis 7+
  • An RPC endpoint for at least one chain (a free tier from any provider works for testnets)

1. Clone and start services

git clone https://github.com/agent8-cash/ethpayserver.git
cd ethpayserver

cp docker/.env.example docker/.env
docker compose -f docker/docker-compose.local.yml up -d

2. Run migrations

cargo install sqlx-cli --no-default-features --features postgres

DATABASE_URL="postgres://postgres:postgres@localhost/ethpayserver" \
sqlx migrate run --source data-service/migrations/postgres

3. Run the API server

export DATABASE_URL="postgres://postgres:postgres@localhost/ethpayserver"
export HOST="127.0.0.1"
export PORT="3000"
export ENABLE_SWAGGER="true"

cargo run --release --bin ethpayserver

The server is now at http://localhost:3000, with interactive Swagger UI at /swagger-ui.

4. Run the payment monitor

The monitor is a separate binary — it watches chain activity and publishes events to Redis for the API server to pick up. It can run as one process per chain, or watch several at once.

cargo build --release --bin evmmonitor --features monitor-bin

EVMMONITOR_REDIS_URL=redis://localhost:6379 \
EVMMONITOR_CHAINS=11155111 \
EVMMONITOR_CHAIN_11155111_RPC_HTTP=https://your-sepolia-rpc-url \
EVMMONITOR_CHAIN_11155111_RPC_WS=wss://your-sepolia-ws-url \
RUST_LOG=info \
./target/release/evmmonitor

11155111 is Sepolia’s chain ID. See Supported Networks for the full list.

5. Create your first invoice

With both processes running, create a store, configure a wallet with your xpub, and create an invoice — see Creating an Invoice for the exact request shapes.

Multiple chains at once

A single evmmonitor process can watch several chains — each gets its own RPC configuration:

EVMMONITOR_CHAINS=11155111,80002,421614
EVMMONITOR_CHAIN_11155111_RPC_HTTP=...
EVMMONITOR_CHAIN_80002_RPC_HTTP=...
EVMMONITOR_CHAIN_421614_RPC_HTTP=...

Each chain can also be given an ordered list of fallback HTTP providers, tried in order if the primary one is rate-limited or down:

EVMMONITOR_CHAIN_11155111_RPC_HTTP_FALLBACKS=https://backup-provider-1,https://backup-provider-2