1

When I launch lightningd it generates hsm_secret in ~/.lightning/bitcoin whereas launching lightningd with network=testnet generates hsm_secret in ~/.lightning/testnet. These two files seem to be different as confirmed by

diff ~/.lightning/bitcoin/hsm_secret ~/.lightning/testnet/hsm_secret

returning some output.

Having in mind that hsm_secret may get corrupted and being concerned with the security of my funds I decided to generate hsm_secret from BIP-39 words and back up both the phrase and the file. After compiling c-lightning from source and generating [the mnemonic with Python, I then followed the documentation and run:

~/lightning/tools/lightning-hsmtool generatehsm hsm_secret

It generated hsm_secret in the current directory. After trying ~/lightning/tools/lightning-hsmtool generatehsm hsm_secret testnet and finding out that it does not work I decided to try using the same hsm_secret file for both the testnet and the mainnet, i.e. I launched lightningd with network=testnet and replaced the auto-generated hsm_secret in ~/.lightning/testnet with the one I generated from my mnemonic and than did the same with network=bitcoin and ~/.lightning/bitcoin/hsm_secret. I was surprized to see that all seems to work fine, e.g. newaddr generates tb1 addresses when on testnet and bc1 addresses when on mainnet.

What are the pros and cons of using the seperate hsm_secret files vs using only one file for both networks.?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.