Liquidity Docs

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

VarPurpose
WALLET_ENVdev / prod
WALLET_HTTP_ADDRListen address (default :8080)
WALLET_API_KEYBearer key gating sensitive routes + the MPC relay (empty disables auth)
WALLET_DB_URLPostgreSQL DSN, e.g. postgres://user:pass@host:5432/wallet_api?sslmode=disable

Chain

VarPurpose
WALLET_CHAIN_RPC_URL / WALLET_CHAIN_WS_URLEVM endpoint (blockchain09)
WALLET_CHAIN_IDe.g. 8675399
WALLET_CONTRACT_USDLDefault USDL address (optional; self-deploys otherwise)

MPC / signing

VarPurpose
MPC_NODE3_URL / MPC_NODE3_JWT_SECRETnode3 relay (device 2-of-3). Unset ⇒ mpc-config and both relay sockets report 501
MPC_NODE3_STATIC_TOKENPre-issued node3 token used instead of minting - a temporary stopgap, see mpc
WALLET_MPC_MODEengine to enable server-side mpcium signing
WALLET_MPC_NATS_URL / WALLET_MPC_INITIATOR_KEYEngine-mode cluster + initiator key
WALLET_HSM_URLHSM keystore base URL
WALLET_HSM_ADMIN_LABEL / _ADDRESSta-admin signer
WALLET_HSM_EXECUTOR_LABEL / _ADDRESSasset-executor signer
WALLET_HSM_GUARDIAN_LABEL / _ADDRESSper-wallet guardian
WALLET_ALLOW_DEV_KEYS1 to permit public Anvil dev keys (throwaway devnet only)

Trading / fees / gas

VarPurpose
WALLET_TRADING_FEE_RECIPIENTCommission recipient when fee_bps > 0 (must be an onboarded USDL holder)
WALLET_TRADING_GAS_MODEfund (user pays) or sponsor (sponsor pays)
WALLET_TRADING_SUBSTRATE_URL / WALLET_TRADING_SPONSOR_SECRETSponsor-mode substrate config

⚠️ Fee recipient must be onboarded. USDL is a compliance-gated ERC-3643 token, so a fee_bps > 0 settlement reverts unless the WALLET_TRADING_FEE_RECIPIENT is 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-api

The 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 --build

The 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_URL host, node3 URL).
  • Secret - WALLET_API_KEY, MPC_NODE3_JWT_SECRET (or MPC_NODE3_STATIC_TOKEN), HSM labels/addresses, DB credentials.
  • Ingress - allow WebSocket upgrades on /wallet/mpc/relay and /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, readiness GET /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.