[Ethereum] How does Ethash work

ethashethereum-classichash-algorithm

I've looked at the wiki in search of how the information about Ethash algorithm but I did not find the answer.

Where can I find detailed information about it or can someone explain it?

Best Answer

The general route that the algorithm takes is as follows:

  1. There exists a seed which can be computed for each block by scanning through the block headers up until that point.
  2. From the seed, one can compute a 16 MB pseudorandom cache. Light clients store the cache.
  3. From the cache, we can generate a 1 GB dataset, with the property that each item in the dataset depends on only a small number of items from the cache. Full clients and miners store the dataset. The dataset grows linearly with time.
  4. Mining involves grabbing random slices of the dataset and hashing them together. Verification can be done with low memory by using the cache to regenerate the specific pieces of the dataset that you need, so you only need to store the cache.

    The large dataset is updated once every 30000 blocks, so the vast majority of a miner's effort will be reading the dataset, not making changes to it.

See Ethash-Design-Rationale for design rationale considerations for this algorithm.


More sources:

Page number 15 of Yellow Paper.

Ethash in Ethereum wiki on github.