bitcoin-elixir v0.0.1 Bitcoin.Block

Summary

Functions

Compute hash of the provided block, which is double sha256 of the serialized block header

Compute the root hash of the transactions merkle tree for the provided block

Returns sum of all transaction fees in the provided block message

Validate corectness of the block. Function checks if

Types

t_hash()
t_hash() :: Bitcoin.t_hash

Functions

Compute hash of the provided block, which is double sha256 of the serialized block header.

merkle_root(block)

Compute the root hash of the transactions merkle tree for the provided block.

total_fees(block)
total_fees(Bitcoin.Protocol.Messages.Block.t) :: number

Returns sum of all transaction fees in the provided block message

validate(block)
validate(Message.Block.t) :: :ok | {:error, term}

Validate corectness of the block. Function checks if:

  • parent block exists
  • merkle root hash matches with the calculated one
  • block hash below target
  • TODO target matches difficulty algorithm
  • has coinbase transaction
  • block reward is correct