Elixium Core v0.6.3 Elixium.Validator View Source

Responsible for implementing the consensus rules to all blocks and transactions

Link to this section Summary

Functions

A block is considered valid if the index is greater than the index of the previous block, the previous_hash is equal to the hash of the previous block, and the hash of the block, when recalculated, is the same as what the listed block hash is

Checks if a transaction is valid. A transaction is considered valid if 1) all of its inputs are currently in our UTXO pool and 2) all addresses listed in the inputs have a corresponding signature in the sig set of the transaction. pool_check is a function which tests whether or not a given input is in a pool (this is mostly used in the case of a fork), and this function must return a boolean

Link to this section Functions

Link to this function correct_tx_id?(transaction) View Source
correct_tx_id?(Elixium.Transaction) ::
  :ok | {:error, {:invalid_tx_id, String.t(), String.t()}}
Link to this function is_block_valid?(block, difficulty, last_block \\ Ledger.last_block(), pool_check \\ &(Oracle.inquire(Elixium.Store.UtxoOracle, {:in_pool?, [&1]}))) View Source

A block is considered valid if the index is greater than the index of the previous block, the previous_hash is equal to the hash of the previous block, and the hash of the block, when recalculated, is the same as what the listed block hash is

Link to this function one_coinbase?(transactions) View Source
Link to this function passes_pool_check?(map, pool_check) View Source
passes_pool_check?(Elixium.Transaction, function()) ::
  :ok | {:error, :failed_pool_check}
Link to this function utxo_amount_integer?(transaction) View Source
utxo_amount_integer?(Elixium.Transaction) ::
  :ok | {:error, :utxo_amount_not_integer}
Link to this function valid_coinbase?(map) View Source
valid_coinbase?(Elixium.Block) ::
  :ok | {:error, :no_coinbase} | {:error, :too_many_coinbase}
Link to this function valid_transaction?(transaction, pool_check \\ &(Oracle.inquire(Elixium.Store.UtxoOracle, {:in_pool?, [&1]}))) View Source
valid_transaction?(Elixium.Transaction, function()) :: :ok | {:error, any()}

Checks if a transaction is valid. A transaction is considered valid if 1) all of its inputs are currently in our UTXO pool and 2) all addresses listed in the inputs have a corresponding signature in the sig set of the transaction. pool_check is a function which tests whether or not a given input is in a pool (this is mostly used in the case of a fork), and this function must return a boolean.

Link to this function valid_transactions?(map, pool_check \\ &(Oracle.inquire(Elixium.Store.UtxoOracle, {:in_pool?, [&1]}))) View Source
valid_transactions?(Elixium.Block, function()) ::
  :ok | {:error, {:invalid_transactions, list()}}