Skip to content

Repair Corrupt Local Blockchain

Helix edited this page Aug 23, 2020 · 2 revisions

Wallet is not starting i. e. after power outage, what can I do?

  • Remove everything on Alias wallet data directory except the file wallet.dat. and (if existing) alias.conf. The file wallet.datis is your personal wallet and must stay there.
    • Data directory Windows: %appdata%\Aliaswallet\
    • Data directory Mac OSX: /Users/<USERNAME>/Library/Application Support/Aliaswallet/
    • Data directory Linux: ~/.aliaswallet/
  • If you have a fast internet connection a/o want to rebuild the whole chain from scratch, just start the wallet.
  • If you have a slow internet connection a/o want to improve startup speed, download bootstrapped blockchain archive from Alias release area and extract it right into the Alias data directory.

Example repair steps for Linux

Assumptions:

  • The » sign marks the cmd prompt. Everything here after this sign is a command, which you need to enter on your cmd prompt.
  • You're logged in as the user, which is used to run the Alias daemon. This can be verified with the command ls -l ~/.aliaswallet/wallet.dat, which must give you output like this:
» ls ~/.aliaswallet/wallet.dat
/home/staker/.aliaswallet/wallet.dat

In this case the used account is named staker. On the Raspberry Pi it might be pi.

Step by step:

  • Login to your staking system using your favourite ssh tool

  • For safety: Stop daemon again. This depends on your used system. If it's a Raspberry Pi using our provided image, you can use wallet-stop. On other systems it might be something like systemctl stop aliaswalletd or sudo systemctl stop aliaswalletd.

  • Backup your wallet.dat file using a cmd like this:

    » cp ~/.aliaswallet/wallet.dat ~/$(date +%Y-%m-%d_%H-%M)-wallet.dat
    

    This will create a backup file, where the name is prefixed with a readable timestamp. So you can use this command again and again to create multiple backups. But keep in mind to stop the daemon before creating wallet backups!

  • Optional: Backup your debug.log file using a cmd like this:

    » cd ~/.aliaswallet/
    » tar czf ~/$(date +%Y-%m-%d_%H-%M)-debug.log.tgz debug.log
    » rm -f debug.log
    

    This compress the debug log into a tar gz archive, put the resulting archive into your home directory with a name which is prefixed with a readable timestamp and removes the current log. With the next start of the daemon, a new log file will be created.

  • Download bootstrapped blockchain from our download area. Easiest way is to right-click and copy the link and paste it after wget command.

    » cd ~
    » wget https://download.alias.cash/files/bootstrap/BootstrapChain.zip
    ...
    BootstrapChain.zip           100%[=======================================>] 698.78M  17.8MB/s    in 46s
    ...
    
  • Cleanup Alias working directory by removing all files there except wallet.dat and alias.conf (if existing):

    » cd ~/.aliaswallet
    » ls
    

    You got a list of files and directories here. Remove all of them except wallet.dat and alias.conf (if existing). This might look like this:

    » rm -rf blk0001.dat database db.log peers.dat smsgDB tor txleveldb
    
  • Extract bootstrap archive into Alias data directory:

    » cd ~/.aliaswallet
    » unzip ../BootstrapChain.zip
    

    This will extract the required content. Afterwards the directory looks like this:

    » ls -1 ~/.aliaswallet
    blk0001.dat
    alias.conf
    txleveldb
    wallet.dat
    

We've done! Now you can start the daemon. Of course it will take some time until the daemon is in sync. This depends on how "old" the bootstap data is or in other words how many new blocks are already on the blockchain in comparison to the timestamp at which the bootstap was generated.

If everything works as expected, the downloaded bootstrap archive can be removed:

rm -f ~/BootstrapChain.zip

Happy staking!

The Alias Team

Clone this wiki locally