Skip to content

Transaction infrastructure

ProofStation API.

ZK proof generation and dust sponsorship for the Midnight network. One API to prove and balance transactions — zero gas costs for your users.

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.

HeaderX-API-Key: pk_live_xxx
BearerAuthorization: Bearer pk_live_xxx

Optional: 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 window
X-RateLimit-RemainingRequests remaining
X-RateLimit-ResetUnix timestamp when limit resets
Retry-AfterSeconds until retry (on 429)
X-CacheHIT or MISS — proof/verify cached 30s

POST /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.

1

Build unproved TX

Use Midnight SDK to create the transaction from your Compact contract call.

2

POST /prove-and-balance

Send serialized TX as binary. Proof Station proves and adds dust from sponsorship wallet.

3

Receive finalized TX

Response includes the proved + balanced TX hex and hash, ready for your client to use.

Reference
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 use

Flow 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.

Reference
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 use

API 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 server
balancestring"ok" | "unavailable" | "disabled"
Reference
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 hash

401 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).

Reference
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

400Bad RequestCheck serialized TX data is valid binary
401UnauthorizedInclude X-API-Key or Authorization: Bearer header
404Not FoundBalance service not enabled on this server
429Rate LimitedWait Retry-After seconds, then retry
502Bad GatewayUpstream proof server is down
503Service UnavailableWallet still syncing — retry in 30s

All errors return JSON: { "error": "description" }

Server Environments

Productionhttps://api.1am.xyzMainnet
Preprodhttps://api-preprod.1am.xyzPre-production
Previewhttps://api-preview.1am.xyzDevelopment
Localhttp://localhost:8080Local dev

Full Integration Example

Reference
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