We are sure that you are already familiar with the basic concepts that relate to cryptocurrency mining, including: proof-of-work algorithm, blocks, transaction fees, rewards, processing power, hash and more. All of these are relevant to the Ethereum network at the moment. But the blockchain also uses an algorithm that allows ordinary computers to mine blocks. It is a modified version of the Dagger-Hashimoto algorithm and is called Ethash.
Ethash is a hashing algorithm used in Ethereum-based blockchain currencies. It is the successor to Dagger Hashimoto, designed to be ASIC-resistant. The algorithm requires a large amount of memory, which prevents specialized ASIC hardware from being an effective solution for mining. Ethash is a Proof of Work hashing algorithm designed specifically for Ethereum (ETH).
Ethash is based on providing a large, temporary, randomly generated dataset that generates a DAG (part of the Dagger). It is designed for fast verification time hashing in a slow CPU-only environment, but provides significant mining acceleration with large amounts of memory with high bandwidth. Large memory requirements mean that large-scale miners get a relatively small superlinear advantage. The high bandwidth requirement means that acceleration from hoarding on many super-fast processors sharing the same memory gives little advantage over a single module. This is important in the sense that pool mining does not benefit the nodes doing the checking, which prevents centralization.
How the Ethash algorithm works
The mining algorithm stimulates competition for the fastest time to solve a block, known as the hashing speed. Specialized and very powerful computers known as integrated circuits (ASICs) have been designed specifically for bitcoin mining, pushing conventional CPU/graphic processor computers out of the game. With ASICs, the bulk of the hashing power is centralized in large setups. They have raised the complexity to a very high level, which means a lot of power and processing power is wasted.
To counter this, Ethereum developed the Ethash algorithm, which introduces memory hardness as the basis of competition for miners. This means that it is more important for a computer to have memory, not speed. This obviates the need to purchase competitive mining machines. If mining requires memory and a processor, then the best equipment to use is an ordinary computer, and therefore an ordinary PC with enough memory can compete on an equal footing with any other.
This memory requirement implies that large mining pools do not benefit from their huge number of ASICs sharing the same memory. This gives a small benefit to the pool's miners, thus contributing to greater decentralization.
The steps that the algorithm follows are as follows:
- There is an initial number that can be calculated for each block by scanning the block headers to that point.
- Initially, a 16 MB pseudo-random cache can be computed which stores small nodes.
- A 1GB dataset is generated from the cache with the property that each item in the dataset depends only on a small number of items from the cache. Full clients and miners store this dataset, which grows linearly over time.
- Mining involves collecting random pieces of a dataset and hashing them. Validation can be done with a small amount of memory, using the cache to regenerate certain necessary parts of the dataset.
The big data set is updated once every 30,000 blocks, so the vast majority of miners read the data rather than make changes to it.
Read more: What is a block in blockchain?
Ethash uses a DAG (oriented acyclic graph) to prove the algorithm works. It is generated for each epoch, that is, every 30,000 blocks (125 hours, about 5.2 days). It takes a long time to generate a DAG. If clients only generate it on demand, one can observe a long wait at each epoch transition before the first block of a new epoch is found. However, the DAG depends only on the block number, so it can and should be calculated in advance to avoid long waiting times at each transition. If miners do not cache packets in advance, the network may experience a huge delay at each epoch transition. Note that the DAG does not need to be generated for PoW checking, allowing for both low CPU utilization and low memory checking.
Wrapping up the review
Ethash, like many other technologies, first and foremost seeks to reduce the amount of processing power required for mining, as well as to reduce the risk of centralization. To a certain extent, it succeeds, given that most of the forks in Ethirium use Ethash as their primary algorithm. Considering the need for mining for the blockchain ecosystem to function, Ethash makes the process much more profitable and attractive.