[][src]Module grin_core::libtx::build

Utility functions to build Grin transactions. Handles the blinding of inputs and outputs, maintaining the sum of blinding factors, producing the excess signature, etc.

Each building function is a combinator that produces a function taking a transaction a sum of blinding factors, to return another transaction and sum. Combinators can then be chained and executed using the transaction function.

Example: build::transaction(vec![input_rand(75), output_rand(42), output_rand(32), with_fee(1)])

Structs

Context

Context information available to transaction combinators.

Functions

coinbase_input

Adds a coinbase input spending a coinbase output.

initial_tx

Sets an initial transaction to add to when building a new transaction. We currently only support building a tx with a single kernel with build::transaction()

input

Adds an input with the provided value and blinding key to the transaction being built.

output

Adds an output with the provided value and key identifier from the keychain.

partial_transaction

Builds a new transaction by combining all the combinators provided in a Vector. Transactions can either be built "from scratch" with a list of inputs or outputs or from a pre-existing transaction that gets added to.

transaction

Builds a complete transaction.

with_excess

Adds a known excess value on the transaction being built. Usually used in combination with the initial_tx function when a new transaction is built by adding to a pre-existing one.

with_fee

Sets the fee on the transaction being built.

with_lock_height

Sets the lock_height on the transaction being built.

with_offset

Sets a known tx "offset". Used in final step of tx construction.

Type Definitions

Append

Function type returned by the transaction combinators. Transforms a (Transaction, BlindSum) pair into another, provided some context.