Staking an entity
Disclaimer: Content created from source code using generative AI. Contact us for clarifications or if you find mistakes in this document.
Stake lives in the Staking Registry. The sidecar needs stakingRegistryAddress in its configuration (or the SKANDHA_STAKING_REGISTRY_ADDRESS environment variable). If it is unset or zero, every entity reads as unstaked.
Whose address is staked
Section titled “Whose address is staked”The registry keys everything off msg.sender. Stake the role’s own address, not just “your key”.
- A plain EOA
sender(the self relay shape, where the sender is its own payer) can calladdStakedirectly from its own funded key. - A
payerorfactorycontract cannot be staked by callingaddStakefrom your own key. That would only stake your EOA. The contract itself has to calladdStakeas part of its own logic. Staking a contract entity needs a purpose-built contract with anaddStakeforwarding call. - A contract wallet can stake itself with no special code: in a self relay transaction the
SENDERframe calls astx.sender, so aSENDERframe that targets the registry withaddStake(86400)and a value makes the wallet the staker.
Walkthrough on the devnet (self relay)
Section titled “Walkthrough on the devnet (self relay)”- Fund your own key from the shared devnet key.
- Call
addStake(86400)on theNaiveStakingRegistry(0xd51c04d7a0b01124e84de152f4e56d9eecb22d2fon the devnet) from that key. Send more than the node’sminStakeas the value. The sidecar’sBALANCE/SELFBALANCEcarve-out checksstake > minStakestrictly, while the other staked-entity thresholds use>=. The devnet’sminStakeis 0.01 ETH, and the workshop stakes 0.012 ETH. - Submit a Frame Transaction using the self relay shape (
[self_verify]) from that key astx.sender. - Check the admission report with
skandha_explorer_getTransaction. It shows the staked-entity permissions applying: wider associated-storage access,BALANCEandSELFBALANCEallowed, and the staked gas budget as the effective cap. - Call
unlockStake()to start a withdrawal, and after the delaywithdrawStake(yourAddress)to get the ETH back.
Calling unlockStake() alone drops every staked-entity permission immediately, because the registry’s withdrawTime becomes non-zero. This is the rule STAKING-010. The explorer’s reputation view shows the state as “unlocking”, which is distinct from “staked”.
Safety
Section titled “Safety”Never stake from the shared genesis key or the published deployer key. Anyone holding those keys can call unlockStake and withdrawStake and take the funds.
Minimum unstake delay
Section titled “Minimum unstake delay”ERC-8421 requires an unstake delay of at least MIN_UNSTAKE_DELAY (86,400 seconds). The sidecar’s documented default for minUnstakeDelay is 0 (TBD).