Ethereum Algorithm Explained
Ethereum is a blockchain-based open technology platform that enables individuals to develop and launch decentralized applications (also known as dapps). This is made possible due to the smart contract functionality that the Ethereum platform possesses. The native asset for the Ethereum blockchain is ether, which functions as a fee every time a computation is made on the Ethereum network. Ether also plays an important role in Ethereum’s proof of work mining process, serving as a financial incentive mechanism that encourages miners to secure the network. Underpinning Ethereum is the Ethereum algorithm for proof of work mining, which is the Ethash hashing algorithm.
Proof of Work
The Ethereum blockchain is maintained by a distributed network of nodes, and in order for a node to add a block to the blockchain, it must undergo Ethereum’s proof of work mining process. This process requires a miner to retrieve data from a block header to form an input, and then repeatedly hash that input using a cryptographic hashing algorithm until an output hash value of a fixed length is produced. Miners hash variations of the input data by including a nonce. The nonce is an arbitrary number that varies the input data such that the correct output that allows the miner to add a new block to the blockchain can be found. The Ethereum algorithm, Ethash, is the hashing algorithm that is used in this proof of work mining process.
Ethereum Algorithm: Ethash
Ethash is Ethereum’s proof of work algorithm that is an altered version of the previous proof of work algorithm, Dagger-Hashimoto. The fixed output that is produced during the hashing process, in order for a node to add a block to the Ethereum blockchain, must be a value that is below a certain threshold. This is known as network difficulty and it involves the automatic increasing or decreasing of this threshold. The network difficulty functionality exists so that the rate at which blocks are mined on the Ethereum network can be controlled. If miners are producing a lot of hash values that fall below the threshold set by the network (meaning that a lot of blocks are being mined), then the network will increase the network difficulty i.e. the threshold will be lowered. This means that the number of legitimate hash values capable of being discovered also falls. Oppositely, if the rate of blocks being found on the network decreases, then the network threshold will rise to generate a higher number of valid hashes that can be found. In the case of the Ethereum algorithm, the network difficulty is dynamically adjusted so that one block is on average generated every 12 seconds.
A miner participating in the mining process, who successfully discovers a block is entitled to the following:
- A block reward of 3 ether.
- All of the gas that was consumed when executing all of the transactions within the block.
- An additional reward for including uncles as part of the block. Miners that include uncles in a block receive 2.625 ether.
Ethash ASIC Resistance
Ethash is premised on a randomly generated data set that is called the DAG, which stands for Directed Acyclic Graph. Ethereum’s DAG is updated every 30,000 blocks on the blockchain. The DAG size of Ethereum, at the time of writing, is currently 2.91 GB. This figure will continue to grow as the size of the Ethereum blockchain increases.
Proof of working mining on the Ethereum algorithm, Ethash, requires retrieving pieces of random data from the DAG, hashing randomly selected transactions from any block on the blockchain, and then returning the result from the hashing process. Thus, in order for an individual to mine on Ethereum, they will have to store the entire DAG for the purposes of being able to fetch data and compute selected transactions. This setup of mining on Ethereum is ‘memory-hard’, and memory-hard is a term that refers to a situation wherein the time taken to carry out a computation is largely based on the amount of memory required to hold the data.
The result of the Ethereum mining structure is that a miner spends more time reading the DAG, as opposed to executing computations that are fetched from it. This is an intentional design architecture that is aimed at making mining on Ethereum ASIC (application-specific integrated circuit) resistant. The requirement of having to hold a large amount of memory during the mining process means that entities such as mining farms gain little benefit from loading terabytes of memory into their mining devices. Large-scale miners receive little benefit from doing this because smaller miners can similarly also purchase terabytes of memory, as the energy cost of memory taken on by a large-scale miner and a smaller miner is comparable.