PROVE
ZK Proof Generation
Halo2 zero-knowledge proofs via native binary. 20x faster than Docker. Results cached 30s.
BALANCE
Dust Sponsorship
Server-managed dust wallets cover all transaction fees. Users never pay gas. UTXOs auto-reclaim after 5 min.
Authentication
All endpoints except /health and /docs require an API key.
X-API-Key: pk_live_xxxAuthorization: Bearer pk_live_xxxOptional: X-Client-ID and X-Client-Name for request tracking.
Contact team@1am.xyz for API key access.
Rate Limiting & Caching
X-RateLimit-LimitMax requests per windowX-RateLimit-RemainingRequests remainingX-RateLimit-ResetUnix timestamp when limit resetsRetry-AfterSeconds until retry (on 429)X-CacheHIT or MISS — proof/verify cached 30sPOST /prove and /verify are cached 30s by body hash.
Integration Flows
Flow 1: Prove + Balance
Send an unproved transaction. Proof Station generates the ZK proof and balances it with dust.
Build unproved TX
Use Midnight SDK to create the transaction from your Compact contract call.
POST /prove-and-balance
Send serialized TX as binary. Proof Station proves and adds dust from sponsorship wallet.
Receive finalized TX
Response includes the proved + balanced TX hex and hash, ready for your client to use.
1const res = await fetch('https://api.1am.xyz/prove-and-balance', {
2 method: 'POST',
3 headers: {
4 'X-API-Key': 'pk_live_xxx',
5 'Content-Type': 'application/octet-stream',
6 },
7 body: serializedUnprovedTx,
8});
9const { tx, txHash } = await res.json();
10// tx is proved and balanced — ready to useFlow 2: Balance Only (Pre-Proven TX)
When you've already generated the proof (e.g. in-browser via 1AM wallet WASM), you only need dust sponsorship.
1const res = await fetch('https://api.1am.xyz/balance-only', {
2 method: 'POST',
3 headers: { 'X-API-Key': 'pk_live_xxx', 'Content-Type': 'application/octet-stream' },
4 body: provedTxBytes,
5});
6const { tx, txHash } = await res.json();
7// tx is balanced with dust — ready to useAPI Reference
HEALTH & DOCS
GET/healthPublicServer health + upstream status
Returns gateway health including proof server and balance service status.
statusstring"healthy" | "unhealthy"versionstringServer version (e.g. "0.2.0")upstreamstring"ok" | "unavailable" — proof serverbalancestring"ok" | "unavailable" | "disabled"1curl https://api.1am.xyz/health
2
3{
4 "status": "healthy",
5 "version": "0.2.0",
6 "upstream": "ok",
7 "balance": "ok"
8}503 returned when upstream proof server is unavailable.
PROOF GENERATION
POST/proveGenerate ZK proof
Submit binary transaction data for Halo2 ZK proof generation. Results cached 30s by body hash.
REQUEST
Content-Type: application/octet-stream — binary serialized transaction data.
RESPONSE 200
application/octet-stream — binary proof data.
400 Invalid input · 401 Unauthorized · 429 Rate limited · 502 Proof server unavailable
POST/verifyVerify ZK proof
Verify a previously generated zero-knowledge proof. Same request format as /prove.
401 Unauthorized · 429 Rate limited · 502 Proof server unavailable
DUST SPONSORSHIP & BALANCE
POST/prove-and-balanceProve + balance an unproved TX
Generates ZK proof and balances with server dust. Returns the finalized transaction.
REQUEST: application/octet-stream — serialized unbalanced transaction
RESPONSE 200
txstringFinalized transaction (hex encoded)txHashstringTransaction hash401 Unauthorized · 404 Balance not enabled · 429 Rate limited · 502 Balance unavailable · 503 Wallet syncing
POST/balance-onlyBalance a pre-proven TX
Adds dust to a transaction that already has a proof (e.g. proved in-browser via WASM). Returns the balanced transaction.
Response: { tx, txHash }
GET/wallet-statusSponsorship wallet dust balance
Returns dust balance and UTXO count of server sponsorship wallets. Accessible without auth from private network (10.0.1.0/24).
1{
2 "wallets": [{
3 "index": 0,
4 "dust": {
5 "balance": "999999000",
6 "utxoCount": 42,
7 "isSynced": true,
8 "address": "0x..."
9 }
10 }]
11}Error Handling
All errors return JSON: { "error": "description" }
Server Environments
https://api.1am.xyzMainnethttps://api-preprod.1am.xyzPre-productionhttps://api-preview.1am.xyzDevelopmenthttp://localhost:8080Local devFull Integration Example
1import { httpClientProofProvider } from '@midnight-ntwrk/midnight-js-fetch-zk-config-provider';
2
3// 1. Connect to 1AM wallet
4const api = await window.midnight['1am'].connect('mainnet');
5const config = await api.getConfiguration();
6// config.proverServerUri === 'https://api.1am.xyz'
7
8// 2. Set up proof provider pointing to Proof Station
9const proofProvider = httpClientProofProvider(config.proverServerUri);
10
11// 3. Build contract transaction
12const tx = await contract.callTx.myMethod(args);
13
14// 4. Prove via Proof Station (automatic through SDK)
15const provedTx = await proofProvider.proveTx(tx);
16
17// 5. Balance via wallet → calls /balance-only internally
18const balanced = await api.balanceUnsealedTransaction(provedTx);
19// balanced.tx is the finalized, dust-sponsored transaction