[][src]Struct wagyu_zcash::transaction::ZcashTransactionParameters

pub struct ZcashTransactionParameters<N: ZcashNetwork> {
    pub header: u32,
    pub version_group_id: u32,
    pub transparent_inputs: Vec<ZcashTransparentInput<N>>,
    pub transparent_outputs: Vec<ZcashTransparentOutput>,
    pub lock_time: u32,
    pub expiry_height: u32,
    pub shielded_inputs: Vec<SaplingSpend<N>>,
    pub shielded_outputs: Vec<SaplingOutput<N>>,
    pub value_balance: ZcashAmount,
    pub binding_signature: Option<Vec<u8>>,
    pub anchor: Option<Fr>,
}

Represents the Zcash transaction parameters

Fields

header: u32

The header of the transaction (Overwintered flag and transaction version) (04000080 for Sapling)

version_group_id: u32

The version group ID (0x892F2085 for Sapling)

transparent_inputs: Vec<ZcashTransparentInput<N>>

The inputs for a transparent transaction, encoded as in Bitcoin.

transparent_outputs: Vec<ZcashTransparentOutput>

The outputs for a transparent transaction, encoded as in Bitcoin,

lock_time: u32

The Unix epoch time (UTC) or block height, encoded as in Bitcoin. (4 bytes)

expiry_height: u32

The block height in the range {1 .. 499999999} after which the transaction will expire, or 0 to disable expiry (ZIP-203).

shielded_inputs: Vec<SaplingSpend<N>>

The inputs for a shielded transaction, encoded as a sequence of Zcash spend descriptions.

shielded_outputs: Vec<SaplingOutput<N>>

The outputs for a shielded transaction, encoded as a sequence of Zcash output descriptions.

value_balance: ZcashAmount

The balancing value is the net value of spend transfers minus output transfers in a transaction (in zatoshi, represented as a signed integer).

A positive balancing value takes value from the Sapling value pool, and adds it to the transparent value pool.

A negative balancing value does the reverse.

binding_signature: Option<Vec<u8>>

The binding signature enforces the consistency of the balancing value with the value commitments in spend descriptions and output descriptions.

Namely, it enforces:

  1. That the value spent by spend transfers minus that produced by output transfers, is consistent with the balancing value field of the transaction.

  2. That the signer knew the randomness used for the spend and output value commitments, in order to prevent output descriptions from being replayed by an adversary in a different transaction.

anchor: Option<Fr>

The root of the Sapling note commitment tree at some block height in the past.

Methods

impl<N: ZcashNetwork> ZcashTransactionParameters<N>[src]

pub fn new(
    version: &str,
    lock_time: u32,
    expiry_height: u32
) -> Result<Self, TransactionError>
[src]

Returns the Zcash transaction parameters

pub fn add_transparent_input(
    &self,
    transaction_id: Vec<u8>,
    index: u32,
    address: Option<ZcashAddress<N>>,
    amount: Option<ZcashAmount>,
    redeem_script: Option<Vec<u8>>,
    script_pub_key: Option<Vec<u8>>,
    sequence: Option<Vec<u8>>,
    sighash_code: SignatureHash
) -> Result<Self, TransactionError>
[src]

Returns the transaction parameters with the given transparent input appended.

pub fn add_transparent_output(
    &self,
    address: &ZcashAddress<N>,
    amount: ZcashAmount
) -> Result<Self, TransactionError>
[src]

Returns the transaction parameters with the given transparent output appended.

pub fn add_sapling_input(
    &self,
    extended_private_key: &ZcashExtendedPrivateKey<N>,
    cmu: &[u8; 32],
    epk: &[u8; 32],
    enc_ciphertext: &str,
    input_anchor: Fr,
    witness: MerklePath<Node>
) -> Result<Self, TransactionError>
[src]

Add a sapling shielded spend to the transaction

pub fn add_sapling_output(
    &self,
    ovk: Option<SaplingOutgoingViewingKey>,
    address: &ZcashAddress<N>,
    amount: ZcashAmount
) -> Result<Self, TransactionError>
[src]

Add a sapling shielded output to the transaction

pub fn read<R: Read>(reader: R) -> Result<Self, TransactionError>[src]

Read and output the Zcash transaction parameters

Trait Implementations

impl<N: Clone + ZcashNetwork> Clone for ZcashTransactionParameters<N>[src]

impl<N: Debug + ZcashNetwork> Debug for ZcashTransactionParameters<N>[src]

Auto Trait Implementations

impl<N> RefUnwindSafe for ZcashTransactionParameters<N> where
    N: RefUnwindSafe

impl<N> Send for ZcashTransactionParameters<N>

impl<N> Sync for ZcashTransactionParameters<N>

impl<N> Unpin for ZcashTransactionParameters<N> where
    N: Unpin

impl<N> UnwindSafe for ZcashTransactionParameters<N> where
    N: UnwindSafe

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> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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>,