The memory‑hard Proof‑of‑Work used by Parallax. Ethash‑style Hashimoto with Parallax’s consensus rules, difficulty mapping, and epoch handling.
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 |
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))
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
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)
if newEpoch(height):
regenerate cache
if mining full: regenerate dataset
if height % R == 0:
require(h.EpochStartTime == h.Time)
else:
require(h.EpochStartTime == parent.EpochStartTime)