pub struct BitcoinTxBuilder<T: AddressEncoder> { /* private fields */ }
Expand description

This is a generic builder for Bitcoin transactions. It allows you to easily build legacy and witness transactions.

Note: due to Bitcoin consensus rules, the order of inputs and outputs may be semantically meaningful. E.g. when signing a transaction with the SINGLE sighash mode.

It is parameterized with an address encoder, so that the same struct and logic can be used on mainnet and testnet.

Implementations

Add a set of witnesses to the transaction, and return a witness builder.

Insert a witness at a speicified index

Add an op_return output. Using this twice may render the transaction non-standard.

Set the script sig at a specific input. Do nothing if the vin is not that long.

Consume self, produce a legacy tx. Discard any witness information in the builder

Consume self, produce a witness tx

Add an output paying value to script_pubkey

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

An AddressEncoder that handles encoding and decoding network addresses. This is used in the pay function to decode addresses into associated RecipientIdentifiers. Read more

The Transaction type returned by build()

Instantiate a new builder

Instantiate a new builder from a transaction by taking ownership of its properties

Instantiate a new builder from a transaction reference by cloning its properties

Set or overwrite the transaction version. Read more

Spend an outpoint. Adds an unsigned input spending the associated outpoint with the specified sequence number. Read more

Pay an Address. Adds an output paying value to address.

Insert an input at the specified index. Inputs after that are shifted to later indices. Read more

Add a set of inputs to the transaction.

Insert an output at the specified index. Outputs after that are shifted to later indices. Read more

Add a set of outputs to the transaction.

Set or overwrite the transaction locktime. Read more

Consume the builder and produce a transaction from the builder’s current state.

Instantiate a new builder from a std::io::Read that contains a serialized tx

Instantiate a new builder from transaction hex

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.