Validator Staking
Staking involves depositing the KUB Coin to activate the validator. A validator's role includes storing data, processing transactions, and adding blocks to the blockchain. This active participation helps secure the KUB network, benefiting all users and allowing validators to earn additional KUB Coin rewards.
Becoming a Solo Node
A solo node on the KUB network allows complete control and full participation rewards. Those considering solo staking should have at least 10 KUB and a computer connected to the internet, which must maintain 100% uptime.
Visit the StakeManager contract on KUB Scan
Connect your wallet on the Write Contract page
Select the stake function (Number 15) and input the following
signer - Your public address that was retrieved in the earlier steps, starts with
0x
delegation -
false
Send Native KUB - At least
10
KUB
Click on the Write button to confirm the transaction
Check your Validator ID by selecting the getValidatorID function on the Read Contract page and input your public address
Becoming a Pool Node
A pool node on the KUB network allows delegators to delegate their KUB Coin to this node type, increasing staking power and the chances of the node validator to mine a block on the KUB network. Those considering pool staking should have at least 1,000 KUB and a computer connected to the internet, which must maintain 100% uptime.
Visit the StakeManager contract on KUB Scan
Connect your wallet on the Write Contract page
Select the stake function (Number 15) and input the following
signer - Your public address that was retrieved in the earlier steps, starts with
0x
delegation -
true
Send Native KUB - At least
1,000
KUB
Click on the Write button to confirm the transaction
Check your Validator ID by selecting the getValidatorID function on the Read Contract page and input your public address
StakeManager Contract
The StakeManager contract serves as the core of KUB's staking mechanism. All staking-related actions that users can interact with can be executed through this contract. It enables node runners to stake, unstake, restake, claim rewards, and configure their ValidatorShare contracts. The contract also handles reward distribution and slashing; the related information can be found in the events emitted for clarity.
Stake
stake(address signer, bool delegation) payable
signer
- The address of the EVM instance, starts with 0x
delegation
- Create a ValidatorShare contract and enable the delegation if set to true
; enable solo staking if set to false
payable
- KUB Coin required to stake, not exceeding uint128
This method requires KUB Coin to be sent as a value along with the transaction that calls this method. Upon staking, an NFT will be minted and given to the staker. The NFT represents ownership of the newly created node, including the states, configurations, ValidatorShare contract, etc., but not the EVM instance running to operate the chain.
If the delegation flag is set to true, a pool node will be created, along with the ValidatorShare contract of the node, allowing delegators to delegate their funds to your newly created node. If the delegation flag is set to false, a solo node will be created, and delegation on the node will not be possible. The NFT of a solo node cannot be transferred, but the NFT of a pool node can be transferred only through special means.
On creation, the infrastructure fee and the commission fee of the pool node will be set to the default value of 0%. You can change the commission fee by yourself after the node creation at the StakeManager contract on the updateCommissionRate method. The initial status of the node will be active. The signer's address of the newly created node will be added to the minimal validator set and can be selected as a block validator in a span.
The signer address cannot be used or become a node again unless the node is unstaked first.
Unstake
unstake(uint256 validatorId)
validatorId
- The token ID of the NFT that is received upon staking
Only owners of the NFTs can invoke this function, and the input validator ID must correspond to the token ID of one of the NFTs in the caller’s possession. Unstaking is not allowed for inactive nodes, and the official node cannot be unstaked using this function.
When a node is unstaked, the ownership NFT of the node will be burned, and the staked funds will be transferred back from the StakeManagerVault contract to the owner. Additionally, the node will be removed from the minimal validator set, and its status will be set to unstaked, resulting in it not being selected as a block validator anymore. The signer's address will also now be available to be used again.
All rewards earned by the model's staker will be sent to the node owner, including validator rewards, validator commissions, and delegator commissions. In the case of an unstaked solo node, there will be no validator commission or delegator commission.
The delegation flag inside the ValidatorShare contract will be set to false, preventing further delegation on the ValidatorShare contract side. However, delegators can still claim their rewards and undelegate their funds. The number of nodes will decrease by one, based on the type of the unstaked node.
Restake
restake(uint256 validatorId) payable
validatorId
- The token ID of the NFT that is received upon staking
payable
- KUB Coin required to stake, not exceeding uint128
Only owners of the NFTs can call this function, and the input validator ID must correspond to the token ID of one of the NFTs in the caller’s possession. The restaking of an inactive node is not possible.
This function increases the staked amount of the node with the funds sent in the transaction. If the node is not part of the minimal validator set before this function is called, and the final staked amount is greater than or equal to the minimum deposit amount, the signer address of the node will be included in the set. The funds will be transferred to the StakeManagerVault contract.
Retrieving a portion of your staked funds is not possible. The only way to retrieve your staked funds is to call the unstake function.
ClaimRewards
claimRewards(uint256 validatorId)
validatorId
- The token ID of the NFT that is received upon staking
Only owners of the NFTs can call this function, and the input validator ID must be the token ID of one of the NFTs in the caller’s possession.
The reward from the node that is not active cannot be claimed. The function is solely for claiming the validator reward, which will be transferred only to the owner.
ClaimCommissionRewards
claimCommissionRewards(uint256 validatorId)
validatorId
- The token ID of the NFT that is received upon staking
Only owners of the NFTs can call this function, and the input validator ID must be the token ID of one of the NFTs in the caller’s possession.
The reward from the node that is not active cannot be claimed. The function is solely for claiming the commission reward, which will be transferred only to the owner.
UpdateCommissionRate
updateCommissionRate(uint256 validatorId, uint256 newCommissionRate)
validatorId
- The token ID of the NFT that is received upon staking
newCommissionRate
- The new value of the commission rate
This function allows you to change the validator commission rate. The minimum value is 0
for 0%, and the maximum value is 5000
for 50%. For example, if the value is 1234, the result of the new commission rate will be 12.34%
The commission rate affects both the validator and delegator rewards. The higher this value, the more the rewards are reduced. The taken portions are combined and referred to as the commission fee.
UpdateMinDelegated
updateMinDelegated(uint256 validatorId, uint256 newMinDelegated)
validatorId
- The token ID of the NFT that is received upon staking
newMinDelegated
- The new value of the minimum delegated amount in the wei unit
This function allows you to change the minimum delegated amount. The minimum delegated amount is the expected minimum amount of delegated funds within a node.
This value is considered during delegation and undelegation. For delegation, if the final total delegated amount is less than the minimum delegated amount, the transaction will be reverted. For undelegation, if the final total delegated amount is less than this value, all delegated amounts will be undelegated instead of the desired value. The minimum delegated amount does not affect the existing delegated amounts of the users until delegation or undelegation is carried out by the users.
UpdateValidatorDelegation
updateValidatorDelegation(uint256 validatorId, bool delegation)
validatorId
- The token ID of the NFT that is received upon staking
delegation
- More delegation is allowed if set to true
; no more delegation is allowed if set to false
This function allows you to change the delegation flag of a node. The delegation flag indicates whether a node allows delegation by delegators.
If the delegation flag is set to false, no more delegations will be possible. However, the existing users, before the delegation flag was set to false, will still be able to undelegate and claim their rewards.
ValidatorShare Contract
The ValidatorShare contract is the core of the delegation mechanism of the KUB network. All delegation-related actions that users can interact with can be executed through this contract. In this contract, it's possible to delegate, undelegate, and claim your reward.
A ValidatorShare contract is created when a node validator is staked with the ValidatorShareFactory contract by the StakeManager contract. It is not intended to hold any funds through its capabilities. The ValidatorShare contract can be replaced as it is merely an implementation, with the data and funds located in other contracts.
Delegate
delegate() payable
payable
- KUB Coin required to delegate, not exceeding uint128
This method requires KUB Coin to be sent as a value along with the transaction that calls this method. This function can only be called when the delegation flag in the ValidatorShare contract is set to true.
Upon delegation, a token of the ValidatorShare contract will be minted in the same amount as the delegated amount to the sender. The token is the proof of ownership of the sender’s shares in the contract. It can be transferred and has the same standard functionality as other tokens.
When this function is called, the ValidatorShare contract’s states will be updated, and the pending reward of the sender will be sent to the sender. The sender's final total delegated amount (original delegated amount plus newly delegated amount) must be more than or equal to the minimum delegated amount. The funds will be sent to the StakeManagerVault contract.
Undelegate
undelegate(uint256 claimAmount)
claimAmount
- The amount of KUB Coin, in the wei unit, that will be retrieved from the ValidatorShare contract
Upon calling this function, the ValidatorShare contract’s states will be updated, and the pending reward of the sender will be sent to the sender. The maximum value of the claimAmount argument is the balance of the sender's ownership token, and it cannot be 0.
In the case where the final total delegated amount (the balance of the sender's ownership token as deduced by the claimAmount argument) is less than the minimum delegated amount, the value of the claimAmount argument will be adjusted to the sender's ownership token balance, meaning all shares of the sender will be undelegated. The ownership token will be burned according to the claimAmount argument, which may have been adjusted. The funds will be sent from the StakeManagerVault contract to the sender.
ClaimRewards
claimRewards()
Upon calling this function, the ValidatorShare contract’s states will be updated, and the pending reward of the sender will be sent to the sender.
Last updated
Was this helpful?