Pool mining with XMRig¶
Tested on a disposable chain only
The pool software below passed an end-to-end test on a disposable six-node chain-20777 harness (15 November 2026). No public PQWERAI pool is running. Anyone may run one; this page shows how.
Solo mining inside the node is described in Become a miner. Pool mining lets many CPUs share one node's block rewards in proportion to their work.
XMRig (patched) ──stratum──▶ g1_stratum_bridge.py ──eth_getG1Work / eth_submitG1Work──▶ pqwerai-core --miner.external
many miners shares checked, per-miner loopback RPC + bearer token builds the block,
difficulty, share log reward → -etherbase
│
▼
pool_payout.py ──signed PQAI transfers──▶ miners' addresses
Why stock XMRig does not work¶
GhostRider on PQWERAI hashes an 80-byte input:
| Bytes | Content |
|---|---|
| 0–4 | G1GR |
| 4–36 | parent block hash |
| 36–68 | commitment to the header |
| 68–76 | nonce, 8 bytes big-endian |
| 76–80 | must be zero (consensus) |
XMRig writes its 4-byte GhostRider nonce at bytes 76–80, the Raptoreum layout. The hash function is the same, but a
stock miner's shares can never be valid here. The patch
mining/stratum/xmrig-6.26.0-pqwerai-g1.patch (in the PQWERAI repository) changes two lines of XMRig 6.26.0:
- nonce offset 76 → 72: the miner varies bytes 72–76; the pool gives each connection its own bytes 68–72;
- donation level 1 % → 0 %, so the miner never connects to XMRig's donation pool.
No fork and no consensus change are needed. Existing Raptoreum pool software does not work as is.
For miners¶
curl -L -o xmrig-6.26.0.tar.gz https://github.com/xmrig/xmrig/archive/refs/tags/v6.26.0.tar.gz
sha256sum xmrig-6.26.0.tar.gz # 5005144e78571f26586410c2b2ede2b0c72afe22f97f1708ea24cfb253c3939b
tar xzf xmrig-6.26.0.tar.gz && cd xmrig-6.26.0
patch -p1 < xmrig-6.26.0-pqwerai-g1.patch # from mining/stratum/ in the PQWERAI repository
mkdir build && cd build
cmake .. -DWITH_HWLOC=OFF -DWITH_TLS=OFF -DWITH_OPENCL=OFF -DWITH_CUDA=OFF && make -j"$(nproc)"
./xmrig-notls -o POOL_HOST:3333 -u 0xYourPayoutAddress.rig1 -p x --donate-level=0
- The login is your payout address (optionally
.workername). Its key stays off the mining machine. - Do not pass
-a gr: that selects XMRig's Raptoreum client, which speaks another protocol. - XMRig is GPL-3.0. Only the patch is in the PQWERAI repository; whoever distributes a built binary must also provide its source.
For pool operators¶
-
Run a synced node in external-mining mode, with the pool address as the reward address:
In this mode the node does not seal blocks itself. It publishes one job at a time through
eth_getG1Workand accepts solutions througheth_submitG1Work, both behind the node's RPC bearer token, and verifies every solution again before sealing. -
Run the bridge on the same host:
python3 mining/stratum/g1_stratum_bridge.py \ --node-rpc http://127.0.0.1:8545 --token-file /etc/pqwerai/rpc.token \ --helper /path/to/release/pqwerai_hash_worker \ --listen 0.0.0.0:3333 --public --require-address \ --share-difficulty 64 --share-seconds 10 \ --share-log /var/lib/pqwerai-pool/shares.jsonl --stats /var/lib/pqwerai-pool/stats.jsonBehaviour Detail Share check Every share is recomputed with the same GhostRider helper as the Core; invalid, duplicate and low-difficulty shares are rejected Variable difficulty Per connection, every 30 s, aiming at one share per --share-seconds, at most ×2 or ÷2 per stepShare log One JSON line per accepted share: time, payout address, difficulty Safety Node RPC must be loopback; a non-loopback listen address needs --public -
Pay miners with
pool_payout.py:pool_payout.py init --rpc http://127.0.0.1:8545 --token-file rpc.token --pool 0xPoolAddress --state payout.json pool_payout.py round --rpc http://127.0.0.1:8545 --token-file rpc.token --share-log shares.jsonl \ --state payout.json --fee-percent 1 --min-payout 0.1 # dry run: prints the plan pool_payout.py round ... --pool-key-file pool.key --send # paysRewards reach the pool address once per 32-block epoch, plus transaction fees in each block (Rewards and issuance). So a round measures the pool's income from balances:
income = balance(B′) − balance(B) + everything the pool address sent in blocks B+1…B′B′is the head minus--confirmations(default 64). The income minus the fee is split over the work (sum of share difficulties) logged between the timestamps ofBandB′. Amounts below--min-payoutcarry over to the next round. Each payout is signed and written to the state file before it is broadcast, so a rerun after a crash sends the same transactions again and never pays twice. Use the pool address for nothing else: any other spending would be counted as income.
Test result¶
Disposable six-node harness, base difficulty 64, two patched XMRig processes: blocks mined only through the bridge,
all six nodes on the same head, every share recomputed, no invalid share, and a payout round that paid each miner
exactly its credited amount. Details and pins:
audit/evidence/2026-11-15-g1-stratum/ in the repository.
Limits¶
- Hash rate and difficulty: the difficulty is clamped to 16 × base (1,024 on chain 20777). A pool with more than roughly 340 GhostRider hashes per second keeps the difficulty at that ceiling, and blocks come faster than the 3–7 s band. A revised difficulty rule is a candidate, not active (GhostRider mining).
- No TLS in the bridge: put a TLS terminator (for example stunnel) in front of a public port.
- One node per bridge. After a block is found the node drops the job, so later candidates for it are rejected.
- Rewards are reversible until the block is final; keep
--confirmationsabove the finality delay.
Sources at 35ec5bd0b5: mining/stratum/README.md · mining/stratum/g1_stratum_bridge.py · mining/stratum/pool_payout.py · mining/stratum/xmrig-6.26.0-pqwerai-g1.patch · audit/evidence/2026-11-15-g1-stratum/README.md
Found a problem? Report a documentation issue · Build testnet-rc1+35ec5bd0b5