View Source BitcoinLib.Transaction.OutputList (BitcoinLib v0.4.7)
Tasks applied to a list of outputs
Link to this section Summary
Functions
Extracts a given number of outputs from a bitstring
Link to this section Functions
@spec extract(bitstring(), integer()) :: {:ok, [BitcoinLib.Transaction.Output.t()], bitstring()} | {:error, binary()}
Extracts a given number of outputs from a bitstring
examples
Examples
iex> output_count = 1
...> <<0xf0ca052a010000001976a914cbc20a7664f2f69e5355aa427045bc15e7c6c77288ac00000000::304>>
...> |> BitcoinLib.Transaction.OutputList.extract(output_count)
{
:ok,
[
%BitcoinLib.Transaction.Output{
value: 4999990000,
script_pub_key: [
%BitcoinLib.Script.Opcodes.Stack.Dup{},
%BitcoinLib.Script.Opcodes.Crypto.Hash160{},
%BitcoinLib.Script.Opcodes.Data{value: <<0xcbc20a7664f2f69e5355aa427045bc15e7c6c772::160>>},
%BitcoinLib.Script.Opcodes.BitwiseLogic.EqualVerify{},
%BitcoinLib.Script.Opcodes.Crypto.CheckSig{script: <<0x76a914cbc20a7664f2f69e5355aa427045bc15e7c6c77288ac::200>>}
]
}
],
<<0, 0, 0, 0>>
}