Staking Precompile
This page is intended for developers looking to build smart contracts or interfaces that interact with the staking system.
The entrypoint to the staking system is the stateful staking precompile.
This precompile allows delegators and validators to take actions that affect the composition of the validator set.
- join the validator set (
addValidator) - delegate their stake to a validator (
delegate) - undelegate their stake from a validator (a multi-step process:
undelegate, waitWITHDRAWAL_DELAYepochs, thenwithdraw) - compound the rewards they earned as a delegator (i.e. delegate the rewards)
(
compound) - claim the rewards they earned as a delegator (
claimRewards)
For ease of integration, please see the Solidity Interface and the ABI JSON.
Although users may delegate or undelegate at any time, stake weight changes only take effect at epoch boundaries, and stake weight changes made too close to the epoch boundary get queued until the next epoch boundary, as described in Staking Behavior. This is to allow for the separation of consensus and execution, one of Monad's core design attributes.
Only standard CALLs are allowed to the staking precompile. In particular,
STATICCALL and DELEGATECALL are not allowed.
Because the staking system is a precompile and not a smart contract, you cannot test against it in a forked environment.
Precompile Address and Selectors
The contract address is 0x0000000000000000000000000000000000001000.
The external functions are identified by the following 4-byte selectors.
External state-modifying methods:
addValidator(bytes,bytes,bytes)-0xf145204cdelegate(uint64)-0x84994fecundelegate(uint64,uint256,uint8)-0x5cf41514withdraw(uint64,uint8)-0xaed2ee73compound(uint64)-0xb34fea67claimRewards(uint64)-0xa76e2ca5changeCommission(uint64,uint256)-0x9bdcc3c8externalReward(uint64)-0xe4b3303b
External view methods:
getValidator(uint64)-0x2b6d639agetDelegator(uint64,address)-0x573c1ce0getWithdrawalRequest(uint64,address,uint8)-0x56fa2045getConsensusValidatorSet(uint32)-0xfb29b729getSnapshotValidatorSet(uint32)-0xde66a368getExecutionValidatorSet(uint32)-0x7cb074dfgetDelegations(address,uint64)-0x4fd66050getDelegators(uint64,address)-0xa0843a26getEpoch()-0x757991a8
Syscalls:
syscallOnEpochChange(uint64)-0x1d4e9f02syscallReward(address)-0x791bdcf3syscallSnapshot()-0x157eeb21