Thursday, April 25, 2019

Migrating LND node from one system to another

I wanted to migrate from my LND node in a Raspberry Pi to a Odroid HC1. Both systems had been built following the guide Raspibolt and some parts of Thundroid although I found that the last one was a little bit outdated. These guides are incredibly helpful for maintaning your node in these low-end machines. Thanks to Stadicus and the rest of contributors.

I don't have much money on the node and closing all channels and reopening would had lead to lose perhaps 20-30% of all my Bitcoin in onchain fees. So I though of migrating from the Raspberry to the HC1 and see what happenned, as I have seen some vague descriptions on how to do it here and here. As the two systems, file paths, user names, OS, LND versions, etc are very similar if not identical, I decided to try it. I think it is critical to have the same LND version to migrate smoothly.

Steps I followed:

- I stopped lnd and Bitcoind in both systems : 'sudo systemctl stop lnd' and 'sudo systemctl stop bitcoind'

- Ensured that they were successfully closed 'sudo systemctl status lnd/bitcoind'. I suppose that if there was some error during stop, it is good to start over the node and try to stop it again.

- Used WinCSP to transfer the whole lnd folder from the RPi (in my case it was in /mnt/hdd/ and used the same tool to insert the folder on the HC1 in same location). In my case, I had already started on the HC1 an LND node without any channel, so I renamed the LND folder on the HC1 to be able to copy the new one.

- Changed the ports 8333 and 9735 on the router to point on the HC1 instead of the RPi, although I think I could have simply assign the RPi IP address to the HC1.

- Copied the tls certificate and macaron files as shown several times on the Stadicus guide, as

$ sudo cp /home/bitcoin/.lnd/tls.cert /home/admin/.lnd $ cd /home/bitcoin/ $ sudo cp --parents .lnd/data/chain/bitcoin/mainnet/admin.macaroon /home/admin/ 

- I started Bitcoind. 'sudo systemctl start bitcoind' and waited to sync the chain 'bitcoin-cli getblockchaininfo'

-I started the LND node 'sudo systemctl start lnd'. The 'sudo journalctl -f -u lnd' showed that LND was waiting to be unlocked.

- I used 'lncli unlock' (I read some people that it was better to use 'lncli create' and use the seed from the old node, but I think this doesn't work, or at least the channels will need to be closed anyway) Using 'lncli unlock', I typed the password used on the RPi and voilĂ ! LND successfully unlocked and everything works correctly.

- I assume it is important to ensure that the old RPi node never tries to start LND. It can be done by deleting the files inside the lnd folder or changing the name.

I didn't find anyone that had already done that. I don't recommend to do it if you have a lot of money, it is much safe to close all channels and transfer the funds to the new node and start over. For me, the risk was loosing maybe 30€.

Leave your comments and don't be so hard on me...



No comments:

Post a Comment