Block Proposal - 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
The following is an abstracted pseudocode of the BlockProposal algorithm.
Algorithm 3: Block Proposal
1: function BlockProposal() 2: if p ≠ 0 then 3: ResynchronizationAttempt() 4: end if 5: for a ∈ A do 6: credentials ← Sortition(aI, r, p, proposal) 7: if credentials_j > 0 then 8: if p = 0 ∨ ∃s′ such that Bundle(r, p−1, s′, ⊥) ⊂ V then 9: (e, y) ← BlockAssembly(aI) 10: proposal ← Proposal(e, y, p, aI) 11: v ← Proposalvalue(proposal) 12: Broadcast(Vote(aI, r, p, proposal, v, credentials)) 13: Broadcast(proposal) 14: else 15: Broadcast(Vote(aI, r, p, proposal, v¯, credentials)) 16: if RetrieveProposal(v¯) ≠ ⊥ then 17: Broadcast(RetrieveProposal(v¯)) 18: end if 19: end if 20: end if 21: end for 22: end function
This algorithm is the first procedure executed when entering a new round, and upon starting any period where a reproposal is not possible.
Starting on Algorithm 3 - Line 2, the node attempts a resynchronization (described in the corresponding section), which has only effect on periods p > 0.
The algorithm loops over all the participating accounts (a ∈ A) registered on the node. This is a typical pattern in every main algorithm subroutine performing committee voting.
For each participating account, the sortition algorithm runs to check if said account is allowed to participate in the proposal.
If an account a is selected by sortition (because credentials_j = Sortition(aI, r, p, proposal)_j > 0), there are two options:
- If this is a proposal step (p = 0) or if the node has observed a bundle Bundle(r, p−1, s′, ⊥) (meaning there is no valid pinned value), then the node:
- Assembles a block (see the Ledger non-normative section for details on this process),
- Computes the proposal value for this block,
- Broadcast a proposal vote by the account a,
- Broadcasts the full block in a Proposal type message.
- Otherwise, a value v¯ has been pinned, supported by a bundle observed in period p−1, and on Algorithm 3 - Line 15 the node:
- Gets the pinned value,
- Assembles a vote Vote(aI, r, p, proposal, v¯, credentials),
- Broadcasts this vote,
- Broadcast the proposal for the pinned vote if it has already been observed.
Important IMPLEMENTATION: The reference implementation assembles a set of transactions and a block header independently of the proposer, in parallel with the proposer loop. This improves timing and guarantees the tight deadline constraints for the block proposal step.