Skip to main content

InputSigner

Struct InputSigner 

Source
pub struct InputSigner { /* private fields */ }
Expand description

An input signer.

Implementations§

Source§

impl InputSigner

Source

pub fn new(public_key: PublicKey, network: Network) -> InputSigner

Creates an input signer for the given public key and network.

Source

pub fn secp256k1_context(&self) -> &Secp256k1<All>

Returns a reference to the secp256k1 engine, used to execute all signature operations.

Source

pub fn secp256k1_context_mut(&mut self) -> &mut Secp256k1<All>

Returns a mutable reference to the secp256k1 engine, used to execute all signature operations.

Source

pub fn signature_hash<'a, 'b, V: Into<UnspentTxOutValue<'b>>>( &mut self, txin: TxInRef<'a>, value: V, ) -> Sha256dHash

Computes the BIP-143 compliant sighash for a SIGHASH_ALL signature for the given input.

Source

pub fn sign_input<'a, 'b, V: Into<UnspentTxOutValue<'b>>>( &mut self, txin: TxInRef<'a>, value: V, secret_key: &SecretKey, ) -> Result<InputSignature, Error>

Computes the BIP-143 compliant signature for the given input. Under the hood this method signs sighash for the given input with the given secret key.

Source

pub fn verify_input<'a, 'b, 'c, V, S>( &self, txin: TxInRef<'a>, value: V, public_key: &PublicKey, signature: S, ) -> Result<(), Error>

Checks correctness of the signature for the given input.

Source

pub fn spend_input(&self, input: &mut TxIn, signature: InputSignature)

Collects the witness data for the given transaction input. Thus, the input becomes spent.

Trait Implementations§

Source§

impl Debug for InputSigner

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.