[Ethereum] Faster way to generate DAG

dagepochprivate-blockchain

From the Ethereum official documentation:

The DAG is totally different every 30000 blocks (a 100 hour window, called an epoch) and takes a while to generate. Since the DAG only depends on block height, it can be pregenerated but if its not, the client need to wait the end of this process to produce a block. Until clients actually precache dags ahead of time the network may experience a massive block delay on each epoch transition.

It's mentioned that DAG takes a while to generate. What are the factors effecting this generation time? Is there any faster way to generate DAG? Also, what kind of discrepancies will be observed during this epoch transition in case if the DAGs are not pre-cached.

P.S: In my case (private blockchain), the ethereum node crashed while generating DAG for epoch 1 due to:

panic: ethash_full_new IO or memory error

I'm running geth on an Ubuntu (16.04) Virtual Machine with 3GB RAM.

Best Answer

Speeding up

There is no way you can speed up the DAG creation except:

  1. Dedicate mote processing power CPU
  2. Dedicate more GPU.

What if you could optimise,

Well, you can actually propose it as a Ethereum Improvement Proposal - EIP

What is DAG?

Dagger Hashimoto is a proposed spec for the mining algorithm for Ethereum 1.0. Dagger Hashimoto aims to simultaneously satisfy two goals:

  • ASIC-resistance: the benefit from creating specialized hardware for the algorithm should be as small as possible, ideally to the point that even in an economy where ASICs have been developed the speedup is sufficiently small that it is still marginally profitable for users on ordinary computers to mine with spare CPU power.
  • Light client verifiability: a block should be relatively efficiently verifiable by a light client.

That being said, the main purpose of DAG is to verify the work; so called PoW(Proof of Work). Means other nodes verifies your block with the PoW that you have done that is the DAG.

The 1 GB DAG size was chosen in order to require a level of memory larger than the size at which most specialized memories and caches are built, but still small enough for ordinary computers to be able to mine with it. For more info, check Ethash Design Rationale.

Related Topic