BSV.TxOut (BSV v2.0.0) View Source

A TxOut is a data structure representing a single output in a BSV.Tx.t/0.

A TxOut consists of the number of satoshis being locked in the output, and a BSV.Script.t/0, otherwise known as the locking script. The output can later be spent by creating an input in a new transaction with a corresponding unlocking script.

The index of the output within it's containing BSV.Tx.t/0, denotes it's BSV.TxOut.vout/0.

Link to this section Summary

Types

t()

TxOut struct

Vout - Vector of an output in a Bitcoin transaction

Functions

Parses the given binary into a BSV.TxOut.t/0.

Parses the given binary into a BSV.TxOut.t/0.

Returns the number of bytes of the given BSV.TxOut.t/0.

Serialises the given BSV.TxOut.t/0 into a binary.

Link to this section Types

Specs

t() :: %BSV.TxOut{satoshis: non_neg_integer(), script: BSV.Script.t()}

TxOut struct

Specs

vout() :: non_neg_integer()

Vout - Vector of an output in a Bitcoin transaction

In integer representing the index of a TxOut.

Link to this section Functions

Link to this function

from_binary(data, opts \\ [])

View Source

Specs

from_binary(binary(), keyword()) :: {:ok, t()} | {:error, term()}

Parses the given binary into a BSV.TxOut.t/0.

Returns the result in an :ok / :error tuple pair.

Options

The accepted options are:

  • :encoding - Optionally decode the binary with either the :base64 or :hex encoding scheme.
Link to this function

from_binary!(data, opts \\ [])

View Source

Specs

from_binary!(binary(), keyword()) :: t()

Parses the given binary into a BSV.TxOut.t/0.

As from_binary/2 but returns the result or raises an exception.

Specs

get_size(t()) :: non_neg_integer()

Returns the number of bytes of the given BSV.TxOut.t/0.

Link to this function

to_binary(txout, opts \\ [])

View Source

Serialises the given BSV.TxOut.t/0 into a binary.

Options

The accepted options are:

  • :encoding - Optionally encode the binary with either the :base64 or :hex encoding scheme.