Mini Block Production
Similar to traditional blockchain building, mini blocks are used to ensure data integrity and achieve consensus for the ordering of valid events in a given stream. The following is a detailed description of each step in the process:-
Election of Responsible Node: A responsible node is elected to construct the mini block. This election is based on the block number and incorporates an element of randomness, utilizing
randdao
. - Initiation of Voting Process: The elected leader initiates a voting process. In this stage, each participating node contributes by sending hashes of the events present in their mini-pool.
- Combination of Votes: The leader combines these votes and selects events that are present in the majority of the mini-pools.
- Authority of the Leader: The leader has the discretion to determine the order of events within the mini block.
- Formation of Mini Block: The events chosen are then combined to form the mini block.
- Mini Block Header Creation: A header for the mini block is generated and subsequently signed by the responsible node.
- Integration into Towns Chain: This mini block header is then integrated into the Towns chain and disseminated to all participating nodes.
- Request for Missing Events: If a node does not possess all the events in the newly received mini block, it must proactively request these missing events from other participating nodes.
- Local Storage Update: Participating nodes update their local storage to reflect the new mini block. They also remove old mini-pools that were included in that mini block.
- Formation of New Mini-Pool: Events not included in the current mini block form the basis of a new mini-pool for the next generation.
- Event Effectuation at Block Boundaries: Certain events, such as joins and leaves, are only effectuated at block boundaries. This is to maintain consistent ordering across the network.