Withdrawals in the Stakehouse Protocol
Overview
This article will walk you through what happens with ETH from the moment it flows through the Stakehouse protocol to the Ethereum deposit contract and back to its owners from the perspective of the Liquid Staking Derivative Network application built on top of the Stakehouse protocol. The Stakehouse protocol offers programmable yield distributable to anyone through its smart contract suite.
ETH Lifecycle Through the Stakehouse Protocol
Flow of ETH in the protocol:
Firstly we look at the flow of ETH into the Protocol.Through a sequence of steps matching the diagram:
- Users deposit ETH into the pool of their choice. The Protected Staking pool allows a maximum deposit of 24 ETH per validator and the MEV and Fees pool allows a maximum deposit of 4 ETH per validator and the node operator puts up 4 ETH per validator. Similar deposits can be made via the giant pools which will reach these pools once all the ETH is enough for a validator to be staked. For every deposit, the users get an equal number of LP tokens (Proof of Liquidity for deposit) which marks their ownership of a validator.
- Once there is 32 ETH collected towards a validator, the Liquid Staking Manager pulls ETH from the respective pools and sends it to the Stakehouse Protocol contracts.
- Stakehouse Protocol then sends these 32 ETH per validator to the Ethereum Deposit contract for the validator to be activated.
- After the validator is active on the consensus layer, the derivatives (24 dETH and 8 SLOT tokens) are minted. The LP tokens of the users who deposited in the Protected Staking pool account for the dETH minted. They can burn their LP tokens to redeem dETH. Similarly, the LP tokens of the user who deposited in the MEV and Fees pool account for the SLOT tokens. They need not burn their LP tokens, as they will earn ETH for holding it. Similarly, the node operator keeps earning ETH for the node running service.
- The consensus layer sends ETH periodically to the withdrawal address appointed by the node runner for their validator. The Stakehouse Protocol makes sure that the withdrawal address is of the account manager and will ensure correct distribution of ETH to tokens held by the protocol. Eventually when the node operator (or the LSD DAO) decides to exit the validator, they need to broadcast an exit message on the consensus layer. After the validator's earnings have been processed by the consensus layer, it sends all the remaining ETH to the withdrawal address (account manager).
- Rage quit assistant is a contract that not only manages all the incoming derivatives and distribution of unstaked ETH in exchange for the derivatives, but also helps to rage quit. It can be deployed by anyone and not just the node operator.
- For the ETH to be deposited into the rage quit assistant, all the derivatives that were minted first need to be deposited into the assistant. The assistant makes sure that the exact number of required derivatives are deposited and burned during the Rage quit.
- After a successful rage quit, the ETH that was received by the Account manager from the consensus layer is deposited into the rage quit assistant.
- Users are now eligible to claim their unstaked ETH in exchange for the derivatives deposited into the rage quit assistant. All the users receive a pro rata share of ETH depending on the amount of LP tokens they hold.
This concludes a full flow of ETH which started with user depositing their ETH, staking for a validator, minting derivatives, exiting and getting back their initially deposited ETH with some extra ETH rewards earned for running the validator service.
Mechanism of Unstaking For LSD Validators:
More details on how the unstaking mechanism works:
- Firstly, the node operator is required to broadcast an exit message on the consensus layer. We can define the node operator as the entity in possession of the signing key. They can do this with the help of the LSD dapp, Stakehouse dapp or the Stakehouse SDK. For more information about the Stakehouse SDK see: [here]. This is the only step that requires the node runner to execute. All the other steps until the claiming of unstaked ETH can be performed by anyone.
- In around 2 epochs, the message is broadcasted to all of the nodes and the BLS public key is marked as "Exiting" on the consensus layer.
- One of the next things to take care of before it is even possible to claim the unstaked ETH from the consensus layer is to burn the derivatives minted within the Stakehouse protocol. ETH is only released from the Stakehouse protocol once the derivatives associated with a validator are burned. This process is referred to as the rage quit of the validator from the Stakehouse.
- Due to the fact that a validator in LSD is partially owned by LPs from the 3 user buckets, we will need some help performing the rage quit - enter the Rage Quit assistant. While the status is "Exiting" on the consensus layer, the LSD validator is allowed to proceed with deploying a rage quit assistant. When a rage quit assistant is deployed, a voluntary withdrawal is also reported to the Stakehouse protocol which informs the smart contracts that the validator has initiated an exit and is ready to rage quit and then eventually unstake. This is where the steps slightly deviate for a solo staker, but the process still remains the same. This will be discussed in the next section.
- The rage quit assistant works as a middleman that collects all the required derivatives from the users which can be burned for ETH received from the consensus layer.
- Upon deployment, the rage quit assistant will automatically get collateralised sETH tokens and any dETH available from the respective protected staking pool unless all of the dETH derivatives have been withdrawn from the protected staking pool.
- The users can then deposit any missing dETH into the rage quit assistant until the maximum allowed deposit amount.
- Now the rage quit assistant has all the required derivatives, which can be burned for ETH. This step is referred to as the Rage Quit.
- Once the rage quit has been successfully attempted, any user can unstake the validator. Unstaking requires users to report all the withdrawals (sometimes referred to sweeps that are paid whilst the validator is active) from the consensus layer for maximum redeemable ETH. Once the sweeps are reported and unstaking executed, ETH is moved from the Account Manager into the rage quit assistant.
- As soon as ETH reaches the rage quit assistant, all the LP holders can go ahead and burn their LP tokens in exchange of ETH. Protected stakers in most cases will get at least 24 ETH back, fees and mev no more than 4 ETH and node runners 4 ETH too. This completes the return of the ETH. It means that even if you are an LP that contributed 0.01 ETH towards the creation of a validator, you can claim that back once the derivatives are burnt. All settled at a smart contract level.
Unstaking for solo stakers:
Some information for solo stakers:
- For the solo stakers, the unstaking is rather a direct step and no rage quit assistant is deployed, unless there are multiple collateralised owners of the BLS public key or the user does not have all of the derivatives required to rage quit (perhaps they sold their 24 dETH). In such a case that a user requires the use of a rage quit assistant, they can try and track down lenders or a protocol that will help them exit and in exchange the lenders get a slippage free exit to ETH and potentially earn some inflation rewards in the process for doing so!
- Once the node runner initiates an exit on the consensus layer, the user needs to isolate the required amount of dETH tokens.
- After isolating the dETH tokens, the user needs to perform a balance report. This is necessary as the contracts will have the updated report of the validator and the user will be asked to do a top up if the validator was leaking.
- After all the derivatives are accounted for, the user can go ahead and perform a rage quit which will burn the derivatives.
- Once the rage quit is performed, the user can proceed with reporting sweeps and unstaking the validator. Since the user was a solo staker and the one and only collateralised owner of the validator, they receive all the unstaked ETH.
For a step by step guide on how to unstake a validator using the Stakehouse SDK follow this tutorial