View Source BitcoinLib.Signing.Psbt.CompactInteger (BitcoinLib v0.4.1)

Extracts a variable length integer from a binary

based on https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer

Link to this section Summary

Functions

Encodes an integer according to the spec linked to in the moduledoc

Extracts a variable length integer from a bitstring according to the spec linked in the moduledoc, returns a tuple containing the integer with the remaining of the bitstring

Link to this section Functions

Link to this function

encode(value, endianness \\ :little_endian)

View Source
@spec encode(integer(), :big_endian | :little_endian) :: bitstring()

Encodes an integer according to the spec linked to in the moduledoc

Link to this function

extract_from(data, endianness \\ :little_endian)

View Source
@spec extract_from(bitstring(), :big_endian | :little_endian) ::
  %BitcoinLib.Signing.Psbt.CompactInteger{
    remaining: term(),
    size: term(),
    value: term()
  }

Extracts a variable length integer from a bitstring according to the spec linked in the moduledoc, returns a tuple containing the integer with the remaining of the bitstring