pub fn build_unshield_transition<P: OrchardProver>(
spends: Vec<SpendableNote>,
output_address: PlatformAddress,
unshield_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 an Unshield state transition (shielded pool -> platform address).
Spends existing notes and sends part of the value to a transparent platform
address. The shielded fee is deducted from the spent notes. Any remaining
value is returned to the shielded change_address; the change note is
encrypted with the sender’s External-scope OVK (derived from fvk) so the
wallet can recover it — including the structured memo — via OVK recovery.
§Parameters
spends- Notes to spend with their Merkle pathsoutput_address- Platform address to receive the unshielded fundsunshield_amount- Amount to unshield to the platform addresschange_address- Orchard address for change outputfvk- Full viewing key for spend authorizationask- Spend authorizing key for RedPallas signaturesanchor- 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 change output (4-byte type tag + 32-byte payload)platform_version- Protocol version
The fee is not a parameter: consensus always charges exactly
compute_shielded_unshield_fee (the base shielded minimum fee PLUS the flat storage cost of the
single AddBalanceToAddress write this transition performs crediting the net to the output
address) and ignores any surplus. Returns the built transition together with the fee (in
credits) that was applied.