Ethereum Delegated Staking and Validator Hub
Overview
Ethereum Delegated Staking is implemented via the Validator Hub.
Validator Hub is a module that allows users to delegate-stake with a node provider of their choice.
Node providers run servers with validator keys, and user's stake is deposited to a key within the chosen provider.
Node providers & validators
A node provider is a legal entity that provides delegate-staking services and is registered in Ankr's Validator Hub.
A provider can have multiple validators, which it adds them to the server and waits for a user deposit.
A provider can choose an insurance policy, a fee (a % of MEV & tips to keep; a direct financial incentive for the node provider). All this applied to all validators within a specific provider.
Staking modes
- Node staking — direct staking.
- vNFT staking — the user gets an NFT (vNFT) as proof of validator ownership.
The user can get either 1 vNFT per validator or a single vNFT for all their validators. The vNFT is fully operable and transferable, and can be used in DeFi activities, such as using it as collateral or buying/selling it to exit with no unbonding period. The current vNFT owner is able to claim the rewards and trigger unstake.
Staking process
The user deposits to Ankr any amount of ETH that is multiple of 32 and chooses a node provider. Ankr chooses a validator within this node provider and deposits 32 ETH to it, which causes the validator to start the activation process. When the validator is fully activated, it starts to perform its duties (proposing blocks, attesting blocks, getting rewards).
Rewards
Node staking
After the validator activation, the user starts to receive rewards to their withdrawal address, which the user chose when staking their ETH. Ergo, this address isn’t necessarily the same addr the user deposited ETH from.
Technically, the rewards accumulate at the validator’s address and are released to the user’s withdrawal address each 7 days on average (the actual time depends on the current queue size).
vNFT staking
After the validator activation, the attestation rewards start to accumulate at the vStaker contract each 7 days on average (the actual time depends on the current queue size), where they can be claimed by the vNFT holder via the ETH Validator Hub dashboard.
MEV & tips
Node staking
From the moment the user has staked their ETH with a node provider, the user starts to receive a % of MEV & tips, according to their share with that provider and the provider's policy.
vNFT staking
From the moment a validator is activated and starts to perform its duties, a % of MEV & tips allocated for the user starts to accumulate and can be claimed by the vNFT holder via the ETH Validator Hub dashboard.
Unstaking process
Node unstaking
The unstaked amount and attestation rewards are automatically released to the withdrawal address chosen by the user at the staking stage. The unbonding period for unstakes is currently up to 5 days on average. The release period for the attestation rewards is 7 day on average. MEV & tips from all validators within the node provider bound to the user are instantly released to the address the user staked from, even if unstaking was only from 1 validator.
vNFT unstaking
The unstaked amount, attestation rewards, and MEV & tips are released to the vStaker contract instance associated with the vNFT contract. The user can then claim them from the ETH Delegated Staking dashboard. The unbonding period for unstakes and release period for the attestation rewards are currently up to 7 days on average. MEV & tips are released instantly from all validators within the node provider that are bound to the vNFT, even if unstaking was only from 1 validator.
Architecture
Validator Hub is implemented as a set of smart contracts, a backend, and a frontend.
- The smart contracts implement:
- Receiving the stake.
- Storing the stake before it is deposited to a validator.
- Keeping the validator-user map.
- Managing validators (allowing the user to choose a validator when unstaking).
- Pre-depositing and activation of a stake.
- Collecting and distributing MEV & tips.
- The backend implements:
- Validator monitoring logic (checks against a front-running attack, slashing event).
- Binding a validator to a stake (32 ETH).
- Depositing to a validator (on the consensus layer) and exiting a validator (on the consensus layer).
- Generating vNFT details (pic, name, desc, etc).
- The frontend implements the user interface for interacting with the Validator Hub.
Requirements
- Stake amount per validator — 32 ETH.
- Specific node provider (allowing the user to choose one from the list).
- No direct staking to a vNFT contract, only through our contracts (we only store variables when the user stakes through our contracts).
- When unstaking in the vNFT mode, MEV & tips are released from all validators within the node provider that are bound to the specific vNFT, not from a single validator. Even if the unstake was from a single validator.
Smart Contracts
- Marketplace — entry point for the users; allows a user to stake and unstake with a chosen node provider.
- ProviderVault — receives, stores and stakes 32 ETH onto a validator key associated with a specific node provider; receives and stores MEV & tips associated with a specific node provider. Deployed as a separate instance for each provider.
- ProviderVaultManager — entry point for node operators; allows a node operator to register and deploy an instance of ProviderVault.
- StakingConfig — stores the main variables (addresses of all other Hub contracts, Ankr technical service fee).
- vNFTFactory — creates vNFTs and deploys vStaker instances.
- vStaker — manages stakes made via vNFT. Deployed as a separate instance for each vNFT.
Available managing actions: stake, unstake, claim rewards. The stakes are accessible only to the current vNFT owner. vStaker also serves as the withdrawal address for the attestation rewards. The owning rights of a vStaker instance are held by the current vNFT owner and are transferred along with the vNFT.
Addresses
- Marketplace (opens in a new tab) (0x4017Edf31956a48BA51779D973fbE759182Ff5A0)
- ProviderVault (Ankr) (opens in a new tab) (0xe6971403250C699F29540d26ba64C57375686e69)
- ProviderVaultManager (opens in a new tab) (0x0aC734B60EE55563968E373f2361A56892Ac0DfF)
- StakingConfig (opens in a new tab) (0xC78F464d3D92f8E191cAd28771a52faCAB90D723)
- vNFTFactory (opens in a new tab) (0x2D0D1B6fFc279A0890c04A705DFde6acf5482F33)
- vStaker (implementation) (opens in a new tab) (0x4c9A360a07FC6F21E0bdcC7caA7d3D4eF8aB3Aba)
Workflow
Node staking
- The user calls
Marketplace::stake(address provider, address withdrAddr)
whereprovider
is the chosen node provider andwithdrAddr
is the user-chosen withdrawal address. AStakedToVault(address provider, address staker, uint256 amount, address withdrawalAddr)
event is emitted.- The backend reacts to the
StakedToVault
event, binding a validator to the stake. - The backend calls the following function of the
ProviderVault
instance associated with the current provider, which causes a deposit of 1 ETH to the validator, from the staked amount.function batchDeposit( bytes[] calldata pubkeys, bytes[] calldata signatures, bytes32[] calldata depositDataRoots )
- The backend updates the stake status to pending predeposit. This status is due to the initial deposit of 1 ETH to the validator as a security measure (not to allow to withdraw 32 ETH instantly at once).
- Upon the succesful deposit tx, the backend changes the stake status to predeposited.
- The backend calls the following function
ProviderVault
instance associated with the current provider, which causes a deposit of the remaining 31 ETH to the validator, from the staked amount. Atfer the call, the backend updates the stake status to pending deposit.function batchActivate( bytes32[] calldata pubkeyHashes, bytes[] calldata signatures, bytes32[] calldata depositDataRoots )
- Once the validator has been activated, the backend changes the stake status to staked.
- The backend reacts to the
vNFT staking
- The user calls
vNFT::mint(address provider)
whereprovider
is the address of the node provider. The caller also assigns the staking amount to the transaction. The following logic within the transaction:- A mint of 1 vNFT associated with the chosen number of validators.
- For this vNFT,
vNFT Factory
deploys an instance ofvStaker
. vStaker
then executes the whole logic of Node staking (see above), passing its own address in thewithdrAddr
input param.
Claim rewards and MEV & tips (Node)
- To collect MEV & tips, the user calls
Marketplace::claimRewards(address provider, address staker)
whereprovider
is the address of the node provider andstaker
is the address the user staked from. The attestation rewards are auto-released to the withdrawal address the user chose when staking.
Claim rewards and MEV & tips (vNFT)
- The user calls
vStaker::claim()
to receive the MEV & tips and attestation rewards. The attestation rewards are accumulated in portions, on average each 7 days per validator.
Node unstaking
- The user calls
Marketplace::unstake(address provider, bytes32[] calldata pubkeyHashes)
whereprovider
is the address of the node provider,pubkeyHashes
is an array of validators pubkeys each hashed through the keccak256 function. Then the following internal logic is executed:- The MEV & tips are auto-claimed to the address the user staked from. It happens via an internal transaction from
Marketplace
toProviderVault::claimRewards(address stakerAddr)
. - A
ValidatorsUnstaked(address provider, address staker, bytes32[] validatorHashes)
event is emitted. - The backend reacts to this event by changing the stake status to pending exit.
- The backend triggers an exit by calling Ankr's Beaconchain node on the consensus layer.
- The backend changes the stake status pending unstake.
- After the unbonding period of 7 days on average, the unstaked ETH is released to the withdrawal address (
withdrAddr
). - The backend updates the stake status to unstaked.
- The MEV & tips are auto-claimed to the address the user staked from. It happens via an internal transaction from
vNFT unstaking
- The user calls
vStaker::unstake(bytes32[] calldata pubkeyHashes)
wherepubkeyHashes
is an array of validators pubkeys each hashed with the keccak256 function.vStaker
then executes the whole logic of Node unstaking (see above). Note that the withdrawal address is thevStaker
instance address, and the released assets (unstake, rewards, MEV & tips) need to be manually claimed by the user.
- Once the assets are available for claiming, the user claims them via
vStaker::claim()
. Note that the assets become available at a different timing: unstake and attestation rewards become available after the full validator withdrawal (7 days on average), MEV & tips become available instantly.