I have a currupt Blockchain and want to hard reset the chain. what do I need to delete in order to start downloading the chain from scratch?

I know that there are 2 ethereum folders (I am on OSX):

$home/.ethereum
$home/Libary/Ethereum

I updated geth recently to "Homestead" 1.3.5 and get error in the terminal like:

E0306 ... 3211 trie.go:309] Dangling hash node ref 3c6233326.... leveldb: not found

and sometimes I get a bad block warning:

Bad block #1102797
  • I updated geth to v 1.3.5, but I also installed eth a while ago (v 1.1.0 / eth newtwork protocol version: 61). I didn't use both a lot just fired them up once in a while – xpnimi Mar 7 '16 at 9:10
up vote 26 down vote accepted

For geth, delete $home/Libary/Ethereum/chaindata. That should wipe out the blockchain itself and let you sync from scratch. Also you probably want to do a fast sync afterwards to get back fast-ish on the chain --fast.

  • would you start geth to reload the chain or direct with geth --fast? – xpnimi Mar 7 '16 at 15:39
  • 1
    geth --fast --cache=512 console is how I would personally start geth :D – Péter Szilágyi Mar 7 '16 at 15:40
  • 7
    Isn't it more careful to use "geth removedb" instead? It's its purpose. – bortzmeyer Jun 30 '17 at 7:39
  • 1
    For Mac OSX rm -R ~/Library/Ethereum/geth/chaindata/ – ramusus Jul 14 '17 at 1:55

You can also use geth removedb to remove the blockchain and state databases.

geth removedb
Remove local database? [y/N] 

After removing the old databases, run geth --fast --cache=1024 (see answer to this question by @eth).

Note that using geth --fast will prevent you from using debug.traceTransaction(...) on the blocks that were --fast downloaded. Some further information in How to check the VM trace using Geth? and How can the transaction status from a thrown error be detected when gas can be exactly the same as the gasUsed for a successful transaction?.

See also What is Geth's "fast" sync, and why is it faster?.

  • Also if your pc has more RAM then the --cache=4024 can also be done. And geth --fast can only be used when the blocks database is empty. If you are already downloading the blocks then it is advised not to use geth --fast – freerunner Jul 30 '16 at 22:33

For other operating systems, the default datadir is:

Mac: ~/Library/Ethereum
Linux: ~/.ethereum
Windows: %APPDATA%/Ethereum

Delete the chaindata subdirectory that you find.

Run geth --fast --cache=1024 for a recommended way to sync the chain quickly (don't forget to use a bigger --cache with a value like 1024, otherwise the default is 16, and it won't sync as quickly).

protected by Afri May 15 '17 at 9:08

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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