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
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<TransactionSpendingCondition> for TransactionSpendingCondition
impl PartialEq<TransactionSpendingCondition> for TransactionSpendingCondition
sourcefn eq(&self, other: &TransactionSpendingCondition) -> bool
fn eq(&self, other: &TransactionSpendingCondition) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &TransactionSpendingCondition) -> bool
fn ne(&self, other: &TransactionSpendingCondition) -> bool
This method tests for !=
.
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>
serialize implementors should never error unless there is an underlying
failure in writing to the fd
Read more
fn consensus_deserialize<R: Read>(
fd: &mut R
) -> Result<TransactionSpendingCondition, CodecError>
impl StructuralPartialEq for TransactionSpendingCondition
Auto Trait Implementations
impl RefUnwindSafe for TransactionSpendingCondition
impl Send for TransactionSpendingCondition
impl Sync for TransactionSpendingCondition
impl Unpin for TransactionSpendingCondition
impl UnwindSafe for TransactionSpendingCondition
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more