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§
- Identity
Create From Shielded Pool Build Result - Output of
build_identity_create_from_shielded_pool_transition: everything the SDK’sIdentityCreateFromShieldedPool::identity_create_from_shielded_poolbroadcast helper needs. - Serialized
Bundle - The serialized fields extracted from an authorized Orchard bundle, ready for use by state transition constructors.
- Shielded
FeePayer - The credit pool side of an identity-less token pool transition: the wallet’s credit pool notes to spend, where the change goes, and the keys that authorize the spend.
- Spendable
Note - A note that can be spent in a shielded transaction, paired with its Merkle inclusion path in the commitment tree.
- Token
Pool Spender - The wallet’s notes in a token’s shielded pool and the keys that spend them.
Traits§
- Orchard
Prover - Trait abstracting over Orchard proof generation.
Functions§
- build_
document_ shielded_ token_ payment - Builds the shielded payment of a document action whose token cost is
amount: spendsspendsfrom the token’s shielded pool, returns the remainder tochange_addressas a new note and binds the token id, the batch owner, the document’s contract and id and the amount into the Orchard sighash. Put the result into aTokenPaymentInfo::V1on the document transition’s base; the identity signing the batch still pays the credit fee. - 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_
identity_ top_ up_ from_ shielded_ pool_ transition - Build an
IdentityTopUpFromShieldedPooltransition: spendspendsso that exactlytop_up_amount + feeleaves the pool, sending change back tochange_address. The identity receivestop_up_amount; the flat fee is carved from the value balance exactly asUnshielddoes. Returns the transition and the fee used. - 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_ from_ identity_ transition - Build a
ShieldFromIdentitytransition: prove an outputs-only Orchard bundle payingshield_amounttorecipient, then identity-sign it with a TRANSFER key. - 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_
token_ burn_ from_ pool_ transition - Builds a
TokenBurnFromPoolbatch transition: spendsspendsinside the token’s shielded pool, destroysamountand returns the remainder tochange_address, then wraps the bundle in a batch transition signed byowner_id, who must be authorized to burn and pays the fee in credits. The token id, owner id and amount are bound into the Orchard sighash. - build_
token_ claim_ to_ pool_ transition - Builds a
TokenClaimToPoolbatch transition: proves an outputs-only Orchard bundle creatingamountof the token as a note forrecipientinside the token’s shielded pool, then wraps it in a batch transition signed byowner_id, the claimant, who pays the fee in credits. - build_
token_ direct_ purchase_ to_ pool_ transition - Builds a
TokenDirectPurchaseToPoolbatch transition: proves an outputs-only Orchard bundle creatingtoken_countof the token as a note forrecipientinside the token’s shielded pool, then wraps it in a batch transition signed byowner_id, the buyer, who pays at mosttotal_agreed_pricecredits to the contract owner plus the fee. - build_
token_ mint_ to_ pool_ transition - Builds a
TokenMintToPoolbatch transition: proves an outputs-only Orchard bundle creatingamountof the token as a note forrecipientinside the token’s shielded pool, then wraps it in a batch transition signed byowner_id, who must be authorized to mint and pays the fee in credits.using_group_infosets up a group action exactly like a transparent mint. - build_
token_ purchase_ from_ shielded_ pool_ transition - Builds a
TokenPurchaseFromShieldedPool:token_counttokens are bought attotal_agreed_pricecredits (which must match the token’s direct purchase price) paid out of the credit shielded pool together with the fee, and minted into a note forrecipientin the token’s shielded pool. Returns the transition and the fee paid. - build_
token_ shield_ transition - Builds a
TokenShieldbatch transition: proves an outputs-only Orchard bundle payingamountof the token torecipientinside the token’s own shielded pool, then wraps it in a batch transition signed byowner_id, the identity whose token balance funds the shield. - build_
token_ shielded_ transfer_ transition - Builds a
TokenShieldedTransferbatch transition: spendsspendsinside the token’s shielded pool, paystransfer_amounttorecipientand any remainder tochange_address, and wraps the bundle in a batch transition signed byowner_id, which pays the fee in credits. - build_
token_ shielded_ transfer_ with_ shielded_ fee_ transition - Builds a
TokenShieldedTransferWithShieldedFee: paystransfer_amountof the token torecipientinside the token’s shielded pool (value balance zero) and the fee out of the credit shielded pool. No identity is involved. Returns the transition and the fee paid. - build_
token_ unshield_ transition - Builds a
TokenUnshieldbatch transition: spendsspendsfrom the token’s shielded pool, creditsamounttokens torecipient_id, returns the remainder tochange_addressas a new note, and wraps the bundle in a batch transition signed byowner_id. - build_
token_ unshield_ with_ shielded_ fee_ transition - Builds a
TokenUnshieldWithShieldedFee:amountof the token leaves the token’s shielded pool intorecipient_id’s balance, the fee is paid out of the credit shielded pool. Returns the transition and the fee paid. - 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.