Skip to main content

build_identity_create_from_shielded_pool_transition

Function build_identity_create_from_shielded_pool_transition 

Source
pub async fn build_identity_create_from_shielded_pool_transition<P, S>(
    public_keys: Vec<(IdentityPublicKey, IdentityPublicKeyInCreation)>,
    denomination: u64,
    send_to_address_on_creation_failure: PlatformAddress,
    spends: Vec<SpendableNote>,
    change_address: &OrchardAddress,
    fvk: &FullViewingKey,
    ask: &SpendAuthorizingKey,
    anchor: Anchor,
    prover: &P,
    identity_signer: &S,
    memo: [u8; 36],
    platform_version: &PlatformVersion,
) -> Result<IdentityCreateFromShieldedPoolBuildResult, ProtocolError>
Expand description

Builds an IdentityCreateFromShieldedPool (Type 20) state transition: spend shielded-pool notes to fund a brand-new Platform identity.

The denomination (a member of the versioned exit-denomination set) leaves the pool EXACTLY — the bundle’s value_balance equals denomination (the ShieldedTransfer exact-equality model). Any spent value above the denomination re-enters the pool as a single change note to change_address. The metered fee is taken from the denomination at execution, so the new identity is created holding denomination - total_fee (the fee is NOT subtracted from the bundle here — only predicted for the caller’s note-reservation math).

§Authorization

IdentityCreateFromShieldedPool carries NO platform identity signature. Authorization is 100%:

  1. the Orchard proof + per-action spend-auth signatures (the spender controls the spent notes),
  2. the RedPallas binding signature over the platform sighash, which commits the new identity id, the denomination, and the FULL public-key set via crate::shielded::identity_create_from_shielded_extra_sighash_data — so a relayer cannot redirect the bundle to a different id or swap in keys it controls, and
  3. a per-key proof-of-possession signature over the transition’s signable_bytes, proving the creator holds every key being registered (mirrors IdentityCreate).

The new identity id is derived from the SORTED published action nullifiers (derive_identity_id_from_actions) — including any padding action’s dummy nullifier (BundleType::DEFAULT pads single-spend bundles to a 2-action minimum), so it is only known once the bundle’s action set is fixed. It is derived inside the bundle-build hook, bound into the Orchard sighash there, and the same value is re-derived and checked at consensus.

§Parameters

  • public_keys — the new identity’s public keys, each paired with its IdentityPublicKeyInCreation form (the latter goes into the transition; the former is used only to look up the private key in identity_signer). The per-key proof-of-possession signatures are filled by this function.
  • denomination — the fixed exit amount (in credits) leaving the pool.
  • spends — notes to spend with their Merkle paths. Their total MUST be >= denomination.
  • change_address — Orchard address that receives the change note (total_spent - denomination).
  • fvk / ask — the spender’s full viewing key and spend-authorizing key (Orchard side).
  • anchor — Sinsemilla root of the note commitment tree (Orchard Anchor).
  • prover — Orchard prover (holds the Halo 2 proving key).
  • identity_signer — produces each new key’s proof-of-possession signature over the transition’s signable bytes.
  • memo — 36-byte structured memo for the change output.
  • platform_version — protocol version.

Returns the PoP-signed keys, the serialized Orchard bundle, the derived identity id, and the client-predicted fee (in credits) — ready to feed the SDK’s IdentityCreateFromShieldedPool::identity_create_from_shielded_pool broadcast helper. The authoritative fee is metered at consensus.