Minimal RLP (Recursive Length Prefix) encoder — Ethereum's serialization, used
here to assemble EIP-1559 (type-2) transactions for Hedera's EthereumTransaction.
Items are integers (encoded as their minimal big-endian byte string; 0 → the
empty string), binaries (raw byte strings), or (nested) lists of items.
Summary
Functions
RLP-encode an item: an integer, a binary, or a (nested) list.
The minimal big-endian byte string of a non-negative integer (0 → <<>>).
Functions
RLP-encode an item: an integer, a binary, or a (nested) list.
Examples
iex> Hedera.Rlp.encode("dog")
<<0x83, ?d, ?o, ?g>>
iex> Hedera.Rlp.encode(1024)
<<0x82, 0x04, 0x00>>
iex> Hedera.Rlp.encode(0)
<<0x80>>
iex> Hedera.Rlp.encode(["cat", "dog"])
<<0xC8, 0x83, ?c, ?a, ?t, 0x83, ?d, ?o, ?g>>
@spec int_to_bin(non_neg_integer()) :: binary()
The minimal big-endian byte string of a non-negative integer (0 → <<>>).