bigzPubkey
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Margin Staking: A Comprehensive Guide [DRAFT] **This is a draft writeup for informational purposes only** ## Introduction This piece explores the potential risks and rewards associated with employing a **Margined Staking strategy**. The objective of this strategy is to collect more blockchain staking rewards while minimizing the initial capital investment required. To achieve this, the strategy involves utilizing a Liquid Staking Token (LST), which serves as a tradable token representing locked or staked cryptocurrency, thereby granting liquidity to the previously illiquid tokens. ### screenshot from this [Margined Staking Calculator](https://driftv2.streamlit.app/?tab=SuperStake) ![](https://hackmd.io/_uploads/S1G-dAYdh.png) **note: these are constantly varying rates** "Margined Staking" is also under terms like: - "Super Staking" - "Levered Staking" on Solana, an example could include - acquire SOL to stake and recieve a LST (e.g. mSOL) - deposit the LST in a DeFi program and access margin to borrow additional SOL - call recursively until desired target (or once through a single flash loan) This recursive process, while amplifying the potential rewards, also compounds the risks associated with leverage. We explore both the user and defi program risks associated with this. The math for calculating the projected returns is available in the [Appendix](#Appendix) ## User Risks ![](https://hackmd.io/_uploads/rkDTzpgdn.png) Leverage staking, while offering high projected returns, also comes with a fair share of risks. Users interested in this strategy should take several key considerations into account: * **Liquid Staking Rewards**: returns anticipated from staking tokens with network validators. * **Borrow Rates**: The sustainable execution of leverage staking relies on the premise that the projected borrow rates will remain lower than the staking rewards. * **Miscellaneous Fees**: Operating in DeFi involves various transaction fees. The most common include Layer 1 (L1) transaction fees, borrow origination fees, implicit rounding fees, and those incurred while unwinding positions, which might require asset swaps or other additional procedures. These costs need to be factored into the strategy to ensure profitability, which may require a sufficiently long time horizon. * **Duration Mismatch**: the staking rewards and borrow rates are applied at during frequencies (epoch changes (2days) and continuous). Timing of entering / exiting around epochs can alter returns. * **Finite Capacity**: Implementing a leverage staking strategy requires borrowing assets, effectively putting them to use within the network. If the interest paid to borrow the asset exceeds the staking reward, the strategy becomes unprofitable. It's essential to note that these rates are dynamic, which means that the profitability of the strategy will fluctuate over time. * **Crowding Risk**: This term refers to the risk associated with the liquidity of leveraged staking tokens (e.g., mSOL). In the event of mass exits during market downturns, these tokens could trade at a discount. The discount could be severe enough to trigger liquidation for a levered staker. * **Withdraw Risk**: DeFi programs often implement withdrawal limits which may hinder the timely execution of withdrawals or even unwinding one asset into another (if it requires external liquidity). * **Oracle Reliablity**: The DeFi program utilizing an external oracle price for the token borrows. In cases where these oracles falter or inaccurately report prices, it may lead to challenges in withdrawals, unwinding, or even cause unexpected liquidation losses. Considering these factors, we can develop a risk spectrum associated with different activities involving a token: | Risk Level | Activity | |------------------|--------------------| | High Risk | Leverage Speculation | | High Risk | Leverage Staking | | Medium Risk | Lending | | Medium Risk | Staking | | Low Risk | Hodl | Although leverage staking is a high-risk activity, the correlation between lent and borrowed assets for the position tends to decrease the likelihood of liquidation compared to other forms of leverage speculation. However, it combines the risks of lending and staking, with the primary concern being the divergence in tail events. Additionally, DeFi programs offering leverage or lending may themselves become insolvent, posing a further risk. To help mitigate these risks, active management and monitoring are recommended, ideally with the assistance of a well-structured bot or other tooling. These tools can increase reaction speed in times of market distress and provide a more resilient strategy without reliance on external client interfaces. Lastly, one requires strong conviction in the DeFi program, the blockchain, and the liquid staking token program. If the margining risk parameters are dynamic or adjustable, or if the blockchain experiences downtime or costly state contention, the strategy may face liquidation or unexpected losses. The realm of possibilities for things that can reasonably go wrong seems endless, but all margin strategy carry similar tail risks. Less leverage decreases (but never eliminates) these risks. ## Margin Protocol Risks ![](https://hackmd.io/_uploads/SJ8TbRgu3.png) *"Whales" here is used loosely, consider yourself fortunate if you classify* Important aspects to consider for a base layer protocol offering margin through a borrow-lend model are: * **Avoid excessive utilization**: At high utilization rates, lenders can face difficulties withdrawing their funds. If margined stakers are lending their Liquid Staking Tokens (LSTs), they could be unable to unwind their positions if utilization is too high. Although it may be unlikely for someone to fully borrow an LST except in the event of an LST implementation flaw, this risk still exists for lenders. * **Prevent bankruptcy**: The best way for a protocol avoid bankruptcies is by offering lower leverage for large positions and sourcing sufficient liquidity for the market's open interest, even in tail events. Adding borrow liquidity limits can help ensure these boundaries do not get crossed too far. * **Ensure robust insurance for lenders**: An insurance fund can be built using a portion of the borrow fees from DeFi programs. For example, a fraction of SOL borrow fees can be directed towards the SOL market's insurance fund. To help bootstrap the fund to a sufficient size, external stakers can be allowed to participate, earning a portion of the fund's revenue. It's crucial to ensure that insurance is in the same denomination as the debt to avoid potential price issues. Isolating risks across different markets is a valuable safety feature. If one market experiences a failure – for instance, significant losses due to high leverage – it should not adversely impact the insurance or integrity of another market, assuming all other conditions remain the same. This approach ensures that risks do not spread across markets and that losses are contained within the market in which they occurred. If the event of bankruptcy and insufficient insurance, its important for the program to gracefully handle these losses. Typically, this is done through socializing the loss across all the lenders for an asset where a counterparty ended up bankrupt. ## LST Token Risks Holding an LST token can underperform direct staking in a few ways. For example: mSOL is issued by Marinade Finance, which charges a flat 6% fee over all the pool's rewards from staking. This is on top of the already custom and alterable validator fees. Additionally, all mSOL holders socialize all the validators staking performance (rewards + slashes). That is, one user direct staking with a single validator and recieving mSOL means every mSOL holder gets a sliver of that validator's performance. Given the [warmup/cooldown period rules with staking](#SOL-Stake-Delegation-Rules) large enter and exits into mSOL can degrade performance for holders. This issue has been explored and discussed in [Marinade's forum](https://forum.marinade.finance/t/mdao-proposal-introduce-delay-unstake-fee-0-1/481) with potential solutions involving fee changes. Since the LST program and parameters are mutable, any fee structure can change over time and should be considered. Other details in the mechanics of the staking pool may lead to unexpected performance. mSOL operates of shares of SOL available, so all acrued value shows up in the mSOL "share" price and balances remain unchanged. This is opposed to [Lido's stETH](https://stake.lido.fi/) which periodically rebases a holder's balances. > stETH is a transferable rebasing utility token representing a share of the total ETH staked through the protocol, which consists of user deposits and staking rewards. Because stETH rebases daily, it communicates the position of the share daily. ## Example Calculations for Margin Staking In early development stage is [this calculator](https://driftv2.streamlit.app/?tab=SuperStake) ([source code here](https://github.com/0xbigz/drift-v2-streamlit/blob/main/superstake.py)), where one can assess detailed information about the leverage staking rewards / risks. This calculator considers the "impact" (borrow rates, margin, etc) of proposed stakes using drift protocol-v2 and calculates the expected annualized rewards in SOL for a given size / leverage. [This v2-teacher documentation](https://drift-labs.github.io/v2-teacher/#margin-system) describes the margin system formulation. ### small position size - divergence amounts. at 3x leverage of a small position size @ ~20% depeg, while lower leverage allows for much more room on depeg. ![](https://hackmd.io/_uploads/H1bt62x_3.png) 18.5% decrease in mSOL price OR 22.7% increase in SOL price (all else equal) This depeg in price can be viewed as a mSOL/SOL ratio. if mSOL denominated in SOL falls to the liquidation price line. Be sure to inspect for relevant size, as the liquidation price would get more strict. ![](https://hackmd.io/_uploads/B1ewBCY_n.png) ### larger position size - the calculator also incorporates size discount factors (IMF factors) for large size positions - for larger sizes, [the IMF factors](https://twitter.com/bigz_Pubkey/status/1656647671325622273) kick in liquidate at smaller diverges than ordinary. For example, paying with the calculator, the liquidation divergence gap becomes more strict at larger sizes (30k mSOL after leverage -> ~13% divergence). With the aid of this calculator, you can observe how the liquidation divergence becomes narrower at larger sizes. For example, a very large position size may not even accommodate 3x leverage, as even minor divergences could trigger liquidation. Plot showing how larger size increases the Liquidation Price (at 2x leverage). Starting with ~80k mSOL, and then attempting 2x leverage (160k mSOL with >80k SOL borrow), puts the liquidation price very close to the current price. ![](https://hackmd.io/_uploads/BJrn4AYun.png) Note that the price level change of mSOL or SOL would not impact these protocol size discounts factors (since they are applied to the token sizes). However, when permitted, a DEX could update these risk parameter factors, so always be cautious and monitor at larger sizes. ## Historical Analysis of Margin Staking ### Rates [historical stake yields](https://hackmd.io/izS7KqSPQJ-cnVHyFSa6xQ?both#Appendix) for mSOL ![](https://hackmd.io/_uploads/r1OVz4Gdn.png) SOL token's annualized interest rate curve from drift protocol-v2 (as of June 22, 2023). Above 60% utilization makes the marginal value of the strategy unprofitable (where heading to 100% is painful for borrows). ![](https://hackmd.io/_uploads/Hki6N4f_3.png) Looking back many months, drift-v2 SOL utilization has varied between 0-30%. ![](https://hackmd.io/_uploads/ryHu84GOn.png) A rough estimation based on these plots suggests that the staking yield on mSOL is ~6%, while SOL borrow rates have averaged ~1-2% on drift-v2. This implies that leveraged staking would have had a positive marginal value. Clearly the borrow rates are volatility so actively monitoring is important for any profit sensitive margining. While incentives should be aligned for unprofitability to never to way too high (lending SOL yields exceed staking), the attention + contract-risk premium to statistical arbitrage on-chain activity should never assumed. ### Price Unfortunately the [Pyth Oracle for mSOL](https://pyth.network/price-feeds/crypto-msol-usd?range=1M&cluster=mainnet-beta) doesn't show history beyond a month (and even so their chart's grouping method used for lower resolution may smooth or high high/low values). but looking through other historical data sources of LP pools and a [personal account by @0xSoju](https://twitter.com/0xSoju/status/1671076506200850434) and reveal that a depeg of about 15% was realized around November 9th, 2022 (FTX insolvency news event). ![](https://hackmd.io/_uploads/BycltZGu3.png) Can see that the [fair value of mSOL](https://stats.marinade.finance/d/sqUQd1Onk/marinade-kpi-dashboard?orgId=1&refresh=1m&from=now-1y&to=now) is stable, and "up only" (without Solana blockchain slashing), so this depeg was primarily a liquidity discount (and perhaps also a broader Solana blockchain concern). ![](https://hackmd.io/_uploads/rysm5Zf_h.png) Zooming out, we see the actual mSOL appreciation comes from epoch changes (~2 days). ![](https://hackmd.io/_uploads/Hy3UNAtO3.png) The liquidity discount arises because the staking and unstaking processes isn't atomic, and necessitate warmup and cooldown periods. #### SOL Stake Delegation Rules Staking requires a waiting period spanning multiple epochs before rewards can be accrued. Staking and unstaking activities are formally conducted at epoch boundaries, which typically span 2-4 days on average. The duration of these processes varies depending on the specific timing within an epoch and the length of the epoch itself. You can read more and see examples in the technical docs around [Stake Delegation and Rewards](https://docs.solana.com/cluster/stake-delegation-and-rewards). ### Liquidity Below is the instant unstake pool by Marinade. After the November 9, 2022 event, the Marinade DAO [proposed](https://forum.marinade.finance/t/dao-proposal-liquid-unstake-pool-parameters-change/423) and updated to a stricter [dynamic fast withdraw fee structure]( https://docs.marinade.finance/faq/faq#unstake-now). ![](https://hackmd.io/_uploads/Hy2aGzzuh.png) ## Conclusion ![](https://hackmd.io/_uploads/HyocIvV_n.png) Key observations highlight that this is a low-capacity strategy, highly dependent on the availability of cheap SOL for lending. Since SOL utilization can fluctuate, crowding can lead to this strategy becoming unprofitable. Additionally, a lot of conviction must to placed in both the margining and the LST token programs. Many DeFi strategies have limited capacity. Hence, savvy users often keep a low profile and avoid stretching the limits too far due to diminishing marginal returns. Passive participation in this strategy could work, but only if it remains niche and does not gain wide-spread popularity. ## Appendix let $LST$, be the liquid staked token, $T$ be the unstaked token, and $Price_{LST/T}$ is the price of `LST` denominated in `T`. This price should grow over time as staking rewards accumulate. Also assume $leverage$ = 1 means no borrow is opened. **LST Deposit Amount:** $$ LST_{levered} = LST_{collateral} \times leverage $$ **Token Borrow Amount:** $$ T_{borrowed} = LST_{collateral} \times (leverage - 1) \times Price_{LST/T} $$ **Leverage Stake Yield** - Inflows: $$ inflows_{LST} = LST_{levered} \times (r_{stake} + r_{lend_{LST}}) $$ - Outflows: $$ outflows_{T} = T_{borrowed} \times r_{borrow_{T}} $$ - Token Net Reward: $$ NetReward_{T} = (inflows_{LST} \times Price_{LST/T}) - outflows_{T} $$ - Token Yield: $$ Y_{T} = \frac{NetReward_{T}}{LST_{collateral} \times Price_{LST/T}} $$

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully