[][src]Struct zebra_chain::transaction::ShieldedData

pub struct ShieldedData {
    pub first: Either<Spend, Output>,
    pub rest_spends: Vec<Spend>,
    pub rest_outputs: Vec<Output>,
    pub binding_sig: Signature<Binding>,
}

A bundle of Spend and Output descriptions and signature data.

Spend and Output descriptions are optional, but Zcash transactions must include a binding signature if and only if there is at least one Spend or Output description. This wrapper type bundles at least one Spend or Output description with the required signature data, so that an Option<ShieldedData> correctly models the presence or absence of any shielded data.

Fields

first: Either<Spend, Output>

Either a spend or output description.

Storing this separately ensures that it is impossible to construct an invalid ShieldedData with no spends or outputs.

However, it's not necessary to access or process first and rest separately, as the ShieldedData::spends and ShieldedData::outputs methods provide iterators over all of the Spends and Outputs.

rest_spends: Vec<Spend>

The rest of the Spends for this transaction.

Note that the ShieldedData::spends method provides an iterator over all spend descriptions.

rest_outputs: Vec<Output>

The rest of the Outputs for this transaction.

Note that the ShieldedData::outputs method provides an iterator over all output descriptions.

binding_sig: Signature<Binding>

A signature on the transaction hash.

Implementations

impl ShieldedData[src]

pub fn spends(&self) -> impl Iterator<Item = &Spend>[src]

Iterate over the Spends for this transaction.

pub fn outputs(&self) -> impl Iterator<Item = &Output>[src]

Iterate over the Outputs for this transaction.

pub fn nullifiers(&self) -> impl Iterator<Item = &Nullifier>[src]

Collect the Nullifiers for this transaction, if it contains Spends.

pub fn note_commitments(&self) -> impl Iterator<Item = &Fq>[src]

Collect the cm_u's for this transaction, if it contains Outputs.

pub fn binding_verification_key(
    &self,
    value_balance: Amount
) -> VerificationKeyBytes<Binding>
[src]

Calculate the Spend/Output binding verification key.

Getting the binding signature validating key from the Spend and Output description value commitments and the balancing value implicitly checks that the balancing value is consistent with the value transfered in the Spend and Output descriptions but also proves that the signer knew the randomness used for the Spend and Output value commitments, which prevents replays of Output descriptions.

The net value of Spend transfers minus Output transfers in a transaction is called the balancing value, measured in zatoshi as a signed integer v_balance.

Consistency of v_balance with the value commitments in Spend descriptions and Output descriptions is enforced by the binding signature.

Instead of generating a key pair at random, we generate it as a function of the value commitments in the Spend descriptions and Output descriptions of the transaction, and the balancing value.

https://zips.z.cash/protocol/protocol.pdf#saplingbalance

Trait Implementations

impl Arbitrary for ShieldedData[src]

type Parameters = ()

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default. Read more

type Strategy = BoxedStrategy<Self>

The type of Strategy used to generate values of type Self. Read more

impl Clone for ShieldedData[src]

impl Debug for ShieldedData[src]

impl<'de> Deserialize<'de> for ShieldedData[src]

impl Eq for ShieldedData[src]

impl PartialEq<ShieldedData> for ShieldedData[src]

impl Serialize for ShieldedData[src]

Auto Trait Implementations

impl RefUnwindSafe for ShieldedData

impl Send for ShieldedData

impl Sync for ShieldedData

impl Unpin for ShieldedData

impl UnwindSafe for ShieldedData

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,