Proof-of-Work Overview
XPower's proof-of-work mechanism is a token distribution engine, not a consensus algorithm. Avalanche's subnet consensus secures the chain; XPower's mining ensures every XPOW token in circulation was created through verifiable computational work. For a broader conceptual introduction, see Proof-of-Work Mining.
Mining as Distribution
There is no pre-mine. Every XPOW token originates from a XPower.mint() call that proves the miner discovered a Keccak-256 nonce meeting a specified difficulty threshold. The contract verifies the proof on-chain, then mints an equal amount to both the miner's beneficiary and the MoeTreasury — doubling the supply with each successful solution.
function mint(address to, bytes32 blockHash, bytes calldata data) external {
require(_recent(blockHash), ExpiredBlockHash(blockHash));
(bytes32 nonceHash, bytes32 pairIndex) = _hashOf(to, blockHash, data);
require(_unique(pairIndex), DuplicatePairIndex(pairIndex));
uint256 zeros = _zerosOf(nonceHash);
require(zeros > 0, EmptyNonceHash(nonceHash));
uint256 amount = _amountOf(zeros);
_hashes[pairIndex] = true;
_mint(owner(), amount); // treasury
_mint(to, amount); // beneficiary
}This is a pure proof-of-work issuance model: no bonding curves, no bonding periods, no airdrops. The only way XPOW enters circulation is via entropy expenditure.
Why Keccak-256
Keccak-256 (SHA-3) is deliberately chosen over memory-hard or ASIC-resistant hash functions:
- Browser-mineable — Keccak-256 is natively supported in Web Crypto APIs (
SubtleCrypto.digest("SHA-256")) and performs well in JavaScript. At ~10,000 hashes/second in a modern browser, a miner can expect to find asolution in under 2 milliseconds and a solution in under 7 seconds — making the protocol accessible without specialized software or hardware. - No hardware arms race — Unlike Bitcoin's SHA-256d, Keccak-256 has no industrial ASIC ecosystem dedicated to it. The hash function was chosen in part because existing SHA-256 or Scrypt ASIC miners cannot be repurposed for XPower mining, reducing the advantage of specialized mining rigs.
- Deterministic verification — A single
keccak256()call on-chain verifies what took thousands to billions of attempts off-chain. The gas cost of verification (~150,000) is independent of the difficulty, creating a constant verification cost regardless of the computational effort expended. - EVM-native — Solidity's built-in
keccak256()compiles to theSHA3EVM opcode, requiring no external libraries or precompiles.
Hash Rate Considerations
| Environment | Approximate Hash Rate | |
|---|---|---|
| Browser (single-threaded JS) | ~5,000–15,000 H/s | ~4–13 seconds |
| Node.js (single-threaded, V8) | ~20,000–50,000 H/s | ~1.3–3.3 seconds |
| Native (Rust/C++, multi-threaded) | ~500,000+ H/s | ~0.13 seconds |
The protocol is intentionally accessible to browser miners — no GPU or ASIC is required. Native implementations provide better efficiency but don't create an insurmountable advantage, since the fixed 1-hour window and single-use pair index constraint limit how many solutions a single miner can submit per interval.
The Six-Contract Mining Flow
Mining involves the coordinated action of all six core contracts, though the miner interacts directly with only one:
┌─────────────┐
│ Miner │
└──────┬──────┘
│ 1. init()
▼
┌─────────────┐ ┌──────────────┐
│ XPower │────▶│ MoeTreasury │────▶ staking reward pool
│ (moe) │ │ (mty) │
└──────┬──────┘ └──────────────┘
│ 2. mint(to, blockHash, data)
│
│ 50% to beneficiary
│ 50% to owner (mty)
▼
┌─────────────┐ ┌──────────────┐ ┌──────────────┐
│ XPowerNft │ │ NftTreasury │ │ APowerNft │
│ (nft) │◀───▶│ (nty) │────▶│ (ppt) │
│ deposit │ │ stake/unstake│ │ staking recpt│
└─────────────┘ └──────┬───────┘ └──────────────┘
│ claim APOW
▼
┌──────────────┐
│ APower │
│ (sov) │
│ rate-limited │
└──────────────┘- XPower (moe) —
XPower.sol, the hub contract. Validates nonces via_zerosOf(), checks freshness via_recent(), enforces uniqueness via_unique(), and mints XPOW. The contract isOwnable; the owner is set toMoeTreasury, which receives the treasury half of every mint. Onlymint()creates new tokens — there is nomint(address, uint256)function accessible to anyone. The supply is unbounded, limited only by the aggregate hash power of all miners. - MoeTreasury (mty) —
MoeTreasury.solreceives the treasury's XPOW and holds it as backing for APOW minting. It also governs the APR and APB parameters viasetAPR()/setAPB(), protected by role-based access control (APR_ROLE,APB_ROLE). The treasury callsAPower.mint()to distribute staking rewards, rate-limited by APower's internal mean-tracking mechanism. - XPowerNft (nft) —
XPowerNft.sol, an ERC-1155 contract. Users deposit mined XPOW viamint(), which callsXPOW.transferFrom(user, vault, amount * denomination). Each NFT ID encodes100 * year + level, and levels must be multiples of 3. The contract also supports upgrades (1,000 NFTs at level1 at ) and maturity-gated redemptions. - NftTreasury (nty) —
NftTreasury.solescrows XPowerNfts and mints/burns APowerNfts. Onstake(), it holds the XPowerNft and callsAPowerNft.mint(); onunstake(), it returns the XPowerNft and callsAPowerNft.burn(). Each stake/unstake triggersMoeTreasury.refreshRates(false)to update the share distribution. - APowerNft (ppt) —
APowerNft.sol, an ERC-1155 staking receipt. Tracks staked denomination, age accumulator (time-weighted presence), and per-level share totals. OnlyNftTreasurycan mint/burn. The_ageaccumulator feeds into the APB (Annual Percentage Bonus) calculation, rewarding longer stake durations. - APower (sov) —
APower.sol, the store-of-value ERC20. OnlyMoeTreasury(as owner) can callmint(), which first wraps XPOW from the treasury (transferFrom) and then mints APOW subject to rate-limiting. The formula tracks a long-term mean via square-root smoothing:mean' = mean * time' / t + sqrt(claim) / t, targeting ~1 token/minute. Users canburn()APOW to release proportional XPOW from the treasury.
Miners interact only with the XPower contract. The treasury half flows automatically to MoeTreasury, where it funds the APR + APB staking rewards claimed through NftTreasury → APower — completing the cycle of work → value → rewards.
Mining in One Transaction
From the miner's perspective, the flow is straightforward:
- Call
XPower.init()to cache the most recent Avalanche block hash for the current 1-hour interval - Iterate nonces off-chain, computing:
- When
has leading zero nibbles, submit via XPower.mint(beneficiary, blockHash, data) - Reward
XPOW is minted — half to beneficiary, half to treasury
All gas is paid by the transaction submitter. There is no off-chain oracle, no relayer, and no trusted third party. The contract is the sole arbiter.
Expected Yield
For a uniform random nonce search, the expected XPOW per hash attempt aggregates over all difficulty tiers:
This converges to approximately 13.13 hash attempts per 1 XPOW on average, though the distribution is heavily skewed: most rewards come from low-difficulty (
Breakdown by Difficulty Tier
| Tier | Contribution to | % of Expected Yield |
|---|---|---|
| 82.1% | ||
| 15.4% | ||
| 2.2% | ||
| 0.3% | ||
| remaining | <0.04% |
Over 97% of the expected yield comes from
Profitability Threshold
In economic terms, the expected value of a hash attempt is:
Where
Architecture Diagram
The following diagram shows the complete mining flow across all six contracts:
The miner initiates the flow by calling XPower.init() (top left), then submits solutions via XPower.mint(). Treasury XPOW flows downward through the staking pipeline, ultimately emerging as rate-limited APOW rewards.
Sub-Pages
- Difficulty and Rewards — Hash function specification, probability, reward formula, and the 50/50 split
- Block Hash Intervals — 1-hour mining windows, freshness checks, pre-computation prevention, and practical mining strategy
- Duplicate Prevention —
pairIndexencoding, replay attack resistance, and storage implications