Skip to main content

build_shielded_transfer_transition

Function build_shielded_transfer_transition 

Source
pub fn build_shielded_transfer_transition<P: OrchardProver>(
    spends: Vec<SpendableNote>,
    recipient: &OrchardAddress,
    transfer_amount: u64,
    change_address: &OrchardAddress,
    fvk: &FullViewingKey,
    ask: &SpendAuthorizingKey,
    anchor: Anchor,
    prover: &P,
    memo: [u8; 36],
    platform_version: &PlatformVersion,
) -> Result<(StateTransition, Credits), ProtocolError>
Expand description

Builds a ShieldedTransfer state transition (shielded pool -> shielded pool).

Spends existing notes and creates a new note for the recipient. The shielded fee is deducted from the spent notes. Any remaining change is returned to the change_address.

Both real outputs are encrypted with the sender’s External-scope OVK (derived from fvk), so the sender can recover its own send history (recipient, value, memo) from chain data via OVK recovery.

§Parameters

  • spends - Notes to spend with their Merkle paths
  • recipient - Orchard address to receive the transferred note
  • transfer_amount - Amount to transfer to the recipient
  • change_address - Orchard address for change output (if any)
  • fvk - Full viewing key for spend authorization
  • ask - Spend authorizing key for RedPallas signatures
  • anchor - Sinsemilla root of the note commitment tree (Orchard Anchor)
  • prover - Orchard prover (holds the Halo 2 proving key)
  • memo - 36-byte structured memo for the recipient (4-byte type tag + 32-byte payload)
  • platform_version - Protocol version

The fee is not a parameter: a shielded transfer’s value_balance IS the fee and consensus pins it to exactly compute_minimum_shielded_fee, so there is nothing for the caller to choose. Returns the built transition together with the fee (in credits) that was applied.