View Source BitcoinLib.Transaction.Spec.Output (BitcoinLib v0.4.3)

A simplified version of a %BitcoinLib.Transaction.Output that can be filled with human readable formats

Link to this section Summary

Functions

Converts a human readable output into a %Transaction.Output{}

Link to this section Functions

Link to this function

to_transaction_output(output)

View Source
@spec to_transaction_output(%BitcoinLib.Transaction.Spec.Output{
  script_pub_key: term(),
  value: term()
}) ::
  %BitcoinLib.Transaction.Output{
    error_message: term(),
    invalid_script: term(),
    script_pub_key: term(),
    value: term()
  }

Converts a human readable output into a %Transaction.Output{}

examples

Examples

iex> %BitcoinLib.Transaction.Spec.Output{
...>   script_pub_key: BitcoinLib.Script.Types.P2pkh.create(<<0xfc8ca28ea75e45f538242c257e1f07fe19baa0f3::160>>),
...>   value: 1000
...> }
...> |> BitcoinLib.Transaction.Spec.Output.to_transaction_output()
%BitcoinLib.Transaction.Output{
  script_pub_key: [
    %BitcoinLib.Script.Opcodes.Stack.Dup{},
    %BitcoinLib.Script.Opcodes.Crypto.Hash160{},
    %BitcoinLib.Script.Opcodes.Data{value: <<0xfc8ca28ea75e45f538242c257e1f07fe19baa0f3::160>>},
    %BitcoinLib.Script.Opcodes.BitwiseLogic.EqualVerify{},
    %BitcoinLib.Script.Opcodes.Crypto.CheckSig{script: <<0x76a914fc8ca28ea75e45f538242c257e1f07fe19baa0f388ac::200>>}
  ],
  value: 1000
}