How to become a validator
On this page, you’ll learn how to become a validator for a blockchain that uses the Lisk PoS module, like the Lisk Mainnet.
This includes how to:
-
Register as a validator
-
Enable block generation for the first time
1. Prerequisites
To be able to become a validator for a blockchain, it is assumed that the following requirements are fulfilled:
-
Operating a node connected to the respective blockchain network, e.g. a Lisk Core node connected to the Lisk Mainnet.
-
Owning an account on the respective blockchain.
-
A sufficient account balance to send the "Register Validator" transaction (minimum 10 LSK for the Lisk Mainnet). You can verify your balance for example by requesting the
token_getBalance
endpoint. -
A sufficient account balance to perform the self-stake.
2. How to register as a validator
To generate new blocks on a network, it is required to register as a validator. This is achieved by choosing a unique validator name and posting a corresponding "Register Validator" transaction to the network.
2.1. Creating the validator keys
It is possible to generate all relevant validator keys to enable block generation from the account passphrase.
To do so, use the command keys:create.
lisk-core keys:create --output config/keys.json
./bin/run keys:create --output config/keys.json
Next, you will be prompted for the validator passphrase, and it will also ask for a password, in order to symmetrically encrypt the passphrase for the config.
? Please enter passphrase: [hidden] ? Please re-enter passphrase: [hidden] ? Please enter password: [hidden] ? Please re-enter password: [hidden]
The password is sensitive information. Store the password used here for the encryption somewhere safe. It will be required every time to enable block generation, in order to decrypt the generator keys in the node. |
This will generate the following file, which includes all important keys for the validator account:
{
"keys": [
{
"address": "lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3",
"keyPath": "m/44'/134'/0'",
"publicKey": "6290c8b58de8b71fedb7e3cb9a6ee9426aa3e7ac0141f278526375d46705b546",
"privateKey": "759305903f7bbb449cf2fd22e6da476792b63e24558e266a4859f9ed3c91fd7e6290c8b58de8b71fedb7e3cb9a6ee9426aa3e7ac0141f278526375d46705b546",
"plain": {
"generatorKeyPath": "m/25519'/134'/0'/0'",
"generatorKey": "aaecd278a3fadc40a4a824d6f4aa24547d8fb9d075ec4d6967a7084f9a3f2541",
"generatorPrivateKey": "81316f0582fd2cc0a651318aa0041ce36e7b786033b98ec545ec04078fad67caaaecd278a3fadc40a4a824d6f4aa24547d8fb9d075ec4d6967a7084f9a3f2541",
"blsKeyPath": "m/12381/134/0/0",
"blsKey": "815a9e7643cf2bace98d1337f1dca8e39949592cd3fcb79bf3ab5784981468b9987b3340527bc9ca263a2fd061812024",
"blsProofOfPosession": "add8669bb57f3dceec04dc0f875906cb52a677f1df911536c01f447c8830bf27cd43713af18d84de5a64ec504aeaf9a30521c09438bb5a4d5fd634946c65e0fc4ea3681fdb4f6949cb6c1bc1ac1ddec3df058a13466af5a13d50737938fd7d5f",
"blsPrivateKey": "36506a53431665265ee03d7e19a5d44db3ff159d9aeee05727a8b24abc67651a"
},
"encrypted": {
"ciphertext": "c3009d4a505ac32a652ffce6aa718073c7ca75b00578420ba20c2533a83f38e2b3e20cf1d6f0c9905efe28b5276142b93fdbdd33134d37bcd2db23654da92bb2becd00971c49ecc749100748c93344477ea52f6073c3fefec7234962d0eccdaa6862d9d0da46dbfe85cef98ad6cab0f2c1cb1b54326617132bb950d1c14a774a1e6403e8fa1bf3a2c7c0d6856266cf738f41ac01b2217d93070c4079e1b82044d3a692ea225290c2b6bcb902e0ffb8132f4c0f29325e6a3a",
"mac": "2b3c65d0385a870ab499dfcddf411347506671015f412b35600153b132a455ea",
"kdf": "argon2id",
"kdfparams": {
"parallelism": 4,
"iterations": 1,
"memorySize": 2024,
"salt": "a5598628001346f608b3f57dd38b8611"
},
"cipher": "aes-256-gcm",
"cipherparams": {
"iv": "683600a199d154e51c0f97e6",
"tag": "32807058f7f89921b4839fc39256cd24"
},
"version": "1"
}
}
]
}
The generated keys are very sensitive information. Especially the not encrypted values need to be treated equally sensitive as the passphrase for an account. So after the keys are imported in step Import the validator keys, make sure to store the file somewhere safe, or delete the file completely. |
2.2. Create the Register Validator transaction
Create a transaction to register your account as a validator.
The following parameters are required:
-
name
: The unique name of the new validator. -
generatorKey
: The public key whose corresponding private key is used to sign blocks generated by the validator. To enhance security, thegeneratorKey
is different from the key used to sign transactions in the network[1]. -
blsKey
: The public BLS key whose corresponding private key is used to sign certificates. -
proofOfPossession
: The cryptographic proof that the validator owns the corresponding private key to the BLS key. In the validator keys file, it can be found underblsProofOfPosession
.
The parameters mentioned in 2, 3, and 4 are all generated in the step Creating the validator keys.
Use the transaction:create command to create the registerValidator
transaction:
If it is not already running, start the node to create the transaction as described below. |
lisk-core transaction:create pos registerValidator 1100000000 \
--params='{"name":"myuniqueame","generatorKey":"aaecd278a3fadc40a4a824d6f4aa24547d8fb9d075ec4d6967a7084f9a3f2541","blsKey":"815a9e7643cf2bace98d1337f1dca8e39949592cd3fcb79bf3ab5784981468b9987b3340527bc9ca263a2fd061812024","proofOfPossession":"add8669bb57f3dceec04dc0f875906cb52a677f1df911536c01f447c8830bf27cd43713af18d84de5a64ec504aeaf9a30521c09438bb5a4d5fd634946c65e0fc4ea3681fdb4f6949cb6c1bc1ac1ddec3df058a13466af5a13d50737938fd7d5f"}'
./bin/run transaction:create pos registerValidator 1100000000 \
--params='{"name":"myuniqueame","generatorKey":"aaecd278a3fadc40a4a824d6f4aa24547d8fb9d075ec4d6967a7084f9a3f2541","blsKey":"815a9e7643cf2bace98d1337f1dca8e39949592cd3fcb79bf3ab5784981468b9987b3340527bc9ca263a2fd061812024","proofOfPossession":"add8669bb57f3dceec04dc0f875906cb52a677f1df911536c01f447c8830bf27cd43713af18d84de5a64ec504aeaf9a30521c09438bb5a4d5fd634946c65e0fc4ea3681fdb4f6949cb6c1bc1ac1ddec3df058a13466af5a13d50737938fd7d5f"}'
Next, enter the passphrase of your account.
? Please enter passphrase: [hidden] ? Please re-enter passphrase: [hidden]
The CLI will return the transaction already in hex format, ready to be posted to a node.
{"transaction":"0a0464706f731210726567697374657244656c656761746518002080d6c28c042a206290c8b58de8b71fedb7e3cb9a6ee9426aa3e7ac0141f278526375d46705b54632be010a066d796e616d651220aaecd278a3fadc40a4a824d6f4aa24547d8fb9d075ec4d6967a7084f9a3f25411a30815a9e7643cf2bace98d1337f1dca8e39949592cd3fcb79bf3ab5784981468b9987b3340527bc9ca263a2fd0618120242260add8669bb57f3dceec04dc0f875906cb52a677f1df911536c01f447c8830bf27cd43713af18d84de5a64ec504aeaf9a30521c09438bb5a4d5fd634946c65e0fc4ea3681fdb4f6949cb6c1bc1ac1ddec3df058a13466af5a13d50737938fd7d5f3a40d841c3ea463e2c2fd598bd56c77998241bc86e8143e59baf5f06b11491f3c8557e2d82c1139f927adcb0055256f5a5419a4853950856c2e9ae3588a7885a3f05"}
To return the transaction in JSON format as well, add the flags --json and --pretty to the command.
|
2.3. Send the transaction
Copy the transaction in the hex format that was created in the previous step and post it to the node.
lisk-core transaction:send 0805100018032080d6c28c042a20bad983c72bed43fd274f852658c298b74c71ab6fc50508879fef309e3836384b32080a066d796e616d653a4045afdd04d0c0bc6e548c0915d5fabef1311b1b75b1eb919a43b88dab539e7b6a99b9075f5d6382ec3bbebfca3301651a15d8af3f999d5b6fa7873b3969cd3d0c
Use the transaction:send command to send the transaction to your node.
./bin/run transaction:send 0a0464706f731210726567697374657244656c656761746518002080d6c28c042a206290c8b58de8b71fedb7e3cb9a6ee9426aa3e7ac0141f278526375d46705b54632be010a066d796e616d651220aaecd278a3fadc40a4a824d6f4aa24547d8fb9d075ec4d6967a7084f9a3f25411a30815a9e7643cf2bace98d1337f1dca8e39949592cd3fcb79bf3ab5784981468b9987b3340527bc9ca263a2fd0618120242260add8669bb57f3dceec04dc0f875906cb52a677f1df911536c01f447c8830bf27cd43713af18d84de5a64ec504aeaf9a30521c09438bb5a4d5fd634946c65e0fc4ea3681fdb4f6949cb6c1bc1ac1ddec3df058a13466af5a13d50737938fd7d5f3a40d841c3ea463e2c2fd598bd56c77998241bc86e8143e59baf5f06b11491f3c8557e2d82c1139f927adcb0055256f5a5419a4853950856c2e9ae3588a7885a3f05
If the sending process was successful, it will return the following message, including the respective transaction ID.
Transaction with id: '1809da284fe26dba90d34dc3aab837a32d3c291a4ca78a9bfa263f927c69598a' received by node.
2.4. Check validator details
After the registerValidator
transaction got included in a block, invoke the pos_getValidator
endpoint, to verify the account has now registered a validator name:
lisk-core endpoint:invoke pos_getValidator '{ "address":"lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3"}' --pretty
./bin/run endpoint:invoke pos_getValidator '{ "address":"lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3"}' --pretty
The new validator’s name should be displayed in the response, along with the corresponding address and other public information about the particular validator.
{
"name": "myuniquename",
"totalStakeReceived": "0",
"selfStake": "0",
"lastGeneratedHeight": 14,
"isBanned": false,
"pomHeights": [],
"consecutiveMissedBlocks": 0,
"commission": 10000,
"lastCommissionIncreaseHeight": 14,
"sharingCoefficients": [],
"address": "lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3",
"punishmentPeriods": []
}
3. Import the validator keys
After creating the validator keys as suggested in the Creating the validator keys section, the next step is to import them into the node.
lisk-core keys:import --file-path config/keys.json
./bin/run keys:import --file-path config/keys.json
3.1. Verifying correct import
After the validator keys are imported to the node, it is possible to verify that the import worked as expected with the following command:
lisk-core endpoint:invoke generator_getAllKeys --pretty
./bin/run endpoint:invoke generator_getAllKeys --pretty
That will return the validator keys that are currently imported on the node:
{
"keys": [
{
"address": "lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3",
"type": "encrypted",
"data": {
"version": "1",
"ciphertext": "f3612f66cd43bed2a5843feec41f574bfbb3750ca30bc2c5f38d6aced3f1d3ab04f8f77d7a00fd4a801584051dc1fff47c9eaa5c56cc2333936d06ca5fa23272420cc40c10047221c734b75a53baa8a6ee7f9a667b1bdab4b930fa88bd61849f4ba779515dd450c85459ea47eb59727d86c415464b3cdc232fd8b947027a9aab77674b3a226903f7c33f2935804b33ae1f2751b2879873f731b6f4ab6b53f9c1a95d44a670dd05e8ff080f4f3f89322b636a176471443b57",
"kdf": "argon2id",
"kdfparams": {
"parallelism": 4,
"iterations": 1,
"memorySize": 2024,
"salt": "a3fbf751c0defc289603a519af3e09cc"
},
"cipher": "aes-256-gcm",
"cipherparams": {
"iv": "9a73a7587fff612fb3f03f63",
"tag": "402525e2bf1450ae7352260a7a2fefe8"
}
}
}
]}
4. Set the hash onion
Without the hash onion, a validator won’t be able to receive any rewards for generating new blocks, although the blocks would still be valid in that case. To not miss any rewards, it is of high interest for a validator to set the hash onion, before enabling block generation on the node.
lisk-core endpoint:invoke random_setHashOnion '{"address":"lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3"}'
./bin/run endpoint:invoke random_setHashOnion '{"address":"lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3"}'
To verify that the hash onion was set correctly, Get the hash onion back from the node.
4.1. Get the hash onion
Currently, there is nothing else to do with the hash onion, after it is created. There are some situations though, where it is needed to get the seed hash onion back, for example, when moving from one node to another.
To get the hash onion seed of a validator, request the random_getHashOnionSeeds
endpoint.
lisk-core endpoint:invoke random_getHashOnionSeeds --pretty
./bin/run endpoint:invoke random_getHashOnionSeeds --pretty
This will return a list of all hash onion seeds that are stored in the node.
{
"seeds": [
{
"address": "lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3",
"seed": "5be11bacb61de5c1309d50a5548b1834",
"count": 1000000,
"distance": 1000
}
]
}
5. Initial validator info data
If a validator has never created a block on the blockchain before, the initial values of the validator info data are as follows:
-
height
:0
-
maxHeightGenerated
:0
-
maxHeightPrevoted
:0
6. How to enable block generation for the first time
Check this before enabling block generation on a node:
|
Use the generator:enable command to enable block generation on your node.
lisk-core generator:enable lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3 --height=0 --max-height-generated=0 --max-height-prevoted=0
./bin/run generator:enable lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3 --height=0 --max-height-generated=0 --max-height-prevoted=0
Replace lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3
with your validator address.
Next, you will be prompted for the password that was defined in step Creating the validator keys.
? Enter password to decrypt the encrypted passphrase: ********
Block generation should now be enabled for the validator. This is confirmed by the following message:
Enabled block generation for lskqaxxmj78frvgpjgwvf4yqjjkcrr9yhn2sxxwm3
7. How to stake to increase the validator weight
If you followed all of the above steps, your node is now well-prepared to start generating blocks in the network. The last remaining step is now to perform a self-stake.
Without performing a self-stake, a validator will never be considered by the validator selection algorithm. Being selected directly depends on the validator weight, and this is computed directly from the stakes and self-stakes of a validator, as defined in the Lisk PoS protocol[2]. Please check the validator weight explanation for further information on the topic.
For each blockchain network, there is a specific minimum validator weight that is required for a validator to be considered for block generation in general.
In the Lisk Mainnet, the minimum validator weight is 1000 LSK. |
The required validator weight to achieve an active position in the block generation is relative to the validator weights of the other validators who are participating in the network. A good way to check the exact validator weight required to reach an active position is to just check the validator weights of the currently active 101 validators. For the Lisk Mainnet, this information can be obtained directly from the Lisk Desktop, or one of the various Lisk explorers like https://liskscan.com/ or https://lisk.observer/.
Please note, that even if you do not have enough validator weight to be an active validator, there is still a chance for you in each round to be selected as one of the two random validators. To be considered for the random selection, a validator just needs to have a weight equal to or greater than the minimum validator weight of the network. |
To perform the required self-stake for your validator, please follow the steps described in the guide How to stake and un-stake tokens.