Proof-of-Work Mining
XPower uses proof-of-work not for consensus (Avalanche handles that), but for token distribution — a provably fair mechanism where every XPOW token originates from computational work.
Hash Function
Miners compute Keccak-256 over a structured input:
Where:
address— the contract address (msg.sender)beneficiary— the recipient address chosen by the minerblockHash— a recently-initialized Avalanche block hashdata— a 32-byte field containing a 256-bit nonce
The XOR operation between the contract address and the beneficiary address ties the hash to both the contract and the intended recipient, preventing cross-contract nonce reuse.
Difficulty
Difficulty is measured by the number of leading zero nibbles (4-bit hex digits) in the 256-bit hash output. Let
The probability of finding a valid hash with
| z | Probability | Expected Hashes | Reward (XPOW) |
|---|---|---|---|
| 1 | 1/16 | 16 | |
| 2 | 1/256 | 256 | |
| 3 | 1/4,096 | ~4K | |
| 4 | 1/65,536 | ~66K | |
| 5 | 1/1,048,576 | ~1M | |
| 6 | 1/16,777,216 | ~17M | |
| 7 | 1/268,435,456 | ~268M | |
| 8 | 1/4,294,967,296 | ~4.3B |
Reward Formula
The XPOW reward for difficulty
This creates an exponential reward curve: doubling the difficulty doubles the number of expected hashes but slightly more than doubles the reward.
Treasury Split
Every successful mint splits the reward:
- 50% to the miner's beneficiary — the address specified in the mint call
- 50% to the MoeTreasury — funds the staking reward pool
This split ensures that even non-miners (staking participants) benefit from mining activity, aligning incentives across the ecosystem.
Expected Yield
For a uniform random nonce search, the expected XPOW per hash attempt is:
This means approximately 13 hash attempts per token on average, though the distribution is heavily skewed — most rewards come from low-difficulty solutions, while high-difficulty solutions are rare but lucrative.
Block Hash Intervals
Mining operates within 1-hour windows tied to Avalanche block hashes:
- The miner calls
XPower.init(blockHash)to register a block hash for mining - Solutions must be submitted within 3,600 seconds of
init() - Each
(beneficiary, blockHash, pairIndex)tuple can only be used once
This 1-hour window prevents pre-computation attacks — if a miner could compute nonces against arbitrary future block hashes, the proof-of-work would be meaningless. By requiring a recent on-chain block hash, every computation is tied to a specific, verified point in Avalanche's history.
Duplicate Prevention
The pairIndex field prevents replay of the same solution:
This XOR-based encoding creates a one-to-one mapping between nonces and block hashes per beneficiary. Once a pair is used, it's marked in contract storage and cannot be reused.