Blockchain - Ethereum Miner Nodes


The ethereum network comprises various types of nodes. Some function solely as wallets, while others serve as light clients, and a select few operate as full clients that maintain the entire blockchain.

Among these, mining nodes are particularly significant. Mining refers to the method through which new blocks are chosen through a consensus mechanism and subsequently added to the blockchain.

Through the mining process, miners receive currency (ether) as a reward for their efforts. These mining nodes, referred to as miners, are compensated in ether to encourage them to validate and authenticate blocks that consist of transactions. This mining activity plays a crucial role in securing the network by ensuring the accuracy of computations.

Functions of Miner Node

A miner node carries out several key functions −

  • It monitors the transactions that are broadcast across the Ethereum network and selects which transactions to process.
  • It identifies stale ommer blocks and incorporates them into the blockchain.
  • It updates the account balance to reflect the rewards obtained from successfully mining a block.
  • Ultimately, a valid state is calculated, and the block is finalized, representing the outcome of all state transitions.

The current mining approach utilizes Proof of Work (PoW), akin to that of Bitcoin. For a block to be considered valid, it must meet not only the general consistency criteria but also include the PoW corresponding to a specified difficulty level.

Casper of Ethereum

A new algorithm called Casper has been created to supplant the current Proof of Work (PoW) algorithm in Ethereum. This system operates on an economic protocol that mandates nodes to provide a security deposit prior to their ability to generate blocks.

Ethereum Casper

In this context, nodes are referred to as bonded validators, and the process of providing the security deposit is termed bonding.

Consensus Mechanism of Ethereum

Ethereum implements a streamlined version of this protocol, designating the chain with the highest computational investment as the definitive version.

Alternatively, one can identify the longest chain, as it reflects the substantial mining efforts expended.

The GHOST protocol was initially proposed to address challenges associated with rapid block generation, which often resulted in stale or orphaned blocks. In the GHOST framework, stale blocks, referred to as ommers, are incorporated into the calculations to determine the longest and heaviest chain of blocks.

Ethereum Consensus Mechanism

As the blockchain evolves with the addition of new blocks, governed by the consensus mechanism, it may occasionally experience a split, a phenomenon known as forking.

Forks of Ethereum

A fork in a blockchain refers to the division of the chain into two separate paths. This division can occur either deliberately or inadvertently. Typically, a hard fork arises from significant protocol upgrades, whereas an unintentional fork may result from software bugs.

Additionally, forks can be temporary, where the chain diverges until it identifies the longest and heaviest chain, ultimately leading to consistency. This temporary fork happens when two blocks are generated nearly simultaneously, causing the chain to split until it resolves to the dominant chain.

Ethash of Ethereum

Ethash refers to the proof-of-work (PoW) algorithm utilized by Ethereum. Initially introduced as the Dagger-Hashimoto algorithm, it has undergone significant changes since its original implementation, evolving into what is now recognized as Ethash.

Much like Bitcoin, the fundamental concept of mining involves discovering a nonce, which is a random number. When this nonce is combined with the block header and hashed, it produces a value that must be lower than the current network difficulty.

In the early days of Ethereum, the difficulty level was relatively low, allowing for profitable mining using CPUs and single GPUs.

Ethash DAG of Ethereum

Ethash is a memory-intensive algorithm, which poses challenges for implementation on specialized hardware. Similar to Bitcoin, where ASICs have been created leading to mining centralization, memory-hard proof-of-work algorithms serve as a countermeasure to this issue.

Ethereum employs Ethash to deter the development of ASICs for mining purposes. The nature of Ethash makes it impractical to create ASICs with extensive and rapid memory capabilities. This algorithm necessitates the selection of subsets from a fixed resource known as the Directed Acyclic Graph (DAG), which is determined by the nonce and block headers.

The DAG is a substantial dataset generated in a pseudo-random manner. It is represented as a matrix within the DAG file produced during the Ethereum mining process. The Ethash algorithm requires the DAG to be formatted as a two-dimensional array of 32-bit unsigned integers. Mining can only commence once the DAG has been fully generated during the initial startup of a mining node. This DAG serves as a seed for the Ethash algorithm. According to the current specifications, the epoch duration is set at 30,000 blocks, approximately equivalent to six days.

How Ethash Works?

The Ethash algorithm operates with the necessity of a DAG file. This file is created every epoch, which consists of 30,000 blocks. As the blockchain expands, the size of the DAG increases linearly.

Currently, the DAG size is approximately 3.5 GB (as of block 9325164) and is at epoch number 310.

The protocol functions in the following manner −

  • Initially, the header from the preceding block is combined with a 32-bit random nonce using the Keccak-256 hashing function.
  • This combination results in a 128-bit structure known as the mix.
  • The mix is responsible for determining which data will be retrieved from the DAG.
  • After the data is obtained from the DAG, it is "mixed" with the current mix to generate a new mix, which is then used to fetch additional data from the DAG.
  • Ultimately, the 64th mix undergoes a digest function to yield a 32-byte sequence.
  • This sequence is then compared against the difficulty target. If it falls below the target, the nonce is deemed valid, and the proof of work is successfully completed, resulting in the mining of the block.
  • If it does not meet the target, the algorithm will initiate the process again with a different nonce.