Details on the Miner, the block generator and consensus participant

Miners are the main providers that maintain the blockchain and implement the consensus protocol.

Core responsibilities of the Miner

  • Generation of blocks to extend the blockchain so that the network rounds keep progressing.

  • Participation in the consensus algorithm, verifying the generated blocks by other participants.

  • Mutation of the in-memory version of the network data model. Since this in-memory version is stored in a Merkle-Patricia Tree data structure, we usually just call it "The MPT".

Logical components of the Miner Process

The Miner Process consists of multiple workers (technically, lightweight execution threads or goroutines in the Go literature). Following are the most important workers running the miner operations

Block Generation/Verification Workers

Workers responsible for generating blocks, handling block messages, verifying blocks, voting in the consensus, ...

Block Finalization Workers

Workers responsible for finalizing blocks and updating the MPT state by executing the transactions.

Communication Workers (handlers)

Those are handlers of Node-to-Node (N2N) communication endpoint among miners and sharders. Those are responsible for sending/receiving different kinds of messages to and from the miner.

Health check worker

A worker responsible for the heartbeats of the miner which are signs of the miner liveness. It works by generating a health check transaction periodically and communicate it with the other Active Set providers.

The Miner HTTP API

The miner exposes a minimal API with a couple of endpoints to view its diagnostics and health check, as well as an endpoint to submit transactions. These will be discussed in details in the Miner API page.

Data stored by the Miner

The Miner is not supposed to store the whole blockchain, as this is the job of the Sharder. However, the Miner still needs to store some data for fast-access. For this data, the Miner uses 2 main storage solutions: Redis and Rocksdb. The miner stores the following data:

  1. Latest unfinalized transaction (Transaction Pool): Transactions that are not still in a finalized block are stored in a separate Redis container for faster access.

  2. The MPT: Based on the tree structure of the MPT, the miner uses rocksdb to store it as rocksdb is built on top of LevelDB which is efficient for tree-like data structure.

  3. Some data about the blockchain: Stores some recent blocks, the Latest Finalized Magic Block along with some other entities representing the chain for fast access.

Requirements libraries for the Miner process environment

The Miner process requires the following libraries to exist in any environment it runs on:

  • Rocksdb: It's the embedded in-memory key-value store used by the Miner to store the MPT.

  • BLS and MCL: Two libraries used for cryptographic tasks.

Last updated