Skip to content

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:

SourceAmount
Block reward0.002 BESC (fixed per block)
Gas feesAll gas collected from transactions in that block

Both are forwarded in the same forwardReward() call as msg.value.

The forwardReward Function ​

solidity
function forwardReward(
    address winner,
    uint256 newEntropySeed,
    RewardSource source
) external payable;
ParameterDescription
winnerThe validator address to credit the reward to
newEntropySeedPseudo-random seed updated each block
sourceRewardSource.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 wallet

No 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 stake

Example — 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) - rewardDebt

No loops, no per-user iteration — supports thousands of delegators without scaling issues.

Events ​

solidity
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:

javascript
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}`
  );
});

BESC Hyperchain — Built for Institutions.