I have a private network for testing. My problem is when ever I stop running geth network, all of my mined blocks are gone. I run like

geth --datadir "ethereum/node1" --port 30301 --networkid 1234 --rpc --rpcport "8545" --rpcapi db,eth,net,web3,personal --ws --wsport "8546" --rpccorsdomain "*"

(sometimes I use nohup) and I stop the server using cntrl+c. When geth is running I check block number using eth.blockNumber and it will show block number and it will increment. After I stop and start my server then I check using eth.blockNumber it always shows 0 and it takes some hour to mine blocks. Due to this, I'm lossing many of test data. Is this a common problem? Is there any work around to prevent this? Any idea will be helpful. Thank you.

  • I'd enable logs adding -verbosity 5 to geth command line. If geth finishes cleanly it should restart where it left. From your description it appears geth has some problem closing that might leave the database with invalid data that forces a restart from block 0.
    – Ismael
    Jul 3 '18 at 17:26

you can use geth export <filename> and geth import <filename>

from Go Ethereum Wiki


sometimes I use nohup

What do you see when you tail the logs?

tail -f nohup.out

I suspect geth is just trying to determine current state corresponding to the highest block in your local node and shows block 0 until that is done.

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.