# 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 $PIO_HOME dir, run this command:
cat $PIO_HOME/config/priv_validator_key.json
return (this will be your private key to recovery your validator):
{
"address": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX"
},
"priv_key": {
"type": "tendermint/PrivKeyEd25519",
"value": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX"
}}
The directory tree of the $PIO_HOME directory should look like this:
tree $PIO_HOME
$PIO_HOME
├── config
│ ├── app.toml
│ ├── config.toml
│ ├── genesis.json
│ ├── node_key.json
│ └── priv_validator_key.json
└── data
└── priv_validator_state.json
2 directories, 6 files
Run the below commands
```
export PIO_HOME=<directory of your choosing>
provenanced init choose-a-moniker --chain-id pio-mainnet-1
curl https://raw.githubusercontent.com/provenance-io/mainnet/main/pio-mainnet-1/genesis.json> genesis.json
mv genesis.json $PIO_HOME/config
Step 4:Change config.toml to have the db-backend set to `cleveldb`
```# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb
# * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
# - pure go
# - stable
# * cleveldb (uses levigo wrapper)
# - fast
# - requires gcc
# - use cleveldb build tag (go build -tags cleveldb)
# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt)
# - EXPERIMENTAL
# - may be faster is some use-cases (random reads - indexer)
# - use boltdb build tag (go build -tags boltdb)
# * rocksdb (uses github.com/tecbot/gorocksdb)
# - EXPERIMENTAL
# - requires gcc
# - use rocksdb build tag (go build -tags rocksdb)
# * badgerdb (uses github.com/dgraph-io/badger)
# - EXPERIMENTAL
# - use badgerdb build tag (go build -tags badgerdb)
db_backend = "cleveldb```
```
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.
if you are in $PIO_HOME/config directory):
your file should look like this and replace the contenst with the priv_validator_key.json of the validator you want to recover.
root@XXXXXXXXXXXXXXX:~# cat > priv_validator_key.json
{
"address": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX"
},
"priv_key": {
"type": "tendermint/PrivKeyEd25519",
"value": "XXXXXXXXXXXXXXXXXXxxxxxxxXXXXXX"
}}
Run the following command and compare if the public key you generate now matches the old public key.
```
provenanced tendermint show-validator
```
If it does, then you have successfully recovered your original validator.