Mining XPOW
Mining XPOW is how new tokens enter circulation — by finding a Keccak-256 nonce that satisfies the protocol's difficulty requirement and submitting it on-chain for verification and reward.
Prerequisites
- A Web3 wallet (MetaMask or WalletConnect-compatible) with ~0.1 AVAX on Avalanche C-Chain for gas
- For testnet: Fuji network (Chain ID 43113) with test AVAX from the Avalanche faucet
- Access to the XPower app at app.xpowermine.com, or a direct connection to the
XPowercontract
How Mining Works
The miner computes Keccak-256 over a structured input:
A valid solution is one where
Half goes to the miner's beneficiary address, half to the MoeTreasury to fund staking rewards.
| Difficulty | Expected Hashes | Total Reward (XPOW) | Miner's Share |
|---|---|---|---|
| 1 | 16 | 1 | 0.5 |
| 2 | 256 | 3 | 1.5 |
| 3 | ~4,096 | 7 | 3.5 |
| 4 | ~65,536 | 15 | 7.5 |
| 5 | ~1,048,576 | 31 | 15.5 |
Step-by-Step: Browser Mining
1. Connect Your Wallet
Navigate to app.xpowermine.com and click Connect Wallet. Approve the connection request in MetaMask or your wallet of choice. The app will detect your network — switch to Avalanche C-Chain if prompted.
2. Initialize a Block Hash
Before searching for nonces, you must register a recent Avalanche block hash on-chain:
XPower.init()This call costs gas (~50,000) and starts a 1-hour mining window. The returned block hash becomes the blockHash input for every nonce you test during this window. You only need to call init() once per hour — all nonces within that window hash against the same block hash.
Expired Block Hash
If more than 1 hour passes since your last init(), any submission using that block hash will revert with ExpiredBlockHash. Call init() again to start a fresh window.
3. Find a Valid Nonce
The browser miner runs Keccak-256 in a Web Worker, iterating through nonces until it finds one where the hash has at least one leading zero nibble. At ~10,000 hashes/second in a modern browser:
- A
solution is found in under 2 milliseconds on average - A
solution takes ~4–13 seconds - A
solution takes ~1–2 minutes
The app shows your hash rate, elapsed time, and expected time to solution. You can stop mining at any time — no state is lost.
4. Submit Your Solution
When a valid nonce is found, the app prompts you to submit:
XPower.mint(beneficiary, blockHash, nonceData)Where:
beneficiaryis your wallet address (or any address you choose)blockHashis the hash from step 2nonceDatais the 32-byte nonce that produced the valid hash
The contract verifies the nonce on-chain, checks that the block hash is still fresh, confirms the (beneficiary, blockHash, pairIndex) tuple hasn't been used before, and mints the reward.
Gas cost for submission: ~150,000 gas (~0.001–0.005 AVAX depending on network conditions).
5. Verify Your Receipt
After the transaction confirms:
- Check your XPOW balance — you should see
reward / 2XPOW added - View the transaction on SnowTrace (mainnet) or the Fuji explorer
- The
Mintevent in the transaction logs confirms the amount and beneficiary
Alternative Mining Strategies
CLI Mining (Node.js)
For higher hash rates, run a Node.js miner locally:
# Install dependencies
npm install ethers @noble/hashes
# Run the miner
node mine.js --provider YOUR_RPC_URL --private-key YOUR_KEYNode.js (V8 engine) achieves ~20,000–50,000 hashes/second, roughly 3–5× faster than browser mining. This is ideal for targeting
Native Mining (Rust/C++)
For maximum throughput, a native Keccak-256 implementation can reach 500,000+ hashes/second using multi-threading. This is suitable for targeting
Strategy Considerations
| Strategy | Best For | Tradeoff |
|---|---|---|
| Browser, | Casual miners, low gas | Frequent transactions eat into profit |
| Browser, | Balanced approach | Moderate wait, good reward/gas ratio |
| CLI, | Dedicated miners | Higher setup effort, better efficiency |
| Native, | High-power setups | Large expected hashes, rare but large rewards |
Each (beneficiary, blockHash, nonce) tuple can only be used once — the contract prevents replay attacks. If you find a solution at
Gas Costs and Profitability
| Action | Gas | Approx. AVAX Cost |
|---|---|---|
XPower.init() | ~50,000 | 0.001–0.002 |
XPower.mint() | ~150,000 | 0.003–0.005 |
| Total per solution | ~200,000 | ~0.004–0.007 |
Gas Strategy
On Avalanche C-Chain, gas prices are typically 25–50 nAVAX. At 25 nAVAX, a mint() costs ~0.00375 AVAX. The miner's share of a
What Happens Internally
When you call XPower.mint(to, blockHash, data), the contract executes the following sequence:
Freshness check:
_recent(blockHash)verifies that the block hash was initialized within the last hour viainit(). If the block hash has expired, the call reverts withExpiredBlockHash.Nonce reconstruction: The contract recomputes the hash from
(address(this) ^ to, blockHash, data). It does not trust your submitted hash — it re-derives it deterministically using the same Keccak-256 formula.Uniqueness check: The contract computes a
pairIndexfrom your nonce and block hash (keccak(nonce) ^ blockHash). If this pair index was already used, the call reverts withDuplicatePairIndex. This prevents replay attacks — no solution can be submitted twice.Difficulty check:
_zerosOf(nonceHash)counts the leading zero nibbles. If, the call reverts with EmptyNonceHash. The reward is computed as(2^z - 1) * 10^18.Minting: Two
_mintcalls create XPOW —_mint(owner(), amount)sends 50% to the MoeTreasury (the contract owner), and_mint(to, amount)sends 50% to the beneficiary. The_hashes[pairIndex] = truestorage write permanently marks this solution as used.