cURL
Methods
Getvalidityproof
Retrieve a single ZK Proof used by the compression program to verify that the given accounts are valid and the new addresses can be created. RPC method guide with use cases, tips and examples.
POST
cURL
TheDocumentation Index
Fetch the complete documentation index at: https://luminouslabs-cc5545c6-feat-add-zk.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
getValidityProof RPC method generates zero-knowledge proofs to verify that the given accounts are valid or the new addresses can be created. This proof is required for any operation on compressed accounts (transfer, approve, decompress, etc.) for on-chain verification of compressed state.
You can test this method via the OpenAPI example or custom examples below.
- Proof limits per request are:
hashes: 1, 2, 3, 4, or 8newAddressesWithTrees: 1, 2
- The
newAddressesparam field is supported but deprecated. Please usenewAddressesWithTreesinstead.
- Token Transfers: Generate proofs required for transferring compressed tokens.
- Account Operations: Create proofs needed for any compressed account modification.
- Batch Processing: Generate proofs for multiple accounts in a single call.
- State Tree Verification: Prove account inclusion in the current state tree.
- Transaction Building: Obtain proof data needed for compressed transaction instructions.
- Program Integration: Get validity proofs for custom program operations on compressed accounts.
hashes(BN254[], required): Array of BN254 objects representing compressed account hashes to generate proofs for.newAddresses(BN254[], optional): Array of BN254 objects representing new addresses to include in the proof for address tree verification.
compressedProof(ValidityProof | null): The compressed validity proof object for zero-knowledge verificationroots(BN[]): Array of merkle tree roots used in proof generationrootIndices(number[]): Array of indices of the roots in the state treeleafIndices(number[]): Array of indices of the leaves being provenleaves(BN[]): Array of leaf values in the merkle treetreeInfos(TreeInfo[]): Array of information about the state trees usedproveByIndices(boolean[]): Array indicating whether to prove by indices for each element
- Fetch Accounts First: Always get compressed accounts before generating proofs - you need existing account hashes
- Batch Processing: You can generate proofs for multiple accounts in a single call. Allowed counts: 1, 2, 3, 4, or 8 accounts
- Proof Usage: The proof is required for any operation that modifies compressed accounts (transfers, burns, etc.)
- Caching: Validity proofs are only valid for the current state - don’t cache them for long periods
- Error Handling: If accounts don’t exist or have been modified, proof generation will fail
- Integration: Use
proof.compressedProofandproof.rootIndiceswhen building transactions - State Changes: After any transaction, previously generated proofs become invalid for those accounts
Dependencies & Setup
Dependencies & Setup
- TypeScript
- cURL
- Rust
JavaScript
Body
application/json
An ID to identify the request.
Available options:
test-account The version of the JSON-RPC protocol.
Available options:
2.0 The name of the method to invoke.
Available options:
getCompressedAccountBalance Request for compressed account data
Example:
{
"address": null,
"hash": "11111111111111111111111111111111"
}