EIPs Explained

EIP-1485 · Stagnant · Core · 2018-11-01

EIP-1485: TEthashV1

A stagnant proposal to swap Ethash's FNV-0 mixing function for FNV-1a, a small change meant to make existing Ethash ASIC miners obsolete.

What problem does it solve?

In 2018 ASIC miners built specifically for Ethash, Ethereum's proof-of-work algorithm, began to appear. Many in the community worried that specialized hardware would concentrate mining in a few hands, since GPUs would no longer be competitive.

TEthashV1 proposes the smallest possible change to Ethash that would still break those ASICs: replace the hash function used to mix data, without redesigning the algorithm. The authors also argue the current function, FNV-0, is a deprecated variant with weak avalanche behaviour (flipping one or two input bits changes few output bits).

How it works

Ethash uses an FNV-style function in two places: building the large DAG dataset, and the 64 mixing rounds that combine the header hash with pseudo-random DAG pages. In Ethash it is essentially:

#define FNV_PRIME 0x01000193U
#define fnv(x, y) ((x) * FNV_PRIME ^ (y))      // FNV-0 style, no offset

TEthashV1 replaces it with FNV-1a, which starts from a fixed offset basis and XORs before multiplying:

#define FNV_PRIME        0x01000193U
#define FNV_OFFSET_BASIS 0x811c9dc5U

#define fnv1a(x, y) ((((FNV_OFFSET_BASIS ^ (x)) * FNV_PRIME) ^ (y)) * FNV_PRIME)
#define fnv1a_reduce(a, b, c, d) (fnv1a(fnv1a(fnv1a(a, b), c), d))

Everything else (DAG size and growth, Keccak steps, the overall mixing structure) stays as in Ethash. Because hardware that hard-wires the old mixing step would compute wrong results, existing ASICs would stop producing valid blocks, while GPU miners only need a software update.

The spec also describes a byte-wise variant it calls FNV1c and includes a test harness comparing bit-difference counts between the variants.

Sample code

A tiny C check that the two functions really diverge, so old hardware would fail:

#include <stdio.h>
#include <stdint.h>

#define FNV_PRIME        0x01000193U
#define FNV_OFFSET_BASIS 0x811c9dc5U
#define fnv(x, y)   ((uint32_t)((x) * FNV_PRIME ^ (y)))
#define fnv1a(x, y) ((uint32_t)((((FNV_OFFSET_BASIS ^ (x)) * FNV_PRIME) ^ (y)) * FNV_PRIME))

int main(void) {
    uint32_t a = 0x12345678, b = 0x9abcdef0;
    printf("ethash fnv : %08x\n", fnv(a, b));
    printf("tethash v1 : %08x\n", fnv1a(a, b));
    return 0;
}

Things to know

  • Status: Stagnant. It was never scheduled for any Ethereum hard fork.
  • The authors report a 2–3% GPU hashrate reduction from the extra arithmetic, based on their own miner.
  • It was one of several anti-ASIC proposals of the time. EIP-1355 (Ethash 1a, Withdrawn) suggested a similar FNV change, and EIP-1057 (ProgPoW) proposed a larger redesign. None were activated on mainnet.
  • Ethereum moved to proof-of-stake at The Merge, so Ethash and any variant of it no longer secure the chain.
  • Unlike most EIPs, this text is licensed CC BY-NC-SA 4.0 rather than CC0.

#pow #ethash #mining #asic #core

Details

Authors
trustfarm <[email protected]>, trustfarm <[email protected]>
Status
Stagnant
Type
Standards Track / Core
Created
2018-11-01

Machine-readable: Markdown · JSON