Skip to main content
ALL CHAINS

Backup & Recovery

Critical Files

These files must be backed up. Losing them means losing access to your node's identity and funds:

FileWhat It ContainsLoss Impact
~/node/ela/keystore.datP-256 private key (encrypted)Loss of node identity and deposited ELA
~/.config/elastos/ela.txtELA keystore passwordCannot decrypt keystore
~/.config/elastos/esc.txtESC keystore passwordCannot decrypt ESC keystore
~/.config/elastos/eid.txtEID keystore passwordCannot decrypt EID keystore
~/node/esc/data/keystore/UTC*Ethereum-style keystore fileLoss of ESC account
~/node/eid/data/keystore/UTC*Ethereum-style keystore fileLoss of EID account
~/node/ela/config.jsonRPC credentials, node configurationMust regenerate, may lose RPC access
~/node/arbiter/config.jsonArbiter configurationMust regenerate
~/node/arbiter/keystore.datCopy of ELA keystoreCan recreate from ELA keystore
danger

Losing your keystore.dat and password files means permanent loss of your node identity and any deposited ELA. There is no recovery mechanism.

Backup Procedures

Automated daily backup script:

#!/bin/bash
BACKUP_DIR="/backup/elastos/$(date +%Y%m%d)"
NODE_DIR="$HOME/node"
CONFIG_DIR="$HOME/.config/elastos"

mkdir -p "$BACKUP_DIR"

# Stop services for consistent backup
node.sh stop

# Backup keystores and credentials
cp -a "$CONFIG_DIR" "$BACKUP_DIR/config-elastos/"
cp "$NODE_DIR/ela/keystore.dat" "$BACKUP_DIR/"
cp "$NODE_DIR/ela/config.json" "$BACKUP_DIR/ela-config.json"
cp -a "$NODE_DIR/esc/data/keystore" "$BACKUP_DIR/esc-keystore/"
cp -a "$NODE_DIR/eid/data/keystore" "$BACKUP_DIR/eid-keystore/"
cp "$NODE_DIR/arbiter/config.json" "$BACKUP_DIR/arbiter-config.json"

# Create encrypted archive
tar czf - -C "$BACKUP_DIR" . | \
openssl enc -aes-256-cbc -salt -pbkdf2 \
-out "/backup/elastos/backup-$(date +%Y%m%d).tar.gz.enc"

# Restart services
node.sh start

# Cleanup unencrypted files
rm -rf "$BACKUP_DIR"

# Retain only last 30 days of backups
find /backup/elastos/ -name "backup-*.tar.gz.enc" -mtime +30 -delete

Decrypt a backup:

openssl enc -aes-256-cbc -d -pbkdf2 \
-in backup-20260327.tar.gz.enc | tar xzf -
warning

Offsite backup: Copy the encrypted archive to a separate location (S3, GCS, another server). Never store unencrypted keystores on cloud storage.

Recovery Procedures

Scenario: Server failure, fresh OS install

# 1. Create user and install dependencies
sudo adduser --disabled-password --gecos "" elastos
sudo su - elastos
sudo apt-get install -y jq lsof apache2-utils curl openssl

# 2. Install node.sh
mkdir -p ~/node && cd ~/node
curl -O https://raw.githubusercontent.com/elastos/Elastos.Node/master/build/skeleton/node.sh
chmod a+x node.sh
./node.sh set_path
source ~/.profile

# 3. Restore credentials
mkdir -p ~/.config/elastos
# Copy back: node.json, ela.txt, esc.txt, eid.txt from backup

# 4. Initialize chains (downloads binaries, generates new configs)
node.sh ela init
# When prompted for keystore, cancel — we'll restore the original

# 5. Restore keystores (overwrite the generated ones)
cp /backup/keystore.dat ~/node/ela/keystore.dat
cp /backup/ela-config.json ~/node/ela/config.json
cp -a /backup/esc-keystore/ ~/node/esc/data/keystore/
cp -a /backup/eid-keystore/ ~/node/eid/data/keystore/

# 6. Start and wait for sync
node.sh start

Scenario: Corrupted chain data

# Stop the affected chain
node.sh ela stop

# Remove corrupted data
rm -rf ~/node/ela/elastos/data

# Restart — it will re-sync from peers
node.sh ela start

Chain Data Management

Chain data grows continuously. Manage disk usage:

# Check disk usage per chain
du -sh ~/node/ela/elastos/
du -sh ~/node/esc/data/
du -sh ~/node/eid/data/

# Compress old logs
node.sh compress_log

# Remove old logs entirely
node.sh remove_log

# Per-chain log management
node.sh ela compress_log
node.sh esc compress_log
node.sh ela remove_log