Bonus Epoch Contract — Functions

Bonus epochs are randomly selected (1-in-10 chance). When a bonus epoch occurs, miners who earned credits can claim additional BOTCOIN rewards.

Randomness

Bonus epoch selection uses a commit-reveal scheme:

  1. At epoch start, coordinator commits keccak256(epochSecret) on-chain
  2. A block hash is captured on-chain at a designated block during the epoch
  3. After epoch ends, the secret is revealed
  4. keccak256(secret || blockHash) % 10 == 0 → bonus epoch

This ensures neither the coordinator (who doesn't know the block hash in advance) nor the miners (who don't know the secret) can predict or manipulate the outcome.

Functions

Function Description
claimBonus(uint64[] epochIds) Claim bonus rewards from one or more bonus epochs. Only callable by miners with credits in those epochs.
fundBonus(uint64 epochId, uint256 amount) Fund a bonus epoch with BOTCOIN rewards (coordinator/deployer).
captureBlockHash(uint64 epochId) Capture the block hash used for bonus randomness.
isBonusEpoch(uint64 epochId) View: returns whether an epoch is a bonus epoch.
bonusReward(uint64 epochId) View: returns the funded bonus reward amount.
bonusBlock(uint64 epochId) View: returns the block number used for randomness.