Block Commitment - Algorand Specifications
Keyboard shortcuts
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
- Auto
- Light
- Dark
Algorand Specifications
Block commitment is the process by which a valid block is added to the Ledger.
Important
IMPLEMENTATION:
Block commitment entry point in the reference implementation.
To support block commitment, verification, and assembly, the node uses a structure called BlockEvaluatorBlockEvaluator.
A BlockEvaluatorBlockEvaluator can:
- Evaluate transactions in a block body one by one,
- Add transactions to an in-progress
payset, - Track state changes caused by each transaction, and
- Determine if a block is invalid due to a transaction failing validation in the block’s context.
During the block assembly phase, the BlockEvaluatorBlockEvaluator can also discard invalid transactions and continue assembling the block with valid ones.
Important
IMPLEMENTATION:
Block Evaluator reference implementation.
Once a block has been certified, the Ledger is responsible for successfully adding it to the blockchain.
The process of adding a block follows this basic sequence:
ledger.AddValidatedBlockeval.Evalledger.AddBlockledger.AddValidatedBlockeval.Evalledger.AddBlockCalls Eval with Block and Agreement certificateState Delta updatesAdds the validated block with its certificate
Block evaluation takes place after its certificate has been computed. At this point, the Ledger validates the block, applies the resulting State Deltas to its internal state, and adds the block to the blockchain. Once these changes are successfully applied, the block is finalized and officially committed to the Ledger.
EnsureBlock
ledger.addBlock
Execute Eval to process the Block with its certificate
StartEvaluator
Fetch previous block and protocol params
Initialize Evaluator and Base State
Calculate updates for new Block
Apply updates to Ledger state
Finalize and commit Block to the Ledger
The StartEvaluator function sets up and returns a pending BlockEvaluatorBlockEvaluator, which will handle processing the block and updating the Ledger state. As part of its initialization, the BlockEvaluatorBlockEvaluator retrieves the previous block and the relevant protocol parameters to guarantee that the evaluation is consistent with the current blockchain state.
Important
IMPLEMENTATION:
Start Evaluator reference implementation.
The core interface of a BlockEvaluatorBlockEvaluator can be broken down into three primary functions:
- Block Construction:
This begins by calling StartEvaluator to create a new BlockEvaluatorBlockEvaluator instance. It then ingests a sequence of valid transactions from the transaction pool TxPoolrqTxPoolrq, tracking all resulting state changes. The block is finalized at the end of this process with the block proposer setup deferred to this final stage.
- Block Validation:
This function checks the validity of a given block. Internally, it reuses the same logic as the evaluation process to ensure consistency.
- Block Evaluation:
This function processes the block to generate a State Delta, which captures all the changes the block makes to the Ledger and its associated Trackers.
Important
IMPLEMENTATION:
Validate block reference implementation.