ExPlasma.Block (ExPlasma v0.3.0)
Encapsulates the block data we receive from the contract. It returns two things:
- hash - The merkle root block hash of the plasma blocks.
- transactions - the list of Transactions associated with this given block
Link to this section Summary
Functions
Generate a new Block
from a list of transactions
Link to this section Types
Specs
t() :: %ExPlasma.Block{hash: binary(), transactions: maybe_improper_list()}
Link to this section Functions
Link to this function
new(transactions)
Specs
new(maybe_improper_list()) :: t()
Generate a new Block
from a list of transactions
Example
iex> %ExPlasma.Transaction{tx_type: 1} |> List.wrap() |> ExPlasma.Block.new()
%ExPlasma.Block{
hash: <<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>>,
transactions: [
%ExPlasma.Transaction{
sigs: [],
witnesses: [],
inputs: [],
metadata: <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>,
outputs: [],
tx_data: 0,
tx_type: 1
}
]
}