EIP-3372 · Stagnant · Core · 2021-03-13
EIP-3372: 5 FNV primes for ethash
Proposed tweaking Ethash with five new FNV primes so that existing Ethash ASICs would stop working, keeping proof-of-work mining on GPUs until the Merge.
What problem does it solve?
Ethash, Ethereum's proof-of-work algorithm, was designed to be memory-hard so that ordinary GPUs could mine competitively. Over time, dedicated Ethash ASICs appeared. The authors argue these concentrate hash power in a few large operators, push small GPU miners out (especially once EIP-1559 reduced miner income), and leave piles of single-purpose hardware behind after the Merge.
EIP-3372 proposes the smallest possible change that would break hardware with Ethash constants baked in: swap the one FNV prime used in hashing for five different ones. It describes itself as a resubmission of the idea behind EIP-969.
How it works
Ethash mixes data with an FNV-style function: fnv(a, b) = (a * PRIME) ^ b modulo 2³². Today the same prime, 0x01000193, is used everywhere.
From a fork block ETHASH11_BLKNUM, "ethash 1.1" would use different primes in different steps:
| Step | Before | After |
|---|---|---|
| DAG generation | fnv0 |
fnv0 (unchanged) |
| DAG item selection | fnv0 |
fnvA (0x10001a7) |
| DAG item mix | fnv0 |
fnvB (0x10001ab) |
| Compress mix | fnv0(fnv0(fnv0(… |
fnvC(fnvD(fnvE(… (0x10001cf, 0x10001e3, 0x10001f9) |
Keeping DAG generation unchanged means miners do not need a new DAG. GPU miners only need updated software, while ASICs with the old prime fixed in silicon would produce invalid results. The spec includes test vectors for the new algorithm.
Sample code
The FNV step and the new constants (C):
#include <stdint.h>
#define FNV_PRIME_0 0x01000193u /* original, still used for DAG generation */
#define FNV_PRIME_A 0x010001a7u
#define FNV_PRIME_B 0x010001abu
#define FNV_PRIME_C 0x010001cfu
#define FNV_PRIME_D 0x010001e3u
#define FNV_PRIME_E 0x010001f9u
static inline uint32_t fnv(uint32_t prime, uint32_t a, uint32_t b) {
return (a * prime) ^ b; /* uint32 arithmetic wraps mod 2^32 */
}
/* compress-mix step in ethash 1.1 (was fnv0 three times) */
uint32_t compress4(const uint32_t m[4]) {
return fnv(FNV_PRIME_C,
fnv(FNV_PRIME_D,
fnv(FNV_PRIME_E, m[0], m[1]), m[2]), m[3]);
}
Things to know
- Status: Stagnant. It was not adopted. Ethereum kept original Ethash until it left proof-of-work entirely with the Merge (EIP-3675), which made the question moot.
- The broader ASIC-resistance debate also produced EIP-1057 (ProgPoW), a much larger algorithm change that likewise was never activated.
- The spec admits the change only buys time: manufacturers could build new ASICs for the modified constants, and the authors relied on the Merge being close.
- The rationale section contains strongly worded claims about specific companies. Those are the anonymous authors' assertions, not part of the technical specification.