A full Bee node backup includes the
password files. The node should be stopped before taking a backup and not restarted until restoring the node from the backup to prevent the node from getting out of sync with the network.
Node key and state data is found in the data directory specified in its configuration.
Key data in backup files allows access to Bee node's Gnosis account. If lost or stolen it could lead to the loss of all assets in that account. Multiple backups should be kept in secure locations.
Don't forget - it's not a backup until you're sure the backup files work! Make sure to test restoring from backup files to prevent loss of assets due to data loss or corruption.
Ubuntu / Debian / Raspbian / CentOS package managers
For Linux installations from package managers yum or apt, the data directory is located at:
It may also be useful to include the
bee.yaml config file in a backup so that configuration can be easily restored. The default location of the config file is:
Binary package install
When using Docker Compose configuration files to run a node, Docker will create a volume for Bee.
docker cp to retrieve the contents of these folders:
docker cp bee_bee_1:/home/bee/.bee/ bee
The data directory contains three directories. Its default location depends on the node install method used.
Shell script install:
│ ├── libp2p.key
│ ├── pss.key
│ └── swarm.key
│ └── ...
Package manager install:
│ ├── libp2p.key
│ ├── pss.key
│ └── swarm.key
│ └── ...
keys directory contains three key files:
swarm.key. These keys are generated during the Bee node's initialisation and are the most important data to retain for a backup.
swarm.key file allows access to Bee node's Gnosis account. If the key is lost or stolen it could lead to the loss of all assets secured by that key. Multiple backups should be kept in secure locations to prevent loss of assets or unauthorized access.
swarm.key to manage the Gnosis account for a node through Metamask or other wallets, exportSwarmKeys can be used to convert
swarm.key to a compatible format.
statestore directory retains information related to the node,
including SWAP balances, info on peers, block list, postage stamps, and more.
As the data in
localstore continually changes during normal operation of a node, when taking a backup the node should first be stopped and not re-connected to the Swarm network until restoring from the backup (otherwise the
localstore files will get out of sync with the network). It is possible to restore using out of sync
localstore files, however it may lead to data loss or unexpected behavior related to chunk uploads, postage stamps, and more.
localstore directory contains chunks locally which are frequently requested, pinned in the node, or are in the node's neighbourhood of responsibility.
Backup Your node
bee data folder to fully backup node. This will do a full backup of
key files into the newly created
/backup directory. Make sure to save the backup directory to a safe location.
sudo cp -r /var/lib/bee/ backup
If you only need to export your node's blockchain keys, you need to export the
swarm.key UTC / JSON keystore file and the
password file used to encrypt it. First create a directory for your keys and then export, make sure to save the newly created
keystore directory in a safe location.
sudo cp -r /var/lib/bee/keys/swarm.key /var/lib/bee/password keystore
View key and password for wallet import
sudo cat /var/lib/bee/keys/swarm.key
sudo cat /var/lib/bee/password
swarm.key is in UTC / JSON keystores format and is encrypted by default by your password file inside the
/bee directory. Make sure to export both the
swarm.key file and the
password file in order to secure your wallet. If you need your private key exported from the keystore file, you may use one of a variety of Ethereum wallets which support exporting private keys from UTC files (such as Metamask, however we offer no guarantees for any software, make sure you trust it completely before using it).
Get private key from keystore and password
There are many tools and wallets you may use to get your private key from your keystore and password. Most Ethereum wallets which support importing accounts by keystore also include the option to export your private key, and Metamask is one of the most popular wallets for doing so.
To import to Metamask:
- Get your
keystoreas described in the section above.
- Go to Metamask and click "Account 1" --> "Import Account"
- Choose the "Select Type" dropdown menu and choose "JSON file"
- Paste the password (Make sure to do this first)
- Upload exported JSON file
- Click "Import"
To export your private key:
- Go to Metamask and click "Account 1" to view the dropdown menu of all accounts
- Click the three dots next to the account you want to export
- Click "Account details"
- Click "Show private key"
- Enter your Metamask password (not your keystore password)
- Copy your private key to a safe location
Restore from backup
Before restoring, make sure to check for any old node data at
/var/lib/bee from a previous node which has not yet been backed up, and back it up if needed.
Install Bee. See install page for more info.
Change ownership of
sudo chown -R /var/lib/bee
Delete statestore, keys, localstore, and password files.
sudo rm -r /var/lib/bee
Navigate to backup directory and copy files to data folder.
cp -r /<path-to-backup>/bee /var/lib/
Revert ownership of the data folder.
sudo chown -R bee:bee /var/lib/bee
beeservice and check logs to see if Bee node is running properly.
sudo systemctl restart bee
sudo journalctl --lines=100 --follow --unit bee