Validator Recovery
Run the following command to open the priv_validator_key.json file and store it somewhere for safe keeping:
❗❗❗❗❗❗THIS IS ESPECIALLY IMPORTANT!❗❗❗❗❗❗ Do ensure that you have a back-up priv_validator_key.json file and that it is stored safely! Overriding this priv_validator_key.jsonfile and you would have lost your consensus private key and your validator if you have one set up. DO NOT OVERRIDE THIS FILE.
If you are in the fx-core dir, run this command:
1
cat ../.fxcore/config/priv_validator_key.json
Copied!
return (this will be your private key to recovery your validator):
1
{
2
"address": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX",
3
"pub_key": {
4
"type": "tendermint/PubKeyEd25519",
5
"value": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX"
6
},
7
"priv_key": {
8
"type": "tendermint/PrivKeyEd25519",
9
"value": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX"
10
}}
Copied!
The directory tree of the .fxcore directory should look like this:
1
[email protected]:~$ tree $HOME/.fxcore
2
/home/ubuntu/.fxcore
3
├── config
4
│ ├── app.toml
5
│ ├── config.toml
6
│ ├── genesis.json
7
│ ├── node_key.json
8
│ └── priv_validator_key.json
9
└── data
10
└── priv_validator_state.json
11
2 directories, 6 files
Copied!
The command after Initializing fxcore from setting up node with Full node with Binaries or Full node with Docker is to override the various files that were initialized earlier:
Binaries
Docker
1
wget https://raw.githubusercontent.com/functionx/fx-core/master/public/testnet/genesis.json -O ~/.fxcore/config/genesis.json
2
wget https://raw.githubusercontent.com/functionx/fx-core/master/public/testnet/config.toml -O ~/.fxcore/config/config.toml
3
wget https://raw.githubusercontent.com/functionx/fx-core/master/public/testnet/app.toml -O ~/.fxcore/config/app.toml
Copied!
1
sudo wget https://raw.githubusercontent.com/functionx/fx-core/master/public/testnet/genesis.json -O ~/.fxcore/config/genesis.json
2
sudo wget https://raw.githubusercontent.com/functionx/fx-core/master/public/testnet/config.toml -O ~/.fxcore/config/config.toml
3
sudo wget https://raw.githubusercontent.com/functionx/fx-core/master/public/testnet/app.toml -O ~/.fxcore/config/app.toml
Copied!
The key file here is priv_validator_key.json. After initializing and overriding those files, override the priv_validator_key.json with your original priv_validator_key.json of the validator you want to recover. You may do this by following the command below (if you are in .fxcore/config directory):
1
cat > priv_validator_key.json
Copied!
Hit the ENTER button on your keyboard and copy and paste the contents of your priv_validator_key.json file from your original validator into the command line
Your command line should look something like this:
1
[email protected]:~# cat > priv_validator_key.json
2
{
3
"address": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX",
4
"pub_key": {
5
"type": "tendermint/PubKeyEd25519",
6
"value": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX"
7
},
8
"priv_key": {
9
"type": "tendermint/PrivKeyEd25519",
10
"value": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX"
11
}}
Copied!
Then hit the ENTER button on your keyboard before using Ctrl+D on your keyboard, your file with the above contents will be created.
Run the following command and compare if the public key you generate now matches the old public key. If it does, then you have successfully recovered your original validator.
1
fxcored tendermint show-validator
Copied!
Copy link