Skip to main content

Module wormhole_lib

Module wormhole_lib 

Source
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§

ProofGenerationInput
Input data for generating a wormhole proof. All fields are raw bytes - no chain client required.
ProofGenerationOutput
Output from proof generation
WormholeLibError
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
TransferProofData
Full transfer data type - used to compute the leaf_inputs_hash via Poseidon2. Order: (asset_id, transfer_count, from, to, amount)
TransferProofKey
Storage key type - (wormhole_address, transfer_count) This is hashed with Blake2_256 to form the storage key suffix.