I kept assuming staking rewards just show up once they're earned. Babylon's incentive module doesn't work that way.
Every block, rewards get recorded into something called a RewardGauge. That gauge has exactly two fields: coins, meaning everything that's ever landed there, and withdrawn_coins, meaning everything you've already pulled out. Your actual claimable balance is just one subtraction between them.
Nothing gets pushed to your wallet at any point in that process.
The docs are direct about this: rewards aren't actively sent out when they're recorded, they sit in the pool until a withdrawal event happens. The gauge accumulates in the background regardless of whether you're watching it. It has no opinion on when, or whether, you come get it.
That felt backwards at first. Most staking systems I've looked at either auto-compound or auto-distribute — the reward either grows your position or lands in your balance without you doing anything. Babylon does neither. The only way coins leave the gauge is one specific message, MsgWithdrawReward, which transfers the balance to your withdraw address and only then updates withdrawn_coins to match.
So "earning rewards" and "having rewards" are two separate states here, and the only bridge between them is a transaction you have to send yourself. The chain keeps perfect count. It just never acts on that count unless you ask it to.
Does putting the withdrawal entirely on the user reduce unnecessary on-chain writes and gas spent pushing small amounts nobody asked for yet, or does it just create a silent pile of unclaimed value that most people forget to go collect?
@BabylonLabs_io #baby $BABY
Every block, rewards get recorded into something called a RewardGauge. That gauge has exactly two fields: coins, meaning everything that's ever landed there, and withdrawn_coins, meaning everything you've already pulled out. Your actual claimable balance is just one subtraction between them.
Nothing gets pushed to your wallet at any point in that process.
The docs are direct about this: rewards aren't actively sent out when they're recorded, they sit in the pool until a withdrawal event happens. The gauge accumulates in the background regardless of whether you're watching it. It has no opinion on when, or whether, you come get it.
That felt backwards at first. Most staking systems I've looked at either auto-compound or auto-distribute — the reward either grows your position or lands in your balance without you doing anything. Babylon does neither. The only way coins leave the gauge is one specific message, MsgWithdrawReward, which transfers the balance to your withdraw address and only then updates withdrawn_coins to match.
So "earning rewards" and "having rewards" are two separate states here, and the only bridge between them is a transaction you have to send yourself. The chain keeps perfect count. It just never acts on that count unless you ask it to.
Does putting the withdrawal entirely on the user reduce unnecessary on-chain writes and gas spent pushing small amounts nobody asked for yet, or does it just create a silent pile of unclaimed value that most people forget to go collect?
@BabylonLabs_io #baby $BABY
