BSV.OutPoint (BSV v2.1.0) View Source

An OutPoint is a data structure representing a reference to a single BSV.TxOut.t/0.

An OutPoint consists of a 32 byte BSV.Tx.hash/0 and 4 byte BSV.TxOut.vout/0.

Conceptually, an OutPoint can be seen as an edge in a graph of Bitcoin transactions, linking inputs to previous outputs.

Link to this section Summary

Types

t()

OutPoint struct

Functions

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

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

Returns the BSV.Tx.txid/0 from the OutPoint.

Checks if the given OutPoint is a null.

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

Link to this section Types

Specs

t() :: %BSV.OutPoint{hash: BSV.Tx.hash(), vout: BSV.TxOut.vout()}

OutPoint struct

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.OutPoint.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.OutPoint.t/0.

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

Specs

get_txid(t()) :: BSV.Tx.txid()

Returns the BSV.Tx.txid/0 from the OutPoint.

Specs

is_null?(t()) :: boolean()

Checks if the given OutPoint is a null.

The first transaction in a block is used to distrbute the block reward to miners. These transactions (known as Coinbase transactions) do not spend a previous output, and thus the OutPoint is null.

Link to this function

to_binary(outpoint, opts \\ [])

View Source

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

Options

The accepted options are:

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