Miner
Details on the Miner, the block generator and consensus participant
Last updated
Details on the Miner, the block generator and consensus participant
Last updated
Miners are the main providers that maintain the blockchain and implement the consensus protocol.
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".
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
Workers responsible for generating blocks, handling block messages, verifying blocks, voting in the consensus, ...
Workers responsible for finalizing blocks and updating the MPT state by executing the transactions.
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.
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 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.
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:
Latest unfinalized transaction (Transaction Pool): Transactions that are not still in a finalized block are stored in a separate Redis container for faster access.
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.
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.
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.