0

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.

4
  • what is your system ? A Pi ? On my system, it is few minutes
    – Ellis
    Jul 5, 2016 at 17:55
  • @Ellis It's Ubuntu VM with 3GB memory.
    – galahad
    Jul 5, 2016 at 17:57
  • A vm in the cloud? Or a vm on your device which is not used? A vm is not done to compute; and DAG is a big computation which use GB to prevent ASICs usage.
    – Ellis
    Jul 5, 2016 at 18:01
  • The VM is hosted on my windows laptop. DAG for epoch 0 was successfully generated within this VM with the same 3GB of RAM.
    – galahad
    Jul 5, 2016 at 18:04

2 Answers 2

2

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.

0

You could probably optimize the DAG generation but why ? This computation could be precomputed before usage and you could copy it on other computers. The idea is to prevent ASICs mining like bitcoin, so we generate a big dataset and use it to in the Proof of Work Algorithm. In a produc†ion (private or public) blockchain, it is not good idea to use VM to mine (not safe). Your real problem is more that it uses too much memory ? So generate it, on your desktop and copy the .ethhash directory.

Loot at this page: The DAG is a DataSet of 1BG + .5GB per year: https://github.com/ethereum/wiki/blob/master/Dagger-Hashimoto.md

1
  • Why is it not safe to mine in a VM?
    – galahad
    Jul 6, 2016 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.