Deployment & Configuration
How to configure and run wallet-api: the WALLET_* environment variables, Docker, Kubernetes, and the HSM + node3 secrets.
wallet-api is a single static Go binary. It reads all configuration from
WALLET_* environment variables (an optional YAML file may override defaults),
and runs its Postgres migrations at boot.
Configuration (WALLET_* env)
Core
| Var | Purpose |
|---|---|
WALLET_ENV | dev / prod |
WALLET_HTTP_ADDR | Listen address (default :8080) |
WALLET_API_KEY | Bearer key gating sensitive routes + the MPC relay (empty disables auth) |
WALLET_DB_URL | PostgreSQL DSN, e.g. postgres://user:pass@host:5432/wallet_api?sslmode=disable |
Chain
| Var | Purpose |
|---|---|
WALLET_CHAIN_RPC_URL / WALLET_CHAIN_WS_URL | EVM endpoint (blockchain09) |
WALLET_CHAIN_ID | e.g. 8675399 |
WALLET_CONTRACT_USDL | Default USDL address (optional; self-deploys otherwise) |
MPC / signing
| Var | Purpose |
|---|---|
MPC_NODE3_URL / MPC_NODE3_JWT_SECRET | node3 relay (device 2-of-3). Unset ⇒ mpc-config and both relay sockets report 501 |
MPC_NODE3_STATIC_TOKEN | Pre-issued node3 token used instead of minting - a temporary stopgap, see mpc |
WALLET_MPC_MODE | engine to enable server-side mpcium signing |
WALLET_MPC_NATS_URL / WALLET_MPC_INITIATOR_KEY | Engine-mode cluster + initiator key |
WALLET_HSM_URL | HSM keystore base URL |
WALLET_HSM_ADMIN_LABEL / _ADDRESS | ta-admin signer |
WALLET_HSM_EXECUTOR_LABEL / _ADDRESS | asset-executor signer |
WALLET_HSM_GUARDIAN_LABEL / _ADDRESS | per-wallet guardian |
WALLET_ALLOW_DEV_KEYS | 1 to permit public Anvil dev keys (throwaway devnet only) |
Trading / fees / gas
| Var | Purpose |
|---|---|
WALLET_TRADING_FEE_RECIPIENT | Commission recipient when fee_bps > 0 (must be an onboarded USDL holder) |
WALLET_TRADING_GAS_MODE | fund (user pays) or sponsor (sponsor pays) |
WALLET_TRADING_SUBSTRATE_URL / WALLET_TRADING_SPONSOR_SECRET | Sponsor-mode substrate config |
⚠️ Fee recipient must be onboarded. USDL is a compliance-gated ERC-3643 token, so a
fee_bps > 0settlement reverts unless theWALLET_TRADING_FEE_RECIPIENTis a KYC-verified holder on the USDL registry.
Run (local)
cp .env.example .env # fill HSM labels + node3 secret + API key + WALLET_DB_URL
set -a; . ./.env; set +a
createdb wallet_api # or rely on docker compose
go run ./cmd/wallet-apiThe first POST /wallet deploys the one-time ERC-3643 backbone + V42 factory
(a few minutes on a live chain); everything after reuses it via onchain_kv.
Docker
docker build -t wallet-api .
docker run --rm -p 8080:8080 --env-file .env wallet-api
# Or bring up API + Postgres together (WALLET_DB_URL wired automatically):
docker compose up --buildThe image runs as a non-root user on :8080 and carries the contracts/3643
artifacts. Secrets are never baked in (.env is in .dockerignore) - inject via
env, --env-file, or a Kubernetes Secret.
Kubernetes
The image has ENTRYPOINT ["/app/wallet-api"], so no start command is needed -
the pod runs the service automatically. Wire:
- ConfigMap - non-secret
WALLET_*(chain URL/id,WALLET_DB_URLhost, node3 URL). - Secret -
WALLET_API_KEY,MPC_NODE3_JWT_SECRET(orMPC_NODE3_STATIC_TOKEN), HSM labels/addresses, DB credentials. - Ingress - allow WebSocket upgrades on
/wallet/mpc/relayand/wallet/mpc/sign, and do not impose a short proxy read timeout on them: a ceremony is a long-lived socket, not a request. - Probes - liveness
GET /healthz, readinessGET /readyz(gates traffic until Postgres is reachable). - Port - container
8080.
Deploy gate
make ci runs vet + unit tests + the full anvil end-to-end suite (against a
throwaway Postgres), then validates the image builds. The e2e exercises the whole
lifecycle - create wallet, asset create/mint/burn, deposit, propose/settle
(full / partial / non-crossing / over-fill), and the GET reads.
Third-Party Services & Libraries
Every external service and library wallet-api touches: the EVM chain, node3/mpcium, the HSM keystore, PostgreSQL, and key Go libraries.
API: `wallet-api`
All wallet-api HTTP endpoints: wallet provisioning + MPC relay, identity, asset lifecycle, chain reads, trade and settlement, and jobs.