Skip to main content

Module shielded

Module shielded 

Source

Re-exports§

pub use memo::ShieldedMemo;
pub use memo::MEMO_PAYLOAD_SIZE;
pub use memo::MEMO_SIZE;

Modules§

builder
Convenience builders for constructing shielded state transitions.
memo
Structured 36-byte shielded note memo (DashMemo).

Structs§

OrchardBundleParams
Common Orchard bundle parameters shared across all shielded transition types.
SerializedAction
A serialized Orchard action extracted from a bundle.

Constants§

SHIELDED_IDENTITY_TOP_UP_BALANCE_STORAGE_BYTES
Flat component (in effective bytes at the per-byte storage rate) for the identity-side write an IdentityTopUpFromShieldedPool performs on top of its per-action nullifier and note writes: the single AddToIdentityBalance operation, charged as part of the pool-paid flat fee (built like SHIELDED_UNSHIELD_ADDRESS_STORAGE_BYTES).
SHIELDED_TOKEN_BALANCE_INSERT_STORAGE_BYTES
Flat component (in effective bytes at the per-byte storage rate) for the recipient’s token balance item a TokenUnshieldWithShieldedFee writes on top of its per-action nullifier and note writes.
SHIELDED_TOKEN_PURCHASE_OWNER_BALANCE_STORAGE_BYTES
Effective storage bytes for crediting the contract owner’s existing identity balance when tokens are bought from a shielded pool.
SHIELDED_UNSHIELD_ADDRESS_STORAGE_BYTES
Calibrated effective storage-byte cost of the single AddBalanceToAddress write an Unshield performs, crediting the net (unshielding_amount − fee) to the output platform address.
SHIELDED_WITHDRAWAL_DOCUMENT_STORAGE_BYTES
Calibrated effective storage-byte cost of the Core withdrawal document a ShieldedWithdrawal creates.
SHIELD_BUNDLE_TAG
Domain tag of a credit pool Shield bundle. The credit pool’s outputs-only tags continue the token pool range above: they share the same preimage slot at the same length, so every tag in both sets must stay distinct from each other and from every StateTransitionType byte. credit_pool_outputs_only_tags_cannot_collide_with_state_transition_types and outputs_only_bundle_tags_are_pairwise_distinct hold both reservations.
SHIELD_FROM_ASSET_LOCK_BUNDLE_TAG
Domain tag of a ShieldFromAssetLock bundle. See SHIELD_BUNDLE_TAG.
SHIELD_FROM_IDENTITY_BUNDLE_TAG
Domain tag of a ShieldFromIdentity bundle. See SHIELD_BUNDLE_TAG.
TOKEN_CLAIM_TO_POOL_BUNDLE_TAG
Domain tag of a TokenClaimToPool bundle. See TOKEN_SHIELD_BUNDLE_TAG.
TOKEN_DIRECT_PURCHASE_TO_POOL_BUNDLE_TAG
Domain tag of a TokenDirectPurchaseToPool bundle. See TOKEN_SHIELD_BUNDLE_TAG.
TOKEN_MINT_TO_POOL_BUNDLE_TAG
Domain tag of a TokenMintToPool bundle. See TOKEN_SHIELD_BUNDLE_TAG.
TOKEN_PURCHASE_FROM_SHIELDED_POOL_TYPE
The state transition type byte the token bundle of a TokenPurchaseFromShieldedPool commits to.
TOKEN_SHIELDED_TRANSFER_WITH_SHIELDED_FEE_TYPE
The state transition type byte the token bundle of a TokenShieldedTransferWithShieldedFee commits to (StateTransitionType::TokenShieldedTransferWithShieldedFee).
TOKEN_SHIELD_BUNDLE_TAG
Domain tag an outputs-only token pool bundle commits to. Unlike the three constants above these are not StateTransitionType bytes — every one of these bundles rides inside a batch transition — yet they share a preimage slot with them at the same length. They are drawn from a high range that space has not reached, which nothing in the type system enforces: StateTransitionType is repr(u8) and could be given one of these bytes. What holds the reservation is outputs_only_token_pool_tags_cannot_collide_with_state_transition_types, which asks the enum and fails the build’s tests the day one is assigned here.
TOKEN_UNSHIELD_WITH_SHIELDED_FEE_TYPE
The state transition type byte the token bundle of a TokenUnshieldWithShieldedFee commits to.

Functions§

compute_minimum_shielded_fee
Computes the minimum flat fee (in credits) for a pool-paid / asset-lock shielded transition.
compute_platform_sighash
Computes the platform sighash from an Orchard bundle commitment and optional transparent field data.
compute_shielded_identity_balance_write_fee
Computes the conservative admission floor (in credits) for ShieldFromIdentity: compute_minimum_shielded_fee plus the versioned per-action and flat identity-write allowances, priced at the per-byte storage rate. The allowances cover the complete execution-event admission estimate, including the estimated note/nullifier and identity writes and the validation context.
compute_shielded_identity_create_fee
Computes the IdentityCreateFromShieldedPool fee (in credits): compute_minimum_shielded_fee PLUS the variable storage cost of the AddNewIdentity write (identity record + balance + revision + N key subtrees), which scales with the number of public keys.
compute_shielded_identity_top_up_fee
Computes the flat fee for IdentityTopUpFromShieldedPool (base minimum plus the flat identity-balance write component).
compute_shielded_unshield_fee
Computes the Unshield fee (in credits): compute_minimum_shielded_fee PLUS the flat storage cost of the single AddBalanceToAddress write an Unshield performs.
compute_shielded_verification_fee
Computes the compute-only shielded fee (in credits): the ZK-compute portion (Halo 2 proof verification + per-action spend-auth/nullifier processing) that GroveDB metering cannot see.
compute_shielded_withdrawal_fee
Computes the ShieldedWithdrawal fee (in credits): compute_minimum_shielded_fee PLUS the flat storage cost of the Core withdrawal document a ShieldedWithdrawal inserts.
compute_token_pool_paid_shielded_fee
Computes the fee of an identity-less token pool transition (in credits): two bundles are verified and stored, so it is compute_minimum_shielded_fee of the fee bundle PLUS the same base for the token bundle, plus extra_storage_bytes of flat per-transition storage priced at the storage rate (the balance items the transition writes outside the pools).
compute_token_purchase_from_shielded_pool_fee
The fee of a TokenPurchaseFromShieldedPool: both bundles plus the contract owner’s credit balance write and the token supply item.
compute_token_shielded_transfer_with_shielded_fee_fee
The fee of a TokenShieldedTransferWithShieldedFee: both bundles, nothing written outside the pools.
compute_token_unshield_with_shielded_fee_fee
The fee of a TokenUnshieldWithShieldedFee: both bundles plus the recipient’s token balance item, priced as the insert it is for a recipient who has never held this token.
credit_pool_output_only_extra_sighash_data_v0
Version 0 layout of the credit pool’s outputs-only bundles — Shield, ShieldFromIdentity and ShieldFromAssetLock: bundle tag (1) || owner (32). Frozen: never mutate; a layout change requires a new credit_pool_bundle_binding version.
document_token_payment_extra_sighash_data
Extra sighash data of a document action paid from a token shielded pool (TokenPaymentInfo::V1): the token id, the batch owner, the document’s contract and id and the amount paid, so a bundle proven for one document cannot be replayed for another document, batch owner, token or cost.
document_token_payment_extra_sighash_data_v0
Version 0 layout: token_id (32) || owner_id (32) || data_contract_id (32) || document_id (32) || amount (8, little endian). Frozen: never mutate; a layout change requires a new _v1 + version bump.
identity_create_from_shielded_extra_sighash_data
Builds the transparent extra_data bound into an IdentityCreateFromShieldedPool’s platform sighash, with the byte layout identity_id (32) || denomination (u64 LE) || send_to_address_on_creation_failure (tag u8: 0=P2pkh, 1=P2sh || hash 20) || num_keys (u16 LE) || for each key in supplied order: key_id (u32 LE) || purpose (u8) || security_level (u8) || key_type (u8) || key_data_len (u16 LE) || key_data || read_only (u8) || contract_bounds (tag u8: 0=None, 1=SingleContract id(32), 2=SingleContractDocumentType id(32) name_len(u16 LE) name, 3=ContractGroup id(32)).
identity_create_from_shielded_extra_sighash_data_v0
v0 byte layout of identity_create_from_shielded_extra_sighash_data (see that function’s doc comment for the layout and rationale). Frozen: never mutate; a layout change requires a new _v1
identity_top_up_from_shielded_extra_sighash_data
Builds the transparent extra_data bound into an IdentityTopUpFromShieldedPool’s platform sighash, with the byte layout identity_id (32) || top_up_amount (u64 LE).
identity_top_up_from_shielded_extra_sighash_data_v0
v0 byte layout of identity_top_up_from_shielded_extra_sighash_data. Frozen: never mutate; a layout change requires a new _v1 + version bump.
serialized_actions_digest
A digest of serialized Orchard actions in wire order: every field of every action, hashed once. A group action stores it so every signer commits to exactly the same notes, and a pool mint or burn folds it into its group action id.
shield_extra_sighash_data
Extra sighash data of a credit pool Shield bundle: its kind tag and a digest of the platform addresses that fund it. See credit_pool_output_only_extra_sighash_data_v0 for why the credit pool’s outputs-only bundles bind anything at all.
shield_from_asset_lock_extra_sighash_data
Extra sighash data of a ShieldFromAssetLock bundle: its kind tag and the identifier of the asset lock that funds it (AssetLockProof::create_identifier, the double SHA-256 of the locked outpoint). See credit_pool_output_only_extra_sighash_data_v0.
shield_from_identity_extra_sighash_data
Extra sighash data of a ShieldFromIdentity bundle: its kind tag and the identity whose balance funds it. See credit_pool_output_only_extra_sighash_data_v0.
shielded_withdrawal_extra_sighash_data
Builds the transparent extra_data bound into a ShieldedWithdrawal’s platform sighash, with the byte layout output_script || unshielding_amount (u64 LE) || core_fee_per_byte (u32 LE) || pooling (u8).
shielded_withdrawal_extra_sighash_data_v0
v0 byte layout of shielded_withdrawal_extra_sighash_data (see that function’s doc comment for the layout and rationale). Frozen: never mutate; a layout change requires a new _v1 + version.
token_burn_from_pool_extra_sighash_data
Extra sighash data of a batch TokenBurnFromPool: the token id, the burner and the amount destroyed, so a bundle proven for one burn cannot be replayed for another token, burner or amount (72 bytes; no other layout has that length).
token_burn_from_pool_extra_sighash_data_v0
Version 0 layout: token_id (32) || burner_id (32) || amount (8, little endian).
token_pool_fee_bundle_extra_sighash_data
Extra sighash data of the credit pool fee bundle of an identity-less token pool transition: the state transition type, the token id and a digest of the token bundle’s actions, so the fee bundle can only ever pay for that exact token bundle.
token_pool_fee_bundle_extra_sighash_data_v0
Version 0 layout: state transition type (1) || token_id (32) || token actions digest (32). Frozen.
token_pool_output_only_extra_sighash_data
Extra sighash data of an outputs-only token pool bundle — TokenShield, TokenMintToPool, TokenClaimToPool and TokenDirectPurchaseToPool: the bundle’s domain tag, the token id and the identity the bundle is attributed to.
token_pool_output_only_extra_sighash_data_v0
Version 0 layout: bundle tag (1) || token_id (32) || owner_id (32). Frozen: never mutate; a layout change requires a new _v1 + version bump.
token_purchase_from_shielded_pool_extra_sighash_data
Extra sighash data of the token bundle of a TokenPurchaseFromShieldedPool: the state transition type, the token id, the token count and the agreed price.
token_purchase_from_shielded_pool_extra_sighash_data_v0
Version 0 layout: state transition type (1, = 28) || token_id (32) || token_count (8, LE) || total_agreed_price (8, LE). Frozen.
token_shielded_transfer_extra_sighash_data
Builds the transparent extra_data bound into a TokenShieldedTransfer’s platform sighash, with the byte layout token_id (32) || owner_id (32).
token_shielded_transfer_extra_sighash_data_v0
v0 byte layout of token_shielded_transfer_extra_sighash_data. Frozen: never mutate; a layout change requires a new _v1 + version bump.
token_shielded_transfer_with_shielded_fee_extra_sighash_data
Extra sighash data of the token bundle of a TokenShieldedTransferWithShieldedFee: the state transition type and the token id, so the bundle is pinned to one token pool and one transition kind.
token_shielded_transfer_with_shielded_fee_extra_sighash_data_v0
Version 0 layout: state transition type (1, = 26) || token_id (32). Frozen.
token_unshield_extra_sighash_data
Builds the transparent extra_data bound into a TokenUnshield’s platform sighash, with the byte layout token_id (32) || owner_id (32) || recipient_id (32) || amount (u64 LE).
token_unshield_extra_sighash_data_v0
v0 byte layout of token_unshield_extra_sighash_data. Frozen: never mutate; a layout change requires a new _v1 + version bump.
token_unshield_with_shielded_fee_extra_sighash_data
Extra sighash data of the token bundle of a TokenUnshieldWithShieldedFee: the state transition type, the token id, the recipient and the amount, so the bundle cannot be replayed against another token, recipient or amount.
token_unshield_with_shielded_fee_extra_sighash_data_v0
Version 0 layout: state transition type (1, = 27) || token_id (32) || recipient_id (32) || amount (8, little endian). Frozen.
unshield_extra_sighash_data
Builds the transparent extra_data bound into an Unshield’s platform sighash, with the byte layout output_address || unshielding_amount (u64 LE).
unshield_extra_sighash_data_v0
v0 byte layout of unshield_extra_sighash_data (see that function’s doc comment for the layout and rationale). Frozen: never mutate; a layout change requires a new _v1 + version bump.