The memory-hard Proof-of-Work used by Parallax. Ethash-style Hashimoto with Parallax's ASERT-based difficulty, consensus rules, 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 |
| Difficulty algorithm | ASERT (per-block, anchor-based) | aserti3-2d; consensus computes D, XHash enforces it via PoW |
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
verifyDifficulty(h, parent, anchor):
expected = CalcAsertDifficulty(config, anchor, parent, h)
require(h.Difficulty == expected)