Module grin_core::libtx::build

source ·
Expand description

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( KernelFeatures::Plain{ fee: 2.try_into().unwrap() }, vec![ input_rand(75), output_rand(42), output_rand(32), ] )

Structs§

  • Context information available to transaction combinators.

Functions§

  • Adds a coinbase input spending a coinbase output.
  • Sets an initial transaction to add to when building a new transaction.
  • Adds an input with the provided value and blinding key to the transaction being built.
  • Adds an output with the provided value and key identifier from the keychain.
  • Takes an existing transaction and partially builds on it.
  • Builds a complete transaction. NOTE: We only use this in tests (for convenience). In the real world we use signature aggregation across multiple participants.
  • Build a complete transaction with the provided kernel and corresponding private excess. NOTE: Only used in tests (for convenience). Cannot recommend passing private excess around like this in the real world.
  • 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.

Type Aliases§

  • Function type returned by the transaction combinators. Transforms a (Transaction, BlindSum) tuple into another, given the provided context. Will return an Err if seomthing went wrong at any point during transaction building.