Architecture & Topology
How wallet-api fits together, the Device -> liq-ats -> ta-api -> wallet-api -> node3 path, its MPC modes, ports, and data flow.
How wallet-api fits together, how the MPC ceremonies flow through it, and the modes it runs in. The cryptography itself is covered in mpc.
1. Service
| Service | Language | Role |
|---|---|---|
wallet-api | Go | Standalone chain-execution + key-custody engine (a single binary) |
Supporting infrastructure: PostgreSQL (get-or-deploy state, one-wallet-per-user, durable job queue), an EVM chain (blockchain09, the ERC-3643 suite), node3 / mpcium (the MPC signing network), and an HSM keystore (platform admin / executor / guardian keys).
2. Topology
Device (browser/mobile: MPC share1 + share2)
| WSS /v1/ta/mpc/{config,relay,sign}
v
liq-ats (browser edge: the only origin the device may reach)
| HTTP/WS, Bearer TA_API_KEY
v
ta-api (Transfer Agent: transparent MPC hop + wallet/trade caller)
| HTTP/WS, Bearer WALLET_API_KEY
v
wallet-api (:8080)
| | | \
| | | \-- HSM keystore (ta-admin / executor / guardian signers)
| | |
| | \-- node3 / mpcium (MPC share3 + engine-mode signing)
| |
| \-- PostgreSQL (state + job queue)
|
\-- blockchain09 EVM (ERC-3643 backbone, V42 factory, TokenSettlement)The device talks only to liq-ats, which proxies the ceremony to ta-api, which
forwards it to wallet-api's /wallet/mpc/relay (keygen) and /wallet/mpc/sign
(signing); wallet-api mints the node3 token and pipes frames onward. Neither
liq-ats nor ta-api holds the node3 secret or ever sees a share. Every on-chain
read/write the platform performs is an HTTP call into wallet-api.
3. MPC modes
wallet-api supports three signing models, selected by config:
| Mode | Who signs user keys | Used for |
|---|---|---|
| dev | Deterministic in-process dev keys | Local testing against Anvil |
| node3 (device) | The user's device (share1+share2) + node3 (share3), 2-of-3 | The real user-facing flow: browser/app runs keygen + sign |
| engine | wallet-api co-signs server-side via an mpcium cluster | Server-to-server automation (no device) |
- node3 mode (
WALLET_MPC_MODEunset,MPC_NODE3_URLset): the device generates the key and passes the resulting user_address toPOST /wallet; wallet-api wraps a V42 around it. Signing (vouches) happens on the device via the relay. The live engine is Doerner, which needs no pre-computation - the old CMP pre-params endpoint is gone. - engine mode (
WALLET_MPC_MODE=engine,WALLET_MPC_NATS_URL+WALLET_MPC_INITIATOR_KEY): wallet-api holds an mpcium hub that performs DKG and server-side vouching.
Full detail - ceremony round flow, credentials, trust boundaries, libraries and pins - is in mpc.
4. Key custody
- User keys are MPC-split (2-of-3); a full private key never exists in one place.
- Platform keys (ta-admin, asset-executor, guardian) are backed by an HSM
in production, or local dev keys otherwise. wallet-api refuses to boot with
public Anvil/Hardhat dev keys on a real chain unless explicitly overridden
(
WALLET_ALLOW_DEV_KEYS=1).
5. Async model
Write operations return 202 { job_id }; callers poll GET /jobs/{id}
until a terminal succeeded / dead state. A durable Postgres-backed job queue
(two lanes: admin serialized on the ta-admin nonce, user parallel across
wallets) executes them, with retry-with-backoff, dead-lettering, crash reaping
(SELECT ... FOR UPDATE SKIP LOCKED), and an optional callback POST.
6. State of truth
The blockchain is the source of truth. Postgres is a cache / index /
projection of on-chain state plus job bookkeeping - balances are re-read from
chain on settlement, and the ERC-3643 backbone / factory / settlement addresses
are get-or-deploy state stored in onchain_kv.
7. Ports & endpoints
| Port | Purpose |
|---|---|
:8080 (default, WALLET_HTTP_ADDR) | HTTP API + the two MPC WebSockets (/wallet/mpc/relay, /wallet/mpc/sign) |
GET /healthz | Liveness |
GET /readyz | Readiness (Postgres ping) |
GET /metrics | Prometheus |
Wallet API - Documentation
Complete documentation for the Liquid wallet-api: the chain-execution and key-custody engine for MPC wallets, ERC-3643 assets, and dual-intent settlement.
Components
Every internal package of wallet-api in detail: onchain, multisig, trading, walletapi, the HTTP APIs, the durable job queue, and the MPC layer.