Tendermint KMS(opens new window) is a Key Management Service (KMS) that allows separating key management from Tendermint nodes. In addition it provides other advantages such as:
Improved security and risk management policies
Unified API and support for various HSM (hardware security modules)
Double signing protection (software or hardware based)
It is recommended that the KMS service runs in a separate physical hosts.
In this example, we will be compiling from the github source code using the --features=softsign flag, however you may use --features=yubihsm if you want to use a yubikey (ledger support is not working properly at the moment, and this guide will not go into using yubihsm).
Copy
cd $HOME
git clone https://github.com/iqlusioninc/tmkms.git
cd $HOME/tmkms
cargo install tmkms --features=softsign
tmkms init config
tmkms softsign keygen ./config/secrets/secret_connection_key
Now we will transfer your validator private key from your validator to your VM running TMKMS. You can do this manually or though scp. I will use scp in this example (the validator has the IP of 123.456.32.123):
Please note at this point, you could delete the priv_validator_key.json from both your validator node and tmkms node and store it safely offline in case of an emergency. This newly created priv_validator_key will be what TMKMS will use to sign for your validator.
Now, modify the tmkms.toml file
Copy
nano $HOME/tmkms/config/tmkms.toml
In this example, my validator has the IP address of 123.456.32.123 and we will be using port 688 to feed the validator key to the validator. We will also be using chain_id haqq_11235-1 for Haqq Mainnet, but if you are doing this on the testnet be sure to use haqq_54211-3 instead:
It is also recommended to comment out the priv_validator_key_file line and the priv_validator_state_file line:
Copy
# Path to the JSON file containing the private key to use as a validator in the consensus protocol
# priv_validator_key_file = "config/priv_validator_key.json"
# Path to the JSON file containing the last sign state of a validator
# priv_validator_state_file = "data/priv_validator_state.json"
Next, stop the validator. Move back to your VM running TMKMS and start it:
Now, start your chornic validator on the validator node:
Copy
haqqd start
Your TMKMS node will now show logs like the following:
Copy
2022-03-08T23:46:06.208451Z INFO tmkms::connection::tcp: KMS node ID: 948f8fee83f7715f99b8b8a53d746ef00e7b0d9e
2022-03-08T23:46:06.210568Z INFO tmkms::session: [haqq_11235-1@tcp://164.92.136.160:688] connected to validator successfully
2022-03-08T23:46:06.210604Z WARN tmkms::session: [haqq_11235-1@tcp://164.92.136.160:688]: unverified validator peer ID! (ba44dd36899602e255b04e3608e5ef0fe4bc5f5b)
2022-03-08T23:46:15.929787Z INFO tmkms::session: [haqq_11235-1@tcp://164.92.136.160:688] signed PreCommit:<nil> at h/r/s 3399910/0/2 (0 ms)
2022-03-08T23:46:17.344579Z INFO tmkms::session: [haqq_11235-1@tcp://164.92.136.160:688] signed PreCommit:<nil> at h/r/s 3399911/0/2 (0 ms)
2022-03-08T23:46:22.367627Z INFO tmkms::session: [haqq_11235-1@tcp://164.92.136.160:688] signed PreCommit:<nil> at h/r/s 3399912/0/2 (0 ms)
2022-03-08T23:46:27.409777Z INFO tmkms::session: [haqq_11235-1@tcp://164.92.136.160:688] signed PreCommit:<nil> at h/r/s 3399913/0/2 (0 ms)
2022-03-08T23:46:32.442300Z INFO tmkms::session: [haqq_11235-1@tcp://164.92.136.160:688] signed PreCommit:<nil> at h/r/s 3399914/0/2 (0 ms)
2022-03-08T23:46:37.452162Z INFO tmkms::session: [haqq_11235-1@tcp://164.92.136.160:688] signed PreCommit:<nil> at h/r/s 3399915/0/2 (0 ms)
You should now be signing blocks! If you cancel the TMKMS process, you will no longer sign blocks and will stop syncing. If you restart the TMKMS process, your validator node will continue to sync from where it left off.
Please note that this is a bare minimum setup. More robust settings such as setting up a firewall to only allow your TMKMS node to get through the priv_validator_laddr port would make your validator even more secure.