View Source Bitcoinex.Transaction.Utils (bitcoinex v0.3.0)
Utilities for when dealing with transaction objects.
Link to this section Summary
Functions
Returns the Variable Length Integer used in serialization.
Returns the serialized Bitcoin CompactSize (variable-length) unsigned integer.
Link to this section Functions
@spec get_counter(binary()) :: {non_neg_integer(), binary()}
Returns the Variable Length Integer used in serialization.
Reference: https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer
@spec serialize(Bitcoinex.Transaction.t()) :: binary()
Returns the serialized Bitcoin CompactSize (variable-length) unsigned integer.
CompactSize is defined over the full unsigned 64-bit range: values up to
0xFC are a single byte, then 0xFD/0xFE/0xFF prefix a little-endian
2-/4-/8-byte value. The 8-byte form is a real part of the encoding (it is the
inverse of get_counter/1), so this function must handle values up to
0xFFFFFFFFFFFFFFFF even though the counts bitcoinex serializes in practice
(input/output/witness counts, script and value lengths) never approach it.