All about the Ethash algorithm

Qué es Ethash
6 min read

In any conversation about Ethereum you may have heard about Ethash. This is the algorithm that makes Ethereum possible. That algorithm makes use of very advanced computing techniques that increase the level of security on the network.

Another way to call this algorithm is by the name Ethash-Dagger-Hashimoto. This was the name it adopted when it was created, however it has changed and evolved a lot since then. In this article we will see what it offers and how it works.

Although its full name is Ethash-Dagger-Hashimoto, we should note that Dagger-Hashimoto refers to the mining algorithm that served as the basis for the creation of the current Ethash. That algorithm was aimed at creating a secure mechanism based on the resistance to ASIC mining and the efficiency it brings by being highly verifiable by thin clients.

 

Origin of Ethash

The creators of this algorithm are Vitalik Buterin and Thaddeus Dryja. Both developed this system between 2013 and 2014. This algorithm is based on two different algorithms, hence its compound name. The first, Dragger, is an algorithm developed by the same creator of Ethereum, Buterin. This algorithm makes use of directed acyclic graphs (DAG) in order to create a massive data structure.

At the beginning of its development, the structure of the algorithm occupied a space of approximately 1 Gb in storage, however, over the years its storage has been extended up to 4 Gb or 5 Gb. The structure of this algorithm allows the operation of the Hashimoto mining process, the algorithm we will talk about next.

Hashimoto is the second base algorithm of Ethash developed by Thaddeus Dryja with the aim of being able to add ASIC resilience to the system in which it is implemented, and also to carry out hash mining. All this is possible because the algorithm itself increases the RAM consumption and thus limits the ASICs.

 

From the union of the two algorithms comes another unique algorithm that offers the ability to design a new mining system so complex that ASIC miners cannot implement it effectively. In fact, its structure is so advanced that many developers are trying to implement it as an alternative option to Scrypt. However, Dragger-Hashimoto was not always what it is today. Like everything else, it presented several flaws that turned it into the current algorithm. Below we will see how it works.

Qué-es-Ethash

How does Ethash work?

The operation of Ethash is completely different from the basic operation of the algorithm on which it is based, Dragger-Hashimoto. However, there are some fundamental features that remain in place.

As the start of the algorithm, it creates a seed calculated through the block headers until the start of mining. Subsequently, the previous seed is used to compute and create a pseudo random cache with an exact size of 16 MB. Once created, this is used to create a data set that occupies more than 4 GB. This data is what we call “DAG“.

The DAG is updated every 30 thousand blocks varying for each mining season. The mining process starts with the creation of the DAG. During mining, random values are taken from the DAG and these are combined with data provided by the network and the rest of the transactions to be verified. For the final phase, verification is performed through a process that generates certain parts of the previous data set using the cache memory to accelerate the process.

To reach the current performance, Ethash has gone through 23 versions of its algorithm. However, there are aspects that have not changed, such as the use of the Keccak-256 and Keccak-512 functions. These are the algorithm from which what we know today as the SHA-3 standard was derived.

It is possible that when we see such a high number of updates, we may think that the developers are not satisfied or that the project is incomplete. However, each update corresponds to a solution of problems that the algorithm may present. The updates were carried out to improve, secure and fix the algorithm, but above all, to increase the difficulty of implementation in ASIC. In this way, an increasingly GPU friendly algorithm was created.

Qué-es-Ethash

Advantages and disadvantages

Like any computer system, Ethash has advantages and disadvantages that differentiate it from other algorithms. Below we will see the most important ones:

Advantages:

  • Easy to implement. Ethash is a simple, secure and above all practical algorithm. 
  • Speed. By using the DAG structure in memory in addition to the Keccak function and the use of cache, Ethash becomes one of the most efficient algorithms in terms of block production. Thanks to this, the Ethereum network uses a block production time adaptable to the requirements of the network. 
  • Verification capacity. One of the advantages over other algorithms is that with only 16 MB of RAM we can create a thin client with the ability to verify transactions quickly and easily. Such a client could carry out the verification process in as little as 30 seconds.

Disadvantages:

  • ASIC resistance. One of the advantages of Ethash was broken in 2018 due to the miner created by Bitmain that mined with Ethash. 
  • Excessive memory consumption. This makes it difficult to mine on computers with lower capacity. Its excessive consumption comes from its operation highly dependent on RAM operations that consume large amounts of bandwidth. Although it is a protective measure against ASICs, it is also necessary to maintain proper system operation. Thanks to the cache, more efficient mining can be performed using the space for performing calculations. 
  • The difficulty of this algorithm is so scalable that it causes high mining difficulty for Ethereum network miners thus risking the security of its blockchain.