Reward Forwarding
This page explains the exact mechanics of how block rewards and gas fees flow from the consensus layer into the economic (staking) layer.
What Gets Forwarded
After each block, the relayer forwards two sources of value:
| Source | Amount |
|---|---|
| Block reward | 0.002 BESC (fixed per block) |
| Gas fees | All gas collected from transactions in that block |
Both are forwarded in the same forwardReward() call as msg.value.
The forwardReward Function
function forwardReward(
address winner,
uint256 newEntropySeed,
RewardSource source
) external payable;| Parameter | Description |
|---|---|
winner | The validator address to credit the reward to |
newEntropySeed | Pseudo-random seed updated each block |
source | RewardSource.BlockReward or RewardSource.DirectReward |
Distribution Logic
The registry applies the following logic when distributing the forwarded amount:
No Delegators → Direct Payment
If the target validator has no delegators (total stake = self-stake only):
100% of (block reward + gas)
→ sent directly to the validator's walletNo contract storage writes, no per-user accounting. Clean and gas-efficient.
Has Delegators → Split Payment
If the target validator has delegators:
Block reward + gas fees
│
├─ Validator commission share (commission% of delegator portion)
│ → sent DIRECTLY to the validator's wallet
│
└─ Delegator portion (100% - commission%)
→ sent to the registry contract
→ accRewardPerShare updated
→ each delegator can claim their pro-rata share
based on their stake relative to total delegated stakeExample — Validator with 5% commission, 15,000 BESC delegated, 5,000 BESC self-stake, 0.023 BESC forwarded (block reward + gas):
Total forwarded: 0.023 BESC
Validator self-stake share (5000/20000 = 25%): 0.00575 BESC → direct
Remaining for delegators (15000/20000 = 75%): 0.01725 BESC
Commission (5% of 0.01725): 0.00086 BESC → direct to validator
To registry for delegators: 0.01639 BESC
Validator receives total direct: 0.00575 + 0.00086 = 0.00661 BESC
Registry holds for delegators: 0.01639 BESC (claimable any time)Reward Accounting in the Registry
The registry uses an accumulator pattern for gas-efficient O(1) distribution:
For each forwardReward call:
accRewardPerShare += (delegatorPortion × precision) / totalDelegatedStake
For each delegator claiming:
pendingReward = (stake × accRewardPerShare / precision) - rewardDebtNo loops, no per-user iteration — supports thousands of delegators without scaling issues.
Events
event RewardDistributed(
address indexed validator,
uint256 amount,
uint256 indexed blockNumber,
RewardSource source
);
event RealRewardReceived(
address indexed realWinner,
uint256 amount,
uint256 blockNumber,
RewardSource source
);Monitor reward flow in real time:
const registry = new ethers.Contract(REGISTRY_ADDRESS, REGISTRY_ABI, provider);
registry.on("RewardDistributed", (validator, amount, blockNumber, source) => {
console.log(
`Block ${blockNumber}: ${ethers.formatEther(amount)} BESC ` +
`distributed via validator ${validator}`
);
});