Skip to main content

Proof Relayer

Generates Groth16 ZK proofs server-side. CPU-intensive — limited to 2 concurrent proof generations.

Endpoint

POST /api/proof/generate

Port: 3003
Public URL: https://relayer.specterchain.com/api/proof/generate

Request

{
"secret": "123456789",
"nullifierSecret": "987654321",
"amount": "1000000000000000000",
"blinding": "111222333",
"tokenIdHash": "0",
"recipient": "0xRecipientAddress",
"withdrawAmount": "1000000000000000000",
"newBlinding": "0"
}
FieldTypeRequiredDescription
secretstringYesCommitment secret
nullifierSecretstringYesNullifier secret
amountstringYesFull committed amount
blindingstringYesCommitment blinding factor
tokenIdHashstringYesToken ID hash
recipientstringYesRecipient Ethereum address
withdrawAmountstringYesAmount to withdraw
newBlindingstringYesBlinding for change commitment ("0" for full reveal)

Response

{
"proof": [
"0x...", "0x...", "0x...", "0x...",
"0x...", "0x...", "0x...", "0x..."
],
"publicInputs": [
"0x...", "0x...", "0x...", "0x...",
"0x...", "0x...", "0x...", "0x..."
]
}

The proof array contains 8 uint256 values (3 EC points) ready for the reveal() function.

Limits

ParameterValue
Rate limit5 requests/minute/IP
Max concurrent proofs2
Commitment cache TTL5 minutes

Authentication

Requires HMAC signature:

X-HMAC-Signature: <computed-hmac>

Status endpoint

GET /status

Returns service status including current load and queue depth.

Security note

warning

Like the commitment relayer, this service receives your secret values in plaintext. For maximum privacy, generate proofs client-side using snarkjs. See Generating Proofs.

Internal architecture

The proof relayer:

  1. Maintains an in-memory copy of the Merkle tree (rebuilt from CommitmentAdded events)
  2. Computes the Merkle proof path for the requested commitment
  3. Generates the Groth16 proof using snarkjs with the circuit WASM and proving key
  4. Returns the formatted proof and public inputs