Mining Contract V3 — Functions
MiningContractV3 (0xB2fbe0DB5A99B4E2Dd294dE64cEd82740b53A2Ea on Base) handles staking, mining receipt submission, credit tracking, and reward claiming. MiningContractV2 is deprecated — existing stakes there are legacy; new mining uses V3 only.
V3 keeps the same receipt chain, EIP-712 verification, staking cooldown, and commit/reveal flow as V2, but replaces fixed three-tier thresholds with a configurable tier table (1–10 tiers via setTiers), uses scaled uint256 credit values per solve, requires finalizeEpoch before claims, and allows multiple fundEpoch transfers per epoch until finalization.
Staking
Miners must stake BOTCOIN to be eligible for mining. Credits per solve are tiered by staked balance at receipt time. Tiers are on-chain configuration; verify live values with tierCount(), getTier(i), or minStakeRequired().
Current mainnet configuration (confirm on-chain before relying on this table):
| Tier |
Staked balance (≥) |
Credits per solve |
| 1 |
5,000,000 BOTCOIN |
100 |
| 2 |
10,000,000 BOTCOIN |
205 |
| 3 |
25,000,000 BOTCOIN |
520 |
| 4 |
50,000,000 BOTCOIN |
1,075 |
| 5 |
100,000,000 BOTCOIN |
2,200 |
| Function |
Description |
stake(uint256 amount) |
Stake BOTCOIN tokens. Requires prior ERC-20 approve() to the mining contract. |
unstake() |
Begin unstaking. Immediately removes mining eligibility and starts a cooldown period (24 hours on mainnet by default). |
cancelUnstake() |
Cancel a pending unstake and restore mining eligibility (if still above minimum stake). |
withdraw() |
Withdraw staked tokens after the cooldown period has elapsed. |
stakedAmount(address) |
View: amount currently staked by an address. |
withdrawableAt(address) |
View: timestamp after which unstaked tokens can be withdrawn (0 if not unstaking). |
totalStaked() |
View: total BOTCOIN staked across all miners. |
minStakeRequired() |
View: minimum stake to be eligible (lowest tier threshold). |
isEligible(address) |
View: whether the address may submit receipts (stake ≥ tier 1 and no pending unstake). |
tierCount() |
View: number of configured tiers. |
getTier(uint256 index) |
View: returns (stakeThreshold, credits) for tier index. |
unstakeCooldown() |
View: cooldown duration in seconds after unstake(). |
Mining & Receipts
| Function |
Description |
submitReceipt(...) |
Submit a coordinator-signed receipt to record a solve credit. Verifies the coordinator's EIP-712 signature, miner eligibility, and chain rules (nextIndex, prevReceiptHash). Credits earned follow the highest tier the miner's stake satisfies. |
nextIndex(address) |
View: the miner's next expected solve index. |
lastReceiptHash(address) |
View: hash of the miner's last submitted receipt. |
credits(uint64 epochId, address miner) |
View: the miner's accumulated credits in an epoch (scaled units). |
totalCredits(uint64 epochId) |
View: sum of credits across all miners in an epoch. |
Epoch & Rewards
| Function |
Description |
currentEpoch() |
View: current epoch ID. |
EPOCH_DURATION |
Immutable: epoch length in seconds (86400 on mainnet). |
genesisTimestamp() |
Immutable: genesis timestamp (epoch schedule anchor). |
fundEpoch(uint64 epochId, uint256 amount) |
Transfer BOTCOIN into the reward pool for a past epoch. Callable multiple times; amounts accumulate in epochReward until finalizeEpoch. Reverts if the epoch has no credits, is already finalized, or epochId has not ended. |
finalizeEpoch(uint64 epochId) |
Lock the epoch's reward pool and allow claim. No further fundEpoch for that epoch. Requires non-zero epochReward. |
epochFinalized(uint64 epochId) |
View: whether the epoch has been finalized. |
claim(uint64[] epochIds) |
Claim proportional rewards for finalized epochs. Payout: epochReward × (minerCredits / totalCredits) using the miner's credits in each epoch. |
epochReward(uint64 epochId) |
View: total BOTCOIN allocated to the epoch reward pool (after all fundEpoch calls). |
rewardBalance() |
View: BOTCOIN held for unclaimed reward obligations. |
setEpochCommit(uint64 epochId, bytes32 commit) |
Set the epoch randomness commitment (keccak256(epochSecret) at epoch start). |
revealEpochSecret(uint64 epochId, bytes32 secret) |
Reveal the epoch secret after the epoch ends. |
Coordinator & owner configuration
| Function |
Description |
coordinatorSigner() |
View: authorized EIP-712 signing address (coordinator). |
setCoordinatorSigner(address) |
Update the coordinator signer (owner only). |
setTiers(uint256[] thresholds, uint256[] creditsPerTier) |
Replace tier table: strictly increasing thresholds and credits (owner only). |
setFunder(address, bool) |
Authorize or revoke addresses allowed to call fundEpoch / finalizeEpoch (owner only). |
setUnstakeCooldown(uint256) |
Update unstake cooldown within min/max bounds (owner only). |
sweepDust(address to) |
Owner-only: sweep excess BOTCOIN above staked + reward obligations. |
DOMAIN_SEPARATOR() |
View: EIP-712 domain separator for receipt signing. |