This is an advanced guide intended for experienced users who are willing to maximize the security of their node.
Running a staking pool requires your wallet to be online 24/7 and constantly connected to the internet. Consequently, the machine where the wallet is running becomes a target for individuals attempting to steal your funds.
To protect your funds, Mintlayer allows you to specify a "control address" (or, more accurately, a "decommission address"). This is the address required to sign the decommissioning transaction.
This address can be generated in a cold wallet, which is a wallet not connected to the internet and only accessible physically. Let's explore how this works.
There are multiple methods to manage a cold wallet. This guide will focus on the command line wallet application (wallet-cli
). Another popular method involves using a Hardware Wallet. While the concept is similar, this guide will not cover that method.
The prerequisite for having a cold wallet using wallet-cli
is to prepare a computer exclusively dedicated to this operation. This computer must be functional and capable of operating without an internet connection.
The primary purpose of this computer is to generate a seed and the addresses while it is not connected to the Internet.
wallet-cli
executable from either the Mintlayer website or GitHub using another computer, and transfer it onto a USB stick.wallet-cli
with the --cold-wallet
option. This option enables the wallet to operate without a node.Now that you are in the wallet console, you need to create a wallet first:
Wallet > wallet-create mywallet.dat do-not-store-seed-phrase
Your mnemonic: pig cloud chest dust ketchup buddy party invite flame lazy select script recall loop below stuff budget divide lamp piece canvas mobile nominee finish
Please write it somewhere safe to be able to restore your wallet.
This command generates a mnemonic phrase. The phrase consists of 24 words and represents your wallet. If you lose this phrase or it is stolen, you will lose access to all your funds.
IMPORTANT! Save the menmonic in a secure location. You will need it to recover your wallet!
In the future you can open the existing wallet with the wallet-open command:
Wallet> wallet-open mywallet.dat
Wallet loaded successfully
Since we aim to create the most secure environment possible, we can now encrypt the wallet with a password. This way, even if someone steals your computer, they cannot access the wallet without knowing the password:
Wallet> wallet-encrypt-private-keys super_secure_password
Successfully encrypted the private keys of the wallet.
Familiarize yourself with various wallet commands such as wallet-unlock-private-keys, wallet-lock-private-keys, wallet-encrypt-private-keys, and wallet-disable-private-keys-encryption.
You can now generate your cold address using the address-new command:
Wallet> address-new
mtc1q9gukv6w88r9y3uahw7uge7y5msqj28v6y8serka
Now, we can close our offline computer and switch to the one where we plan to run our staking pool. I assume you have followed the guide on how to install Mintlayer. Once done, run the node and connect the wallet.
This is also possible using the Node GUI, the graphical node application.
The parameter to focus on is the last one in the staking-create-pool command: DECOMMISSION_ADDRESS
. Let's create the pool using the address we previously generated as the decommission address:
Wallet> staking-create-pool 100000 10 50% mtc1q9gukv6w88r9y3uahw7uge7y5msqj28v6y8serka
Now, it is impossible to decommission the pool from the online computer, as the cold wallet is the only one capable of generating the signature for this address!
To decommission the pool, we need to generate a decommissioning transaction. This can be accomplished using the staking-decommission-pool-request command:
staking-decommission-pool-request tpool1qqf8pgknvccx8cpu7rf0xpmypez7z8t6c23tmlm5ln7m0dr70z2sqx4p8c
This command will generate the following output:
Decommission transaction created. Pass the following string into the wallet with the private key to sign:
0100040000543e02f1fffa6727c65b1e25617738cacd9dae6d512845e1c5b34e89d948af85000000000401000f80570792fa350e018ff1f921f6f379e9885d19c0116125305f25b0d70281700400
Or scan the QR code with it:
This transaction must be signed by the cold wallet. Save this hex value in a txt file called decommissioning_transaction.txt
and transfer it to a USB stick. Alternatively you can scan the QR code with a camera to increase the security even further.
Now, insert the USB stick into the cold wallet computer, ensuring it is still disconnected from the Internet. Copy the contents of the decommissioning_transaction.txt
file. Ensure the wallet is open and unlocked, then sign the transaction using the account-sign-raw-transaction command:
account-sign-raw-transaction 0100040000543e02f1fffa6727c65b1e25617738cacd9dae6d512845e1c5b34e89d948af85000000000401000f80570792fa350e018ff1f921f6f379e9885d19c0116125305f25b0d70281700400
This command will generate a new hex number. Save this in a file named signed_decommissioning_transaction.txt
and transfer it back onto the USB stick.
We are almost there! Move the USB stick back to the hot wallet computer and copy the contents of the file signed_decommissioning_transaction.txt
. Now, use the node-submit-transaction command:
node-submit-transaction 0100000001abcdef... (remainder of hex-encoded transaction)
Congratulations, you have successfully decommissioned your staking pool, ensuring the safety of your funds!