From 87d54d77be9b11ea74f7a12fc6686461ea74ae5d Mon Sep 17 00:00:00 2001 From: Romeo Rosete <208020944+roseteromeo56@users.noreply.github.com> Date: Fri, 23 May 2025 19:07:06 -0400 Subject: [PATCH] Backup & Restore _ go-ethereum.html Romeo Rosete --- Backup & Restore _ go-ethereum.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Backup & Restore _ go-ethereum.html diff --git a/Backup & Restore _ go-ethereum.html b/Backup & Restore _ go-ethereum.html new file mode 100644 index 0000000000..aa6b0ce038 --- /dev/null +++ b/Backup & Restore _ go-ethereum.html @@ -0,0 +1,26 @@ + + +Backup & Restore | go-ethereum

Backup & Restore

Last edited on April 25, 2023

Keep secure backups of your keystore and password!

+

Data Directory

+

All data relating to a specific Geth instance gets written inside a data directory. The default data directory locations are platform specific:

+
  • Mac: ~/Library/Ethereum
  • Linux: ~/.ethereum
  • Windows: %LOCALAPPDATA%\Ethereum
+

Accounts are stored in the keystore subdirectory. The contents of this directories should be transportable between nodes, platforms, and client implementations.

+

To configure the location of the data directory, the --datadir parameter can be specified. See CLI Options for more details. There may exist multiple data directories for multiple networks (e.g. a separate directory for Ethereum Mainnet and the Goerli testnet). Each would have subdirectories for their blockchain data and keystore.

+

It is important to backup the files in the keystore securely. These files are encrypted using an account password. This needs to be securely backed up too. There is no way to decrypt the keys without the password!

+

Cleanup

+

Geth's blockchain and state databases can be removed with:

+
geth removedb
+
+

This is useful for deleting an old chain and sync'ing to a new one. It only affects data directories that can be re-created on synchronisation and does not touch the keystore. Specifically, passing the removedb command with no arguments removes the full node state database, ancient database and light node database (although light nodes are not currently functional for proof-of-stake Ethereum).

+

Blockchain Import/Export

+

Export the blockchain in binary format with:

+
geth export <filename>
+
+

Or if you want to back up portions of the chain over time, a first and last block can be specified. For example, to back up the first epoch:

+
geth export <filename> 0 29999
+
+

Note that when backing up a partial chain, the file will be appended rather than truncated.

+

Import binary-format blockchain exports with:

+
geth import <filename>
+
+

And finally: REMEMBER YOUR PASSWORD and BACKUP YOUR KEYSTORE!

© 2013–2025. The go-ethereum Authors | Do-not-Track

\ No newline at end of file