EIP-1355 · Withdrawn · Core · 2018-08-26
EIP-1355: Ethash 1a
A withdrawn proposal to tweak one hash step in Ethash, swapping FNV for FNV-1a, to break existing mining ASICs while leaving GPUs unaffected.
What problem does it solve?
In 2018, ASIC miners for Ethash, Ethereum's proof-of-work algorithm at the time, started to appear. Many in the community worried that specialized hardware would concentrate mining in a few hands, against the goal of GPU-friendly, decentralized mining.
EIP-1355, "Ethash 1a", proposed the smallest possible change that would make those first-generation ASICs useless. The point was speed and low risk: a tiny change is quick to implement, easy to review, and unlikely to hurt GPU miners.
How it works
Ethash repeatedly picks pseudo-random entries from a large dataset (the DAG). The index of each entry comes from a cheap non-cryptographic hash called FNV, which multiplies and then XORs.
EIP-1355 defines FNV-1a, which does the same two operations in the opposite order: XOR first, then multiply.
# original Ethash
def fnv(v1, v2):
return ((v1 * FNV_PRIME) ^ v2) % 2**32
# Ethash 1a
def fnv1a(v1, v2):
return ((v1 ^ v2) * FNV1A_PRIME) % 2**32
Only the DAG index calculation in the main loop changes:
# before
p = fnv(i ^ s[0], mix[i % w]) % (n // mixhashes) * mixhashes
# after
p = fnv1a(i ^ s[0], mix[i % w]) % (n // mixhashes) * mixhashes
A fixed-function ASIC built for the old order of operations would compute wrong indices, while a GPU just runs slightly different code at the same speed. The spec leaves the prime open between two candidates, 16777499 and 16777639.
Sample code
A runnable sketch comparing the two functions:
FNV_PRIME = 0x01000193 # 16777619, used by original Ethash
FNV1A_PRIME = 16777639 # one of the two candidates in EIP-1355
def fnv(v1, v2):
return ((v1 * FNV_PRIME) ^ v2) % 2**32
def fnv1a(v1, v2):
return ((v1 ^ v2) * FNV1A_PRIME) % 2**32
a, b = 0x12345678, 0x9abcdef0
print(hex(fnv(a, b)), hex(fnv1a(a, b))) # different DAG indices
Things to know
- Status: Withdrawn. It was never activated on Ethereum mainnet.
- The broader anti-ASIC debate centred on EIP-1057 (ProgPoW), a much larger redesign, which also never shipped on mainnet.
- The spec notes the change has no cryptographic impact: FNV is only used to scramble DAG indices.
- The question became moot when Ethereum switched from proof of work to proof of stake at The Merge in 2022. Ethash is no longer used on Ethereum mainnet.