Ethereum Reset Local Blockchain Geth

July 15, 2017

Returning to some Ethereum work I wanted to reset my old local blockchain by deleting it an starting from scratch. Here are notes to describe what to do.

Ethereum Installation Directory

On OSX Ethereum installs in $HOME/Library/Ethereum. The public data is in geth while the testnet directory contains the testnet data.

Remove blockchain and state databases

BEFORE

|-- geth
|   |-- LOCK
|   |-- chaindata
|   |-- ethash
|   |-- nodekey
|   `-- nodes
|-- history
|-- keystore
`-- testnet
    |-- geth
    |   |-- LOCK
    |   |-- chaindata
    |   |-- ethash
    |   |-- nodekey
    |   `-- nodes
    |-- history
    `-- keystore

8 directories, 5 files

Remove the public blockchain data

COMMAND

$ geth removedb
$ cd /Users/brad/Library/Ethereum
$ du -sh geth
 20G	geth

$ geth removedb
/Users/brad/Library/Ethereum/geth/chaindata
Remove this database? [y/N] y
Removing...
Removed in 1.426841522s

$ du -sh geth
109M	geth

Remove the testnet blockchain data

COMMAND

$ geth --testnet removedb
$ cd /Users/brad/Library/Ethereum
$ du -sh testnet/
5.1G	testnet/

$ geth --testnet removedb
/Users/brad/Library/Ethereum/testnet/geth/chaindata
Remove this database? [y/N] y
Removing...
Removed in 526.733895ms

$ du -sh testnet/
 26M	testnet/

AFTER

|-- geth
|   |-- LOCK
|   |-- ethash
|   |-- nodekey
|   `-- nodes
|-- history
|-- keystore
`-- testnet
    |-- geth
    |-- history
    `-- keystore

7 directories, 5 files

Rebuild

Public

$ geth --testnet --fast --cache=2048 

Testnet

$ geth --testnet --fast --cache=2048 

Tags: geth ethereum