View Source BitcoinLib.Transaction.InputList (BitcoinLib v0.4.7)

Tasks applied to a list of inputs

Link to this section Summary

Functions

Extracts a given number of inputs from a bitstring

Link to this section Functions

Link to this function

extract(remaining, count)

View Source
@spec extract(bitstring(), integer()) ::
  {:ok, [BitcoinLib.Transaction.Input.t()], bitstring()} | {:error, binary()}

Extracts a given number of inputs from a bitstring

examples

Examples

iex> input_count = 1
...> <<0x7b1eabe0209b1fe794124575ef807057c77ada2138ae4fa8d6c4de0398a14f3f0000000000ffffffff01f0ca052a010000001976a914cbc20a7664f2f69e5355aa427045bc15e7c6c77288ac00000000::640>>
...> |> BitcoinLib.Transaction.InputList.extract(input_count)
{
  :ok,
  [
    %BitcoinLib.Transaction.Input{
      txid: "3f4fa19803dec4d6a84fae3821da7ac7577080ef75451294e71f9b20e0ab1e7b",
      vout: 0,
      script_sig: [],
      sequence: 4294967295}
  ],
  <<0x01f0ca052a010000001976a914cbc20a7664f2f69e5355aa427045bc15e7c6c77288ac00000000::312>>
}