The memory‑hard Proof‑of‑Work used by Parallax. Ethash‑style Hashimoto with Parallax’s consensus rules, difficulty mapping, and epoch handling.
As reflected by xhash/consensus.go
and Parallax chain config.
Aspect | Value / Behavior | Notes |
---|---|---|
Hash function (seal) | Legacy Keccak‑256 | RLP over specific header fields |
Target mapping | target = ⌊(2^256−1)/D⌋ | Result must be ≤ target |
MixDigest | Must equal computed digest | Mismatch ⇒ invalid PoW |
MTP | Median of last 11 | Enforced: Time > MTP(parent); Future drift ≤ 300s |
Epoch length | Config‑defined (e.g., 720 blocks) | Determines cache/DAG regeneration cadence |
Retarget interval | 2016 blocks | Bitcoin-like retarget interval |
XHash is Parallax’s Proof‑of‑Work engine: Ethash‑style Hashimoto (light/full) with Parallax‑specific consensus wiring, difficulty mapping, and epoch handling.
SealHash(header):
enc = [
header.ParentHash,
header.Coinbase,
header.Root,
header.TxHash,
header.ReceiptHash,
header.Bloom,
header.Difficulty,
header.Number,
header.GasLimit,
header.GasUsed,
header.Time,
header.Extra,
header.EpochStartTime,
]
if header.BaseFee != nil:
enc.append(header.BaseFee)
return keccak256(rlp.encode(enc))
Hashimoto‑light/full with 64‑bit nonce search and little‑endian target compare in the inner loop.
mine(header, cacheOrDataset):
target = floor((2^256 - 1) / header.Difficulty)
nonce = random64()
loop:
(mix, res) = hashimoto(cacheOrDataset, SealHash(header), nonce)
if mix == header.MixDigest and Big(res) <= target:
return nonce
nonce = (nonce + 1) mod 2^64
What a node checks before accepting a PoW header.
verifySeal(h):
require(h.Difficulty > 0)
if fulldag:
(mix, res) = hashimotoFull(dataset(epoch(h.Number)), SealHash(h), h.Nonce)
else:
(mix, res) = hashimotoLight(datasetSize(h.Number), cache(epoch(h.Number)), SealHash(h), h.Nonce)
require(mix == h.MixDigest)
target = floor((2^256 - 1) / h.Difficulty)
require(Big(res) <= target)
Regeneration cadence and miner compatibility notes.
if newEpoch(height):
regenerate cache
if mining full: regenerate dataset
Interaction between PoW and the difficulty schedule.
if height % R == 0:
require(h.EpochStartTime == h.Time)
else:
require(h.EpochStartTime == parent.EpochStartTime)