Documentation Index
Fetch the complete documentation index at: https://docs.x0protocol.dev/llms.txt
Use this file to discover all available pages before exploring further.
ZkVerifierClient
TheZkVerifierClient builds verification instructions for zero-knowledge proofs and queries on-chain proof contexts.
Proof Types
| Value | Name | Description | Proof Size |
|---|---|---|---|
0 | PubkeyValidity | Proves an ElGamal public key is well-formed | 64 bytes |
1 | Withdraw | Proves withdrawal amount is valid and balance remains non-negative | 160 bytes |
2 | ZeroBalance | Proves a ciphertext encrypts zero | 96 bytes |
3 | Transfer | Proves transfer amount is valid with range proof | 288 bytes |
Verification Instructions
buildVerifyPubkeyValidityInstruction
buildVerifyWithdrawInstruction
buildVerifyZeroBalanceInstruction
buildVerifyTransferInstruction
Querying Proof Contexts
fetchProofContext(proofContextAddress)
ProofContext | null
| Field | Type | Description |
|---|---|---|
version | number | Context version |
proofType | ProofType | Type of proof verified |
verified | boolean | Whether the proof passed |
owner | PublicKey | Account owner |
verifiedAt | number | Verification timestamp |
amount | BN | null | Amount (for withdraw/transfer proofs) |
recipient | PublicKey | null | Recipient (for transfer proofs) |
elgamalPubkey | Uint8Array | null | Public key (for pubkey validity proofs) |
mint | PublicKey | Token mint |
tokenAccount | PublicKey | Token account |
bump | number | PDA bump |
isProofFresh(proofContext)
Check if a proof context is still within the 5-minute freshness window:
PDA Derivation
deriveProofContextPda(owner, tokenAccount, timestamp)
Usage with ConfidentialClient
In typical usage, theConfidentialClient handles proof generation and verification internally. Use ZkVerifierClient directly when you need:
- Custom proof verification logic
- Batch proof verification
- Proof context inspection
- Integration with other on-chain programs