Solana: compounding staking for JITO stakers

Solana: compounding staking for JITO stakers
WEB3 ENGINEERING
If you are staking to Jito Validator (for example our OnChain Divers Validator!) you are entitled for receiving extra rewards from Jito. They are appearing on your staking account but... They are not re-staked! To give you a taste of what it means: from the stake of 100 SOL in 4 months we received around 2 SOL - inflation interest rate, and 1.6 SOL of JITO rewards. Impressive. Interest rate rewards are a subject of compund interest by Solana design. But Jito Rewards are not!

There is a dashboard we created for you with some real numbers of annual simulation: https://docs.google.com/spreadsheets/d/1Wf6WjBjSNAdHVxMdlkbGS37mEvJLjzPy0IscsTIE7P4/edit?usp=sharing

Staking with onchain divers validator currently gives you 11.78% without restaking and 11.94% (excl transaction costs) with restaking.

How to understand that you are not restaking efficiently?
You will see a significant discrepancy running
$ solana stake-account stake.json
Let's write a script to fix it!
#!/bin/sh

WITHDRAW_THRESHOLD_LAMPORTS=10000000
NEW_STAKE_THRESHOLD_LAMPORTS=30000000
WITHDRAWER_MIN_BALANCE=10000000

FOLDER_WITH_STAKES=/home/user/stakes
WITHDRAWER_KEY=/home/user/withdraw-authority.json
VALIDATOR_TO_RESTAKE=6hcGvZypizjf6PPsxboshZHRqefyQKSG9L8vZqYdm7UY

for file in $(ls $FOLDER_WITH_STAKES/*.json); do
        owner=$(solana account --output json $file | jq -r '.account.owner')
        if [ "$owner" = "Stake11111111111111111111111111111111111111" ]; then
                stake_data=$(solana stake-account --output json $file)
                balance=$(echo "$stake_data" | jq -r '.accountBalance')
                delegated=$(echo "$stake_data" | jq -r '.delegatedStake')
                reserve=$(echo "$stake_data" | jq -r '.rentExemptReserve')
                free_amount=$(echo "$balance - $delegated - $reserve" | bc)
                echo "Free Amount $free_amount"
                if [ "$free_amount" -gt "$WITHDRAW_THRESHOLD_LAMPORTS" ]; then
                        echo "Withdrawing"
                        solana withdraw-stake $file "$WITHDRAWER_KEY" -k "$WITHDRAWER_KEY" $(echo "scale=9; $free_amount / 1000000000" | bc)
                fi
        fi
done

withdrawer_balance=$(solana balance --output json "$WITHDRAWER_KEY" | jq -r .lamports)
echo "Withdrawer Balance $withdrawer_balance"
if [ "$withdrawer_balance" > "$NEW_STAKE_THRESHOLD_LAMPORTS" ]; then
        new_stake_amount=$(echo "scale=9; ($withdrawer_balance - $WITHDRAWER_MIN_BALANCE)/1000000000" | bc)
        new_stake_filename=$(date +"stake-%Y%m%dT%H%M%S.json")
        (cd $FOLDER_WITH_STAKES && \
                solana-keygen new -o "$new_stake_filename" -s --no-bip39-passphrase &&
                solana create-stake-account "$new_stake_filename" "$new_stake_amount" -k "$WITHDRAWER_KEY" &&
                solana delegate-stake -k "$WITHDRAWER_KEY" "$new_stake_filename" "$VALIDATOR_TO_RESTAKE")
fi
Close
Ready to take your business to the next level? Let's talk
I agree to the Terms of Service