Expand description
DarkPool client SDK: identity, key management, note operations, proof generation,
fee calculation, transaction building, and unified privacy client.
Re-exports§
pub use identity::BjjKeypair;pub use identity::ClientIdentity;pub use identity::DarkAccount;pub use identity::X25519Keypair;pub use key_repository::KeyRepository;pub use key_repository::DEFAULT_LOOKAHEAD;pub use note_factory::ChangeNoteResult;pub use note_factory::DepositNoteResult;pub use note_factory::NoteFactory;pub use note_factory::NoteFactoryError;pub use note_factory::SpendingInputs;pub use note_factory::TransferNoteResult;pub use note_processor::EventType;pub use note_processor::NoteProcessor;pub use note_processor::UnprocessedEvent;pub use note_processor::WalletNote;pub use merkle_tree::LocalMerkleTree;pub use merkle_tree::MerklePath;pub use merkle_tree::TREE_DEPTH;pub use persistence::load_wallet_state;pub use persistence::save_wallet_state;pub use persistence::PersistenceError;pub use persistence::WalletState;pub use scan_engine::DarkPoolEvent;pub use scan_engine::PublicMemoInfo;pub use scan_engine::ScanEngine;pub use scan_engine::ScanError;pub use scan_engine::ScanResult;pub use utxo_store::IUtxoRepository;pub use utxo_store::OwnedNote;pub use utxo_store::UtxoStore;pub use crypto_helpers::calculate_public_memo_id;pub use crypto_helpers::decrypt_note_from_fields;pub use crypto_helpers::derive_nullifier_path_a;pub use crypto_helpers::derive_nullifier_path_b;pub use crypto_helpers::encrypt_note_for_deposit_aes;pub use crypto_helpers::generate_dleq_proof;pub use crypto_helpers::pack_ciphertext_to_fields;pub use crypto_helpers::pack_note_plaintext;pub use crypto_helpers::recipient_decrypt_3party;pub use crypto_helpers::unpack_ciphertext_from_fields;pub use crypto_helpers::unpack_note_plaintext;pub use crypto_helpers::DleqResult;pub use proof_inputs::DLEQProof;pub use proof_inputs::DepositInputs;pub use proof_inputs::GasPaymentInputs;pub use proof_inputs::JoinInputs;pub use proof_inputs::NotePlaintext;pub use proof_inputs::ProverInput;pub use proof_inputs::PublicClaimInputs;pub use proof_inputs::SplitInputs;pub use proof_inputs::TransferInputs;pub use proof_inputs::WithdrawInputs;pub use economics::FeeConfig;pub use economics::FeeEstimate;pub use economics::FeeManager;pub use economics::PriceData;pub use prover::circuits;pub use prover::ClientProver;pub use builder::compute_execution_hash;pub use builder::convert_public_inputs_to_bytes32;pub use builder::encode_multicall;pub use builder::format_proof_for_solidity;pub use builder::format_public_inputs_for_solidity;pub use builder::BuilderConfig;pub use builder::BuilderError;pub use builder::DepositProofBundle;pub use builder::GasPaymentBundle;pub use builder::JoinProofBundle;pub use builder::MulticallBundle;pub use builder::PublicClaimProofBundle;pub use builder::SplitProofBundle;pub use builder::TransactionBuilder;pub use builder::TransferProofBundle;pub use builder::WithdrawProofBundle;pub use config::DarkPoolConfig;pub use config::GasLimits;pub use config::PrivacyTxResult;pub use privacy_client::PrivacyClient;pub use privacy_client::PrivacyClientError;pub use privacy_client::Transport;
Modules§
- builder
- ZK proof generation and transaction encoding for
DarkPooloperations. - config
- Configuration types for
DarkPoolclient operations. - crypto_
helpers - Note-specific crypto: packing, encryption, nullifier derivation.
Re-exports pure primitives from
darkpool_crypto. - economics
- Fee calculation: gas costs to payment-asset fees with configurable premium.
- identity
- Cryptographic identity management: BJJ keypairs (note ownership), X25519 keypairs
(mixnet routing), and hierarchical
DarkAccountkey derivation. - key_
repository - Ephemeral and incoming key management for blockchain event scanning. Registers lookahead keys to detect deposits (ephemeral PK match) and transfers (tag match) belonging to this wallet.
- merkle_
tree - 32-level Lean IMT with Poseidon2 hashing, mirroring the on-chain
DarkPoolcommitment tree. Lean IMT: sibling=0 means “empty” and propagates without hashing (matches Noir circuit). - note_
factory - Note creation with encryption, commitment computation, and nullifier derivation.
- note_
processor - Processes blockchain events to recover notes belonging to this wallet.
Path A (
NewNote): deposits/change via ephemeral PK match. Path B (NewMemo): transfers via tag match + 3-party ECDH. - persistence
- Save/load wallet state (UTXOs, Merkle leaves, sync checkpoint) to JSON.
- privacy_
client - Unified client interface for the
DarkPoolprotocol. Combines key management, UTXO tracking, proof generation, and transport into a single API. - proof_
inputs - Typed structs for ZK proof generation, formatted for
NoirProver. - prover
- Typed proof generation methods for all
DarkPoolcircuits, wrapping anIProverServicebackend. - scan_
engine - Watches
DarkPoolevents (NewNote,NewPrivateMemo,NewPublicMemo,NullifierSpent) and syncs local note state via decryption and Merkle tree updates. - utxo_
store - In-memory UTXO management with nullifier tracking and note selection.
Enums§
Functions§
- address_
to_ field - Convert an Ethereum address to a field element.
- aes128_
decrypt - Decrypt 208-byte AES-128-CBC ciphertext, returning 192 bytes on success.
- aes128_
encrypt - Encrypt 192-byte plaintext using AES-128-CBC with PKCS#7 padding. Returns 208 bytes.
- bjj_
scalar_ mul scalar * pointwith full validation (on-curve + subgroup check).- derive_
shared_ secret_ bjj - ECDH shared secret derivation. Returns X coordinate of
sk * pk. - field_
to_ address - Convert a field element back to an Ethereum address (last 20 bytes).
- fr_
to_ u256 - Convert
ark_bn254::Frto ethers U256. - from_
noir_ hex - Parse a Noir hex string (0x-prefixed or raw) back to U256.
- kdf_
to_ aes_ key_ iv - Derive AES key (last 16 bytes of Poseidon) and IV from shared secret.
- poseidon_
hash - Poseidon2 hash over U256 values. Output matches
std::hash::poseidon2in Noir. - random_
field - Generate a random BN254 scalar field element.
- to_
noir_ decimal - Convert U256 to Noir decimal string.
- to_
noir_ hex - Convert U256 to Noir-compatible hex string (0x-prefixed, 64 chars, lowercase).
- u256_
to_ fr - Convert ethers U256 to
ark_bn254::Fr. Values >= modulus are silently reduced.