Expand description
Wormhole Library Functions
This module provides library-friendly functions for wormhole proof generation that can be used by external crates (like quantus-sdk) without requiring a chain client connection.
These functions handle the core cryptographic operations:
- Computing leaf hashes for storage proof verification
- Computing storage keys
- Generating ZK proofs from raw inputs
Structs§
- Proof
Generation Input - Input data for generating a wormhole proof. All fields are raw bytes - no chain client required.
- Proof
Generation Output - Output from proof generation
- Wormhole
LibError - Error type for wormhole library operations
Constants§
- NATIVE_
ASSET_ ID - Native asset id for QTU token
- SCALE_
DOWN_ FACTOR - Scale down factor for quantizing amounts (10^10 to go from 12 to 2 decimal places)
- VOLUME_
FEE_ BPS - Volume fee rate in basis points (10 bps = 0.1%)
Functions§
- compute_
leaf_ hash - Compute the leaf hash (leaf_inputs_hash) for storage proof verification.
- compute_
nullifier - Compute the nullifier from secret and transfer count.
- compute_
output_ amount - Compute output amount after fee deduction.
- compute_
storage_ key - Compute the storage key for a transfer proof.
- compute_
wormhole_ address - Compute the unspendable wormhole account from a secret.
- generate_
proof - Generate a wormhole proof from raw inputs.
- quantize_
amount - Quantize a funding amount from 12 decimal places to 2 decimal places.
Type Aliases§
- Result
- Result type for wormhole library operations
- Transfer
Proof Data - Full transfer data type - used to compute the leaf_inputs_hash via Poseidon2. Order: (asset_id, transfer_count, from, to, amount)
- Transfer
Proof Key - Storage key type - (wormhole_address, transfer_count) This is hashed with Blake2_256 to form the storage key suffix.