Bounty

solana: Method to withdraw all unstaked SOL from stake accounts

solana-labs
Apply Now →
Chain
Solana

Description

#### Problem MEV rewards from Jito are airdropped to stake accounts as excess, unstaked SOL. Stake accounts receiving those airdrops will see something similar to this: ``` % solana stake-account 74JwpCE61kJMdxaf9j2X5EpnkS1CiCoqoEoJPx5MBdCe Balance: 97.256865087 SOL Rent Exempt Reserve: 0.00228288 SOL Delegated Stake: 96.742412791 SOL Active Stake: 96.742412791 SOL ``` Note the difference between the Balance of the stake account and Active Stake. It looks like you could withdraw the excess SOL using existing functions, but this doesn't appear to work as the ALL keyword implies the full balance of the account: ``` % solana withdraw-stake --help solana-withdraw-stake Withdraw the unstaked SOL from the stake account ``` ``` <AMOUNT> The amount to withdraw from the stake account, in SOL; accepts keyword ALL ``` ``` % solana withdraw-stake 74JwpCE61kJMdxaf9j2X5EpnkS1CiCoqoEoJPx5MBdCe HKCgzSzVT92ZUDLj6hTeJnRgY6objrPDAbVr3xyxR6kY ALL Error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: insufficient funds for instruction [2 log messages] ``` (The client keypair is funded and specifying the --fee-payer doesn't have any effect) ``` % solana balance HKCgzSzVT92ZUDLj6hTeJnRgY6objrPDAbVr3xyxR6kY.json 102.301790691 SOL % solana withdraw-stake --fee-payer HKCgzSzVT92ZUDLj6hTeJnRgY6objrPDAbVr3xyxR6kY.json stake-account.json $(solana address) ALL Error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: insufficient funds for instruction [2 log messages] ``` #### Proposed Solution Add a new keyword like AVAILABLE, EXCESS, or UNSTAKED to calculate the difference between a stake accounts Balance and Active Stake. This makes it very easy to withdraw all unstaked SOL from stake accounts. Before Jito, this wouldn't be necessary - but with MEV being airdropped and excess SOL in stake accounts, this would be incredibly useful.

Required Skills

Not specified
Apply Now → ← Back to all opportunities
✓ Link copied!