0

I am trying to go to ground 0 in my Ethereum PoA network but my mining node is constantly generating some "DAG" forever. When I run it first time it didn't happen.

Why and how to avoid it?

What I did to reset to ground zero:

geth removedb
rm -rf .ethash .ethereum
rm -rf node1/geth node1/geth.ipc 

bootnode -nodekey boot.key -verbosity 9 -addr :30310
geth --datadir node1/ --syncmode 'full' --port 30311 --rpc --rpcaddr '$HOST' --rpcport 8501 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes 'enode://longnumber@127.0.0.1:30310' -unlock '0x$ACCOUT_ADDRESS' --password node1/password.txt --mine

Result, never ending DAG epoch generation:

INFO [03-05|18:00:40] Starting mining operation 
INFO [03-05|18:00:40] Commit new mining work                   number=1 txs=0 uncles=0 elapsed=326.442µs

INFO [03-05|18:04:05] Generating DAG in progress               epoch=0 percentage=27 elapsed=3m23.916s
INFO [03-05|18:04:12] Generating DAG in progress               epoch=0 percentage=28 elapsed=3m31.173s
INFO [03-05|18:04:19] Generating DAG in progress               epoch=0 percentage=29 elapsed=3m38.177s
INFO [03-05|18:04:26] Generating DAG in progress               epoch=0 percentage=30 elapsed=3m44.764s
INFO [03-05|18:04:33] Generating DAG in progress               epoch=0 percentage=31 elapsed=3m51.474s
INFO [03-05|18:04:40] Generating DAG in progress               epoch=0 percentage=32 elapsed=3m58.865s
INFO [03-05|18:04:47] Generating DAG in progress               epoch=0 percentage=33 elapsed=4m6.189s
INFO [03-05|18:04:54] Generating DAG in progress               epoch=0 percentage=34 elapsed=4m12.615s
INFO [03-05|18:05:01] Generating DAG in progress               epoch=0 percentage=35 elapsed=4m19.675s
INFO [03-05|18:05:09] Generating DAG in progress               epoch=0 percentage=36 elapsed=4m27.605s
INFO [03-05|18:05:16] Generating DAG in progress               epoch=0 percentage=37 elapsed=4m34.935s
2

When you mine the DAG is generated in the /home/<user>/.ethash directory.

It is better to keep your .ethash directory around between resets if you are constantly resetting your private blockchain.

The Ethash algorithm requires a new DAG every 30000 blocks. You can control how geth generates and stores old DAGs using some parameters from the command line.

--ethash.dagsinmem value    Number of recent ethash mining DAGs to keep in memory (1+GB each) (default: 1)
--ethash.dagsondisk value   Number of recent ethash mining DAGs to keep on disk (1+GB each) (default: 2)

Running several blockchains in the same computer may cause conflicts because they are on different block numbers and the DAG will not match an have to be regenerated.

You can specify its own directory to avoid conflicts --ethash.dagdir <DAG_DIRECTORY>.

| improve this answer | |
  • thx @Ismael for the answer. But if I have only one private network why this is an issue? Shouldn't I be able to just delete all the blockchain data from disk and the mining should start from block 0 right? Without the need of generating DAG. It even says before mining: "INFO [03-05|18:00:36] Loaded most recent local full block number=0". – Lukas Lukac Mar 5 '18 at 19:58
  • @EnchanterIO If you want to mine, you will have to generate the DAG. In theory you can mine without the DAG but it will be much slower. In any case it should be safe to keep your .ethash it only contains the DAG that only depends on the block number. – Ismael Mar 5 '18 at 20:52
  • all right. I will run it again for a long time and see if it actually finished eventually. One thing I forgot to mention what I realised reading Ethash documentation... my genesis block is configured for POA ""clique": { "period": 15, "epoch": 30000 }" ... which means the DAG generation should not happen as mentioned here: ethereum.stackexchange.com/questions/24955/… – Lukas Lukac Mar 5 '18 at 21:59
  • You didn't mention about being a PoA blockchain, I've never used a PoA so I can't say it doesn't need it. Perhaps you can edit your question and specify that detail, or create a new question about PoA and ethash. – Ismael Mar 5 '18 at 22:05
  • 1
    I think I found the way finally. I forgot to re-init the genesis block. Look at my answer if curious. Thx for help as well! – Lukas Lukac Mar 9 '18 at 21:49
1

@Isamel answer was helpful but as I forgot to mention I am using PoA engine, the final solution actually looks like:

rm -rf node1/geth

RE-INIT the genesis block (the missing part)

geth --datadir node1/ init your_genesis.json

Launch the node sealing again:

geth --datadir node1/ --syncmode 'full' --port 30311 --rpc --rpcaddr '$HOST' --rpcport 8501 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes 'enode://longnumber@127.0.0.1:30310' -unlock '0x$ACCOUT_ADDRESS' --password node1/password.txt --mine
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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