0.0311 s - время 17 - запросов

We use cookies in order to improve your experience while using our website. If you continue to use our site, you accept our Cookies Policy, revised Privacy Policy and updated Terms of Use.

BTC $ 3635.64251904 (-2.09 %)
XRP $ 0.3269727236 (-2.42 %)
ETH $ 121.816068351 (-6.07 %)
BCH $ 128.649767135 (-3.83 %)
EOS $ 2.4096301533 (-2.55 %)
XLM $ 0.1063461789 (-2.87 %)
USDT $ 1.0199560967 (-0.14 %)
LTC $ 31.3825437928 (-3.58 %)
TRX $ 0.0244674868 (-5.61 %)
BSV $ 77.2854066525 (-3.82 %)

Ethereum Hashing Implementation Called Ethash

20:45 10/01/2019

Introduction

 

Compared to Bitcoin, Ethereum has many new features. Also, plenty of properties inherited from Bitcoin have been improved. Some of them were partially modified (for example, addresses), while others (such as hashing algorithms) were completely replaced.

 

As for hashing, Bitcoin still uses the SHA256 method, while Ethereum has implemented the Keccak and Ethash algorithms. The target areas for these two methods are address compression, block connection, and mining.

 

Keccak and Ethash

 

Since the Keccak and Ethash algorithms have different properties, they are used in different processes. The main hash algorithm in Ethereum is called Keccak, which works like a “sponge”: it gathers data and spreads the result basing on all previously used processed data units. This brings up significant flexibility and may be considered as pseudorandomness. Keccak is used in many areas, except for mining.

 

Some Ethash details

 

Ethash is used for mining purposes only. Such an approach was chosen for the following reasons:

 

 Mining algorithm is supposed to be ASIC-resistant. In order to achieve this goal, the algorithm was designed to use maximum memory.

 Mining algorithm should be friendly to GPU-devices. Unfortunately, CPU can’t be used as the main target but GPU implementation is a fairly balanced solution.

 New blocks should be quickly verified on light clients (also known as lightweight nodes).

 New blocks should be slowly processed on light clients.

 Light clients should be able to start working as soon as possible.

 

Overall, the Ethash algorithm consists of the following steps:

 

  1. Scanning blocks' headers allows to get a seed.
  2. Once the seed is found, it becomes a source of 15 MB pseudorandom cache. It is stored by light clients as well.
  3. Cash is a source of 1 GB data. It consists of many chunks, each of them depends on a part of cache. This data is stored by miners and full clients only.
  4. Random data units are taken and processed with hash for mining. If necessarily, one can store cache only and generate hashes instantly.

 

The Ethash algorithm is a reworked Dagger-Hashimoto method. It was revised at least 23 times. The block number defines the cache size and calculated data volume. Still, their growth rate is linear. Applied data aggregation uses a FNV-based function instead of the common logical operator XOR. It has two main differences. First, it is not cryptographic. It was intended to be used for checksum verifications and fast hash table construction.  As a consequence, it is much faster to calculate. Second, it is implemented with ease.

More details on each step of cache, main dataset, mining calculations and others are presented and explained on the correspondent web page. Some calculations are implemented with the help of Recursive Length Prefix, the main encoding method for Ethereum objects serialization.

 

Afterword

 

Ethereum is a very interesting solution. Most of other crypto projects proposed to public were just copies of Bitcoin with minor changes in the code. Ethereum instead offers a new approach to many of crypto components. Here, we have looked at one of two hashing methods in detail, but there are many other features worth mentioning. We will talk about them in the following articles.

Found a mistake? Highlight it and press Ctrl + Enter to notify the administrator.

Up-to-date Blockchain and cryptocurrency news. Be the first to know!

What is it for?