BSV-ex v0.3.0 BSV.Transaction.Input View Source
Module for parsing and serialising transaction inputs.
Link to this section Summary
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.
Gets whether this is a null input (coinbase transaction input).
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
t()
View Sourcet() :: %BSV.Transaction.Input{ output_index: integer(), output_txid: String.t(), script: binary(), sequence: integer(), utxo: BSV.Transaction.Output.t() | nil }
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.
Gets whether this is a null input (coinbase transaction input).
Examples
iex> {%BSV.Transaction{inputs: [coinbase_input]}, ""} = BSV.Transaction.parse("01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac00000000", encoding: :hex) iex> BSV.Transaction.Input.is_null(coinbase_input) true
iex> {%BSV.Transaction{inputs: [input]}, ""} = BSV.Transaction.parse("0100000001ae13d3386c0541b9f8528c7f215713e94c52279318090a95e39e5b123360ee48110000006a47304402206d0cf8f9ac8cadcb5061072ff28ca434620bbb0d442f9578d560e840a9cce90a022023aaae374be08838cb42cafd35459f140c6b440db45e6ecc007d9d5d95c89d504121036ce3ac90505e8ca49c0f43d5db1ebf67dc502d79518db2ab54e86947ab1c91fefeffffff01a0aae219020000001976a914ab1cad2d09eedfb15794cc01edc2141b7ccc587388ac77d50900", encoding: :hex) iex> BSV.Transaction.Input.is_null(input) false
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{}, ""}
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>>