BSV-ex v0.2.5 BSV.Transaction.Output View Source

Module for parsing and serialising transaction outputs.

Link to this section Summary

Types

t()

Transaction output

Functions

Returns the size of the given output. If the output has a script, it's actual size is calculated, otherwise a P2PKH output is estimated.

Parse the given binary into a single transaction output. Returns a tuple containing the transaction output and the remaining binary data.

Serialises the given transaction output struct into a binary.

Link to this section Types

Link to this type

t()

View Source
t() :: %BSV.Transaction.Output{satoshis: integer(), script: binary()}

Transaction output

Link to this section Functions

Link to this function

get_size(tx)

View Source
get_size(t()) :: integer()

Returns the size of the given output. If the output has a script, it's actual size is calculated, otherwise a P2PKH output is estimated.

Link to this function

parse(data, options \\ [])

View Source
parse(binary(), keyword()) :: {t(), binary()}

Parse the given binary into a single transaction output. Returns a tuple containing the transaction output and the remaining binary data.

Options

The accepted options are:

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

Examples

BSV.Transaction.Output.parse(data)
{%BSV.Trasaction.Output{}, ""}
Link to this function

serialize(output, options \\ [])

View Source
serialize(t(), keyword()) :: binary()

Serialises the given transaction output struct into a binary.

Options

The accepted options are:

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

Examples

BSV.Transaction.Output.serialize(output)
<<binary>>