ProofServerClient

Client for Midnight Proof Server API.

Converts unproven transactions into proven transactions by communicating with the Midnight proof server, which computes zero-knowledge proofs and seals binding commitments.

Transaction Evolution:

INPUT:  Transaction<Signature, ProofPreimageMarker, Pedersen>
Tag: midnight:transaction[v6](signature[v1],proof-preimage,pedersen[v1])

OUTPUT: Transaction<Signature, Proof, PureGeneratorPedersen>
Tag: midnight:transaction[v6](signature[v1],proof,pedersen-schnorr[v1])

Proof Server Endpoints:

  • /prove-tx (Legacy): Prove complete transaction (binary POST)

  • /prove: Prove individual preimages (binary POST)

  • /check: Validate proofs without generating (binary POST)

  • /health: Health check (GET)

Protocol:

  • Request: Binary SCALE-encoded unproven transaction

  • Response: Binary SCALE-encoded proven transaction

  • Content-Type: application/octet-stream

  • Timeout: 300 seconds (5 minutes) - proof generation is slow

Error Handling:

  • Client errors (400-499): Don't retry

  • Server errors (502-504): Retry with exponential backoff

  • Timeout: Show clear error to user

See also

for implementation details

Inheritors

Functions

Link copied to clipboard
abstract fun close()

Close the client and release resources.

Link copied to clipboard
abstract suspend fun isHealthy(): Boolean

Check if proof server is healthy and reachable.

Link copied to clipboard
abstract suspend fun proveTransaction(unprovenTxHex: String): String

Prove an unproven transaction.