BSV.Block (BSV v2.1.0) View Source
A block is a data structure consisting of a BSV.BlockHeader.t/0
and a list
of transactions
.
Transaction data is permanently recorded into blocks. Because each block contains a reference to the previous block, over time blocks form a chain.
Link to this section Summary
Types
Merkle root - the result of hashing all of the transactions contained in the block into a tree-like structure known as a Merkle tree.
Block struct
Functions
Calculates and returns the result of hashing all of the transactions contained in the block into a tree-like structure known as a Merkle tree.
Parses the given binary into a BSV.Block.t/0
.
Parses the given binary into a BSV.Block.t/0
.
Serialises the given BSV.Block.t/0
into a binary.
Calculates the BSV.Block.merkle_root/0
of the given block and compares the
result to the value contained the BSV.BlockHeader.t/0
.
Link to this section Types
Specs
merkle_root() :: <<_::256>>
Merkle root - the result of hashing all of the transactions contained in the block into a tree-like structure known as a Merkle tree.
Specs
t() :: %BSV.Block{header: BSV.BlockHeader.t(), txns: [BSV.Tx.t()]}
Block struct
Link to this section Functions
Specs
calc_merkle_root(t()) :: merkle_root()
Calculates and returns the result of hashing all of the transactions contained in the block into a tree-like structure known as a Merkle tree.
Specs
Parses the given binary into a BSV.Block.t/0
.
Returns the result in an :ok
/ :error
tuple pair.
Options
The accepted options are:
:encoding
- Optionally decode the binary with either the:base64
or:hex
encoding scheme.
Specs
Parses the given binary into a BSV.Block.t/0
.
As from_binary/2
but returns the result or raises an exception.
Serialises the given BSV.Block.t/0
into a binary.
Options
The accepted options are:
:encoding
- Optionally encode the binary with either the:base64
or:hex
encoding scheme.
Specs
Calculates the BSV.Block.merkle_root/0
of the given block and compares the
result to the value contained the BSV.BlockHeader.t/0
.