OneLedger

Kratos Tutorial - Validator Staking

Written by OneLedger | Apr 2, 2021 5:28:38 PM

This tutorial will provide key information about becoming a Validator on the Kratos Mainnet.

Here are some important points to note.

 

  1. The minimal staking amount is 3 Million OLT, which means a user need to stake at least 3 Million to become a potential validator
  2. The blockchain network will only choose top 16 potential validators with highest staking amount and recognize them as active validators, the rest will be inactive validators
  3. Whenever the staking amount of an active validator drops below top 16 of staking amount or below 3 Million, this validator will become inactive and no longer be able to participate in voting. Also this Validator will not be eligible for rewards at this point
  4. Every validator can only have one stake address, we need to unstake and withdraw all the OLT first in order to change the stake address. It takes 80000 blocks “maturity time” (roughly 2 weeks) to let one be able to withdraw OLT after unstaking. This will be elaborated later in this document.

Pre-requisites

1. Have a full node running (Please check “Kratos Tutorial - Running A Fullnode”)

 

2. Have at least 3 Million OLT in staking account (Please check “Kratos Tutorial - How to get OLT To Stake”)

 

Video Tutorial

 

 

Check the current validator set

 

Before staking, we need to check the current validator set of Kratos network, and find the proper staking amount we need. If there are already 16 active validators in the network then we need to stake more than at least one of them to become a validator.

 

⚠️ In this document we will assume that there are less than 16 validators in the network, so a minimal staking amount of 3 Million will be enough.

 

cd $OLDATA

 

⚠️ ALL COMMANDS in the rest of this document will need to be running under this directory by default, if you prefer otherwise, please add --root $OLDATA to the command arguments.

 

Command to check the validator set:

 

sudo olclient validatorset

 

The result should be similar to below:

 

Active true

Address 0lt0f41d1724c2bbafae10455e6dbdf1f89ab1621d2

StakeAddress 0ltf675d27234bb8dca1ed99f15c296fd03977768eb

Power 4000000

Name 0

Staking 4000000

Active true

Address 0lt1e0d71c854ef2fda564f8fc03e23ed0d7b6c1a2a

StakeAddress 0ltb593b6cf540f083e208b8db73f24f289eaeedd92

Power 4000000

Name 1

Staking 4000000

Active true

Address 0lt27af5488ef034cafd1072442eae7e5a61ccb5421

StakeAddress 0lt0b2361445590347f888a4e14632ec5194ddebceb

Power 4000000

Name 2

Staking 4000000

Active true

Address 0ltcc8aef0465e5b4843dbd3fd4b5bc801762926b05

StakeAddress 0lt3d2bf8d59ed5980226d8bc608f543b1b70b4dc36

Power 4000000

Name 3

Staking 4000000

Height 15505

 

 

Become a validator

 

In order to participate in voting and to get rewards, one needs to stake OLT and become a validator.

 

Below are the instructions to stake, unstake and withdraw.

 

Stake

 

Command to stake:

⚠️ The address in command does not include 0lt prefix

sudo olclient delegation stake --amount 3000000 --address

YourAccountAddressWithout0ltPrefix --password YourPassword

 

After the transaction is passed, we can check the result in validator set:

 

sudo olclient validatorset

 

The result should be similar to the below:

 

Active true

Address 0lt0f41d1724c2bbafae10455e6dbdf1f89ab1621d2

StakeAddress 0ltf675d27234bb8dca1ed99f15c296fd03977768eb

Power 4000000

Name 0

Staking 4000000

Active true

Address 0lt1e0d71c854ef2fda564f8fc03e23ed0d7b6c1a2a

StakeAddress 0ltb593b6cf540f083e208b8db73f24f289eaeedd92

Power 4000000

Name 1

Staking 4000000

Active true

Address 0lt27af5488ef034cafd1072442eae7e5a61ccb5421

StakeAddress 0lt0b2361445590347f888a4e14632ec5194ddebceb

Power 4000000

Name 2

Staking 4000000

Active true

Address 0ltcc8aef0465e5b4843dbd3fd4b5bc801762926b05

StakeAddress 0lt3d2bf8d59ed5980226d8bc608f543b1b70b4dc36

Power 4000000

Name 3

Staking 4000000

Active true

Address YourNodeAddressWith0ltPrefix

StakeAddress YourAccountAddressWith0ltPrefix

Power 3000000

Name YourNodeName

Staking 3000000

Height 15599

 

This result shows that we are currently recognized as a validator in the network.

 

Check the status

 

Command:

 

sudo olclient delegation status --address YourAccountAddressWithout0ltPrefix

 

The result should be similar to below:

 

I[2020-07-16T13:16:13Z] olclient:        Balance: 0.99996874 OLT

I[2020-07-16T13:16:13Z] olclient:        Effective delegation amount:3000000

I[2020-07-16T13:16:13Z] olclient:        Withdrawable amount: 0

I[2020-07-16T13:16:13Z] olclient:        Pending matured amount: empty

 

 

Explanation:

 

    1. The first line is balance of stake address after this staking transaction(some fee is deducted from this address)
    2. The second line is the staking amount

The remaining lines will be explained in the following steps.

 

Unstake

 

Let’s first unstake 1 Million OLT, after this we will no longer be an active validator.

 

Command:

 

sudo olclient delegation unstake --amount 1000000 --address

 

YourAccountAddressWithout0ltPrefix --password YourPassword

 

After the transaction has passed, we can check the result in the validator set:

 

sudo olclient validatorset

 

The result should be similar to below:

 

Active true

Address 0lt0f41d1724c2bbafae10455e6dbdf1f89ab1621d2

StakeAddress 0ltf675d27234bb8dca1ed99f15c296fd03977768eb

Power 4000000

Name 0

Staking 4000000

Active true

Address 0lt1e0d71c854ef2fda564f8fc03e23ed0d7b6c1a2a

StakeAddress 0ltb593b6cf540f083e208b8db73f24f289eaeedd92

Power 4000000

Name 1

Staking 4000000

Active true

Address 0lt27af5488ef034cafd1072442eae7e5a61ccb5421

StakeAddress 0lt0b2361445590347f888a4e14632ec5194ddebceb

Power 4000000

Name 2

Staking 4000000

Active true

Address 0ltcc8aef0465e5b4843dbd3fd4b5bc801762926b05

StakeAddress 0lt3d2bf8d59ed5980226d8bc608f543b1b70b4dc36

Power 4000000

Name 3

Staking 4000000

Active false

Address YourNodeAddressWith0ltPrefix

StakeAddress YourAccountAddressWith0ltPrefix

Power 2000000

Name YourNodeName

Staking 2000000

Height 15888

 

From the result we can see that due to the staking amount change, we are no longer an active validator.

 

And we can check the status as shown previously, the result should be similar to the below:

 

I[2020-07-16T14:16:13Z] olclient:        Balance: 0.99994346 OLT

I[2020-07-16T14:16:13Z] olclient:        Effective delegation amount: 2000000

I[2020-07-16T14:16:13Z] olclient:        Withdrawable amount: 0

I[2020-07-16T14:16:13Z] olclient:        Pending matured amount:

I[2020-07-16T14:16:13Z] olclient:        --- At height: 20885, pending amount: 1000000

 

It can be seen from the second line in result that our staking amount is dropped by 1 Million, which is exactly what we have unstaked.

 

When we unstake some amount of OLT, there is a period of time referred to as “maturity time”. One can only withdraw the unstaked amount after this maturity time, since the unstake transaction. Right now on kratos, this maturity time is 80000 blocks, roughly 2 weeks.

 

So the withdrawable amount from the third line in result is still 0 at this time. Which means we cannot withdraw the unstaked OLT now.

 

The pending matured amount in the result is a list that contains all the pending amounts that will mature at the corresponding block heights.

 

Let’s unstake again, this time we unstake all the rest of OLT that we have staked.

 

Command:

sudo olclient delegation unstake --amount 2000000 --address

YourAccountAddressWithout0ltPrefix --password YourPassword

 

After the transaction is passed, we wait for a block to let the network update the validator set.

 

And we can check the result in validator set:

sudo olclient validatorset

 

The result should be similar to the below:

Active true

Address 0lt0f41d1724c2bbafae10455e6dbdf1f89ab1621d2

StakeAddress 0ltf675d27234bb8dca1ed99f15c296fd03977768eb

Power 4000000

Name 0

Staking 4000000

Active true

Address 0lt1e0d71c854ef2fda564f8fc03e23ed0d7b6c1a2a

StakeAddress 0ltb593b6cf540f083e208b8db73f24f289eaeedd92

Power 4000000

Name 1

Staking 4000000

Active true

Address 0lt27af5488ef034cafd1072442eae7e5a61ccb5421

StakeAddress 0lt0b2361445590347f888a4e14632ec5194ddebceb

Power 4000000

Name 2

Staking 4000000

Active true

Address 0ltcc8aef0465e5b4843dbd3fd4b5bc801762926b05

StakeAddress 0lt3d2bf8d59ed5980226d8bc608f543b1b70b4dc36

Power 4000000

Name 3

Staking 4000000

Height 15899

 

 

As shown above, our node is no longer in the list since we have unstaked all the OLT we staked at the beginning.

 

And we can check stake status as shown previously, the result should be similar to the below:

 

I[2020-07-16T14:20:13Z] olclient:        Balance: 0.99991818 OLT

I[2020-07-16T14:20:13Z] olclient:        Effective delegation amount: 2000000

I[2020-07-16T14:20:13Z] olclient:        Withdrawable amount: 0

I[2020-07-16T14:20:13Z] olclient:        Pending matured amount:

I[2020-07-16T14:20:13Z] olclient:        --- At height: 20885, pending amount: 1000000

I[2020-07-16T14:20:13Z] olclient:        --- At height: 20895, pending amount: 2000000

 

Now we have another entry in the pending matured amount list that shows the 2 Million OLT we just unstaked.

 

Withdraw

 

As introduced in the unstake part, a Validator can only withdraw the unstaked amount after maturity time. Before withdrawal, make sure there is a matured amount that is available.

 

We can check stake status as shown previously, the result should be similar to the below:

 

I[2020-07-17T13:16:13Z] olclient:        Balance: 0.99991818 OLT

I[2020-07-17T13:16:13Z] olclient:        Effective delegation amount: 0

I[2020-07-17T13:16:13Z] olclient:        Withdrawable amount: 3000000

I[2020-07-17T13:16:13Z] olclient:        Pending matured amount: empty

 

And we can run withdraw command:

 

sudo olclient delegation withdraw --amount 3000000 --address

 

YourAccountAddressWithout0ltPrefix --password YourPassword

 

After withdrawal, we can check stake status again, the result should be similar to the below:

 

I[2020-07-17T13:17:13Z] olclient:        Balance: 3000000.9998929 OLT

I[2020-07-17T13:17:13Z] olclient:        Effective delegation amount: 0

I[2020-07-17T13:17:13Z] olclient:        Withdrawable amount: 0

I[2020-07-17T13:17:13Z] olclient:        Pending matured amount: empty

 

We can check our account balance:

sudo olclient list

 

And you should see result similar to below:

 

Accounts from Secure Wallet:

Address: YourAccountAddressWith0ltPrefix    Balance: 3000000.9998929 OLT