ExPlasma.Merkle (ExPlasma v0.2.0)

Encapsulates all the interactions with the MerkleTree library.

Link to this section Summary

Functions

Generate a Merkle Root hash for the given list of transactions in encoded byte form.

Link to this section Functions

Link to this function

proof(encoded_transactions, txindex)

Specs

proof([binary(), ...], non_neg_integer()) :: binary()
Link to this function

root_hash(encoded_transactions)

Specs

root_hash([binary(), ...]) :: binary()

Generate a Merkle Root hash for the given list of transactions in encoded byte form.

Examples

iex> txns = %ExPlasma.Transaction{tx_type: 1} |> ExPlasma.encode!(signed: false) |> List.wrap()
iex> ExPlasma.Merkle.root_hash(txns)
<<168, 54, 172, 201, 1, 212, 18, 167, 34, 57, 232, 89, 151, 225, 172, 150, 208,
  77, 194, 12, 174, 250, 146, 254, 93, 42, 28, 253, 203, 237, 247, 62>>