Staking
Overview
Staking module manages validator related transactions and state for Heimdall. Note that a validator stakes their tokens on the Ethereum chain and becomes a validator. Respective validators send the transactions on Heimdall using necessary parameters to acknowledge the Ethereum stake change. Once the majority of the validators agree on the change on the stake, this module saves the validator information on Heimdall state.
Key management
For key management, please refer to Validator key management
Delegation
This module only manages validator staking on Heimdall. The delegation is only available on smart contracts on the Ethereum chain. To optimize the delegation rewards calculation on smart contracts, we are using validator shares (ERC20 per validator).
More details here: Delegation (Validator shares)
Rewards
All rewards are distributed on the Ethereum chain. The validators and delegators claim their rewards or re-stake by simply sending the transaction on StakeManager.sol
More details here: Rewards
Messages
MsgValidatorJoin
MsgValidatorJoin
handles the staking when a new validator joins the system. Once validator calls stake
or stakeFor
in StakingManager.sol
on Ethereum, and the new Staked
event is emitted.
Source: https://github.com/maticnetwork/contracts/blob/develop/contracts/staking/StakingInfo.sol#L27-L34
activationEpoch
is the checkpoint count from where a validator will become active on Heimdall.
Stake call on smart contract fails if slots are unavailable. Validator slots are the way to restrict a number of validators in the system. Slots are managed on Ethereum smart contracts.
Here is ValidatorJoin
message for Heimdall transaction:
MsgStakeUpdate
MsgStakeUpdate
handles the stake update when a validator the re-stakes or new delegation comes in. In either case, the new StakeUpdate
event is emitted.
Here is MsgStakeUpdate
message for Heimdall transaction:
MsgValidatorExit
MsgValidatorExit
handles the validator exit process after a validator initiates the exit process on Ethereum. It emits SignerUpdate
event.
Here is MsgValidatorExit
message for Heimdall transaction:
MsgSignerUpdate
MsgSignerUpdate
handles the signer update when a validator updates signer key on Ethereum. It emits SignerUpdate
event.
Here is MsgSignerUpdate
message for Heimdall transaction:
CLI commands
Validator details
By signer address
This command should display the following output:
By validator address
This command should display the following output:
Validator join
This command sends validator join command through CLI:
tx-hash
value must be the same as Ethereum TX hash which emitted Staked
event and log-index
must be the same at which index the event is emitted.
REST APIs
Name | Method | Endpoint |
---|---|---|
Get Heimdall validator set | GET | /staking/validator-set |
Get validator details | GET | /staking/validator/validator-id |
All query APIs will result in following format: