Skip to main content

Module builder

Module builder 

Source
Expand description

Convenience builders for constructing shielded state transitions.

These functions encapsulate the full Orchard bundle construction pipeline: builder configuration, proof generation, signature application, and serialization into platform state transitions.

Requires the shielded-client feature, which pulls in grovedb-commitment-tree (and transitively the orchard crate).

§Example

use dpp::shielded::builder::*;
use grovedb_commitment_tree::{SpendingKey, FullViewingKey, Scope, ProvingKey};

// Derive recipient address
let sk = SpendingKey::from_bytes(seed)?;
let fvk = FullViewingKey::from(&sk);
let recipient = OrchardAddress::from_raw_bytes(
    &fvk.address_at(0, Scope::External).to_raw_address_bytes(),
);

// Build a shield transition; pass the sender's OVK so the wallet can
// later recover its own send from chain data (None = unrecoverable)
let pk = ProvingKey::build();
let st = build_shield_transition(
    &recipient, shield_amount, inputs, fee_strategy,
    &signer, 0, &pk, [0u8; 36], Some(fvk.to_ovk(Scope::External)), platform_version,
)?;

Structs§

IdentityCreateFromShieldedPoolBuildResult
Output of build_identity_create_from_shielded_pool_transition: everything the SDK’s IdentityCreateFromShieldedPool::identity_create_from_shielded_pool broadcast helper needs.
SerializedBundle
The serialized fields extracted from an authorized Orchard bundle, ready for use by state transition constructors.
SpendableNote
A note that can be spent in a shielded transaction, paired with its Merkle inclusion path in the commitment tree.

Traits§

OrchardProver
Trait abstracting over Orchard proof generation.

Functions§

build_identity_create_from_shielded_pool_transition
Builds an IdentityCreateFromShieldedPool (Type 20) state transition: spend shielded-pool notes to fund a brand-new Platform identity.
build_shield_from_asset_lock_transition
Builds a ShieldFromAssetLock state transition (core asset lock -> shielded pool).
build_shield_from_asset_lock_transition_with_signer
Builds a ShieldFromAssetLock state transition where the asset-lock-proof signature is produced by an external [key_wallet::signer::Signer] (Swift / hardware-wallet / HSM flow). The raw private key never crosses the FFI boundary; derive + sign + zeroise happen inside the signer.
build_shield_transition
Builds a Shield state transition (transparent platform addresses -> shielded pool).
build_shielded_transfer_transition
Builds a ShieldedTransfer state transition (shielded pool -> shielded pool).
build_shielded_withdrawal_transition
Builds a ShieldedWithdrawal state transition (shielded pool -> core L1 address).
build_unshield_transition
Builds an Unshield state transition (shielded pool -> platform address).
serialize_authorized_bundle
Serializes an authorized Orchard bundle into the raw fields used by state transition constructors.