BSV-ex v0.2.2 BSV.Transaction.Input View Source

Module for parsing and serialising transaction inputs.

Link to this section Summary

Types

t()

Transaction input

Functions

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

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

Serialises the given transaction input struct into a binary.

Link to this section Types

Link to this type

t()

View Source
t() :: %BSV.Transaction.Input{
  output_index: integer(),
  output_txid: String.t(),
  script: binary(),
  sequence: integer(),
  utxo: BSV.Transaction.Output.t()
}

Transaction input

Link to this section Functions

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

Link to this function

parse(data, options \\ [])

View Source

Parse the given binary into a transaction input. Returns a tuple containing the transaction input 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.Input.parse(data)
{%BSV.Trasaction.Input{}, ""}
Link to this function

serialize(input, options \\ [])

View Source
serialize(BSV.Transaction.Input.t(), keyword()) :: binary()

Serialises the given transaction input 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.Input.serialize(input)
<<binary>>