If one wanted to restore a lightning network node, what files have to be saved?

I read that saving hsm_secret is enough to restore private key(s), but I also read about a problem with channels. How channels are restored after a re-installation of lightningd and the "pasting" of hsm_secret file?

And, if it is impossible to restore channels, how to force the closure of them so that one can retrieve all locked funds?


in c-lightning all the state information is stored in the lightningd.sqlite3 database. so if you shutdown your daemon and you copy hsm_secret as well as lightningd.sqlite3 you should be able to fire up the node again and have your channels operating (I did this already)

You have to be carefull though. If you start the node with an old backup of lightningd.sqlite3 your channel partner might think you try to publish old state and will close the channels and redeem also your balance.

with only the hsm_secret it will be hard to close channels. you can derieve the keys you used but you are missing the signatures of your channel partners to reconstruct the commitment transactions. Technically (not 100% certain how the implementation handles this case) you can try a collaborative close with the third party just with your hsm_secret since you know the keys to the funidng txs and with the other party together you are able to spend them. However you would have to trust the partners to provide the correct channel balance that you previously had agreed upon.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.