2

I'm struggling with understanding of what's happened in tx 1GQA7ZcU63Wqm5gUUkhCnKa8dwzwK91c5bEPKcUvesgmkbauU5nH865PKXkUhD8s8HmTV1URtDG6WqYN3h9z5ET

As I can see, System Program: Withdraw Stake was called on address 29cNLaThXtnyh43ghxRvScbDaJ2EtcmmdJUf69pkLax7 in instruction 1.2, but the problem is: this account had been delegated before this instruction. System Program: Withdraw Stake instruction can only be applied to undelegated stake account, but there wasn't any undelegations of this account before this tx in account's history.

How is it possible ? Or maybe this account was undelegated and I missed something ?

1 Answer 1

1

Withdraw Stake instruction can only be applied to undelegated stake account

This is correct. The staking rule is that delegated lamports cannot be withdrawn, and that "all" the lamports in the stake account must be delegated. Following this, it's safe to conclude that it's impossible to withdraw any lamports from a delegated stake account.

However there's an exception. The rent-exempt lamports of the stake account can not be delegated. So technically the rule is "all lamports in the stake account, except the rent-exempt lamports, must be delegated".

Since the rent-exempt lamports are not delegated, they can be withdrawn. Hence why the value of the withdrawal is small (0.00228288)

Edit: A slight correction. As Jon C was kind enough to point out in the comments, the rent-exempt balance still has to remain in the account to prevent it from being purged. However, lamports can still be received by a stake account after it has been delegated but won't count as part of the account's delegation, making them withdrawable.

4
  • Oh, seems legitimate, but when I try to withdraw small amount (0.001 SOL) from delegated stake acc using solana cli, I receive this error: Error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: insufficient funds for instruction [2 log messages] (I have 3 SOL on devnet). It's because of implementation in solana cli, isn't it ?
    – Gohnny
    Commented Mar 9, 2023 at 15:03
  • And what happens with stake acc, when those rent-exempt lamports are withdrawn ? Will this acc be deleted with all staked lamport ? Or maybe delegated stake will become rent-exempt lamports ?
    – Gohnny
    Commented Mar 10, 2023 at 9:59
  • Oh, I got it, after merge, in destination stake_acc there are two rent-exemption amount of lamports + 2 delegated amount of lamports from two accounts. But we can withdraw one rent-exemption amount, because it's neither delegated lamports, nor rent-exempt for this acc.
    – Gohnny
    Commented Mar 10, 2023 at 10:37
  • You've got it right. Since a stake account is like any other Solana account, you can transfer lamports to it, even if it's delegated. Those lamports will not be added to the delegation. A delegated stake account must have enough lamports for its delegation and rent exemption. Anything beyond that can be safely withdrawn.
    – Jon C
    Commented Mar 10, 2023 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.