pub enum TransactionSpendingCondition {
Singlesig(SinglesigSpendingCondition),
Multisig(MultisigSpendingCondition),
}
Variants
Singlesig(SinglesigSpendingCondition)
Multisig(MultisigSpendingCondition)
Implementations
sourceimpl TransactionSpendingCondition
impl TransactionSpendingCondition
pub fn new_singlesig_p2pkh(
pubkey: Secp256k1PublicKey
) -> Option<TransactionSpendingCondition>
pub fn new_singlesig_p2wpkh(
pubkey: Secp256k1PublicKey
) -> Option<TransactionSpendingCondition>
pub fn new_multisig_p2sh(
num_sigs: u16,
pubkeys: Vec<Secp256k1PublicKey>
) -> Option<TransactionSpendingCondition>
pub fn new_multisig_p2wsh(
num_sigs: u16,
pubkeys: Vec<Secp256k1PublicKey>
) -> Option<TransactionSpendingCondition>
sourcepub fn new_initial_sighash() -> TransactionSpendingCondition
pub fn new_initial_sighash() -> TransactionSpendingCondition
When committing to the fact that a transaction is sponsored, the origin doesn’t know anything else. Instead, it commits to this sentinel value as its sponsor. It is intractable to calculate a private key that could generate this.
pub fn num_signatures(&self) -> u16
pub fn signatures_required(&self) -> u16
pub fn nonce(&self) -> u64
pub fn tx_fee(&self) -> u64
pub fn set_nonce(&mut self, n: u64)
pub fn set_tx_fee(&mut self, tx_fee: u64)
pub fn get_tx_fee(&self) -> u64
sourcepub fn address_mainnet(&self) -> StacksAddress
pub fn address_mainnet(&self) -> StacksAddress
Get the mainnet account address of the spending condition
sourcepub fn address_testnet(&self) -> StacksAddress
pub fn address_testnet(&self) -> StacksAddress
Get the mainnet account address of the spending condition
pub fn make_sighash_presign(
cur_sighash: &Txid,
cond_code: &TransactionAuthFlags,
tx_fee: u64,
nonce: u64
) -> Txid
pub fn make_sighash_postsign(
cur_sighash: &Txid,
pubkey: &Secp256k1PublicKey,
sig: &RecoverableSignature
) -> Txid
sourcepub fn next_signature(
cur_sighash: &Txid,
cond_code: &TransactionAuthFlags,
tx_fee: u64,
nonce: u64,
privk: &Secp256k1PrivateKey
) -> Result<(RecoverableSignature, Txid), CodecError>
pub fn next_signature(
cur_sighash: &Txid,
cond_code: &TransactionAuthFlags,
tx_fee: u64,
nonce: u64,
privk: &Secp256k1PrivateKey
) -> Result<(RecoverableSignature, Txid), CodecError>
Linear-complexity signing algorithm – we sign a rolling hash over all data committed to by the previous signer (instead of naively re-serializing the transaction each time), as well as over new data provided by this key (excluding its own public key or signature, which are authenticated by the spending condition’s key hash). Calculates and returns the next signature and sighash, which the subsequent private key must sign.
sourcepub fn next_verification(
cur_sighash: &Txid,
cond_code: &TransactionAuthFlags,
tx_fee: u64,
nonce: u64,
key_encoding: &TransactionPublicKeyEncoding,
sig: &RecoverableSignature
) -> Result<(Secp256k1PublicKey, Txid), CodecError>
pub fn next_verification(
cur_sighash: &Txid,
cond_code: &TransactionAuthFlags,
tx_fee: u64,
nonce: u64,
key_encoding: &TransactionPublicKeyEncoding,
sig: &RecoverableSignature
) -> Result<(Secp256k1PublicKey, Txid), CodecError>
Linear-complexity verifying algorithm – we verify a rolling hash over all data committed to by order of signers (instead of re-serializing the tranasction each time). Calculates the next sighash and public key, which the next verifier must verify. Used by StacksTransaction::verify*
sourcepub fn verify(
&self,
initial_sighash: &Txid,
cond_code: &TransactionAuthFlags
) -> Result<Txid, CodecError>
pub fn verify(
&self,
initial_sighash: &Txid,
cond_code: &TransactionAuthFlags
) -> Result<Txid, CodecError>
Verify all signatures
Trait Implementations
sourceimpl Clone for TransactionSpendingCondition
impl Clone for TransactionSpendingCondition
sourcefn clone(&self) -> TransactionSpendingCondition
fn clone(&self) -> TransactionSpendingCondition
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for TransactionSpendingCondition
impl Debug for TransactionSpendingCondition
sourceimpl<'de> Deserialize<'de> for TransactionSpendingCondition
impl<'de> Deserialize<'de> for TransactionSpendingCondition
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl PartialEq<TransactionSpendingCondition> for TransactionSpendingCondition
impl PartialEq<TransactionSpendingCondition> for TransactionSpendingCondition
sourcefn eq(&self, other: &TransactionSpendingCondition) -> bool
fn eq(&self, other: &TransactionSpendingCondition) -> bool
sourceimpl StacksMessageCodec for TransactionSpendingCondition
impl StacksMessageCodec for TransactionSpendingCondition
sourcefn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), CodecError>
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), CodecError>
fd
Read more