The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.
Switch user
Switch to the correct username you have used to install and set up the Fleek Network Lightning. For example, let's say that the username is lgtn
. The command you'd have to run would be:
su lgtn
Change directory to user home
Change directory to the user you have used to install and set up the Fleek Network Lightning. For example, if you have used the username lgtn
the command would be:
cd $HOME
In other words:
cd /home/lgtn
Clear the config.toml
You should can delete, backup or move the config.toml
file in order to reset it.
It might be necessary to, if your configuration, e.g. is corrupted, or you want to reset it for any other reason.
To move or backup, run:
mv ~/.lightning/config.toml ~/.lightning/config.toml.backup
If you don't have a use-case for the backup, delete the file. To delete, run the command:
rm ~/.lightning/config.toml
You should have switched to the correct username. If you haven't done it, when stating ~
that will refer to the current username home, which can be anything other than the correct username! Make sure you have switched to the correct username used during the installation and set up of Fleek Network Lightning to avoid confusion and issues.
Create a new config.toml
A new configuration file can be created by running the following command:
lgtn print-config --default > ~/.lightning/config.toml
Update the config.toml with user home path
In the /home/<USERNAME>/.lightning/config.toml
you'll find some and more of the following:
[BLANK]
[application]
db_path = "~/.lightning/data/app_db"
[consensus]
store_path = "~/.lightning/data/narwhal_store"
[fsstore]
root = "~/.lightning/blockstore"
[resolver]
store_path = "~/.lightning/data/resolver_store"
[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
The configuration properties and values presented above are a shorter version of what you'll find on your configuration.toml. We keep it short to make it easier to follow, do not copy and paste.
Find and replace all instances of ~ in the config file /home/<USERNAME>/.lightning/config.toml
.
Here's an example of how to do it using sed:
sed -i "s|~/.lightning|/home/<USERNAME>/.lightning|g" "/home/<USERNAME>/.lightning/config.toml"
Replace the <USERNAME>
with your username. For example, if you have followed the recommendation to create a user it would look like /home/lgtn/.lightning/config.toml
for the username lgtn.
For example, if your username is lgtn
that'd look like this:
sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"
Once modified, you can run a cat
to see the content of the files to confirm it has been updated.
cat /home/lgtn/.lightning/config.toml
For our example where we opted in for the username lgtn
that would look like:
[BLANK]
[application]
db_path = "~/.lightning/data/app_db"
[consensus]
store_path = "~/.lightning/data/narwhal_store"
[fsstore]
root = "~/.lightning/blockstore"
[resolver]
store_path = "~/.lightning/data/resolver_store"
[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.
Restoring the keystore
You can restore the keystore (Public Keys) by copying the directory to the ~/.lightning
directory.
Let's assume that you know where your backup directory or files are located. To keep our instructions easy to follow, let's say that:
-
The keystore and files are located under the hypothetical location
/my-keystore-backup
-
The files in the
/my-keystore-backup
are the following:
/my-keystore-backup
├── consensus.pem
└── node.pem
1 directory, 2 files
Considering the above for our example, you would have to run the following command:
mv /my-keystore-backup /home/<YOUR-USERNAME>/.lightning/keystore
Remember to replace the <YOUR-USERNAME>
with the correct username for the setup. For example, if you have installed the Fleek Network with the username lgtn
that would be /home/lgtn/.lightning/keystore
.
Once moved, remember to start the service, you can learn how to manage the service by reading the section Systemd Service.
For a more in depth or step-by-step instructions read the guide managing the keystore.