EIP-1057 ProgPoW: Programmatic Proof of Work (ProgPoW, a Programmatic Proof-of-Work)

No call decision · Consensus & staking · EIP status Stagnant · created 2018-05-02

A new proof-of-work (PoW) algorithm designed to replace Ethash and utilize nearly every feature of a GPU, minimizing the efficiency gains that dedicated mining hardware (ASICs) can achieve.

Why it is needed

Ethereum's proof-of-work (PoW) was designed with two goals: that anyone should be able to participate easily in mining, and that no particular group should be able to capture abnormally large profits. To achieve this, Ethash chose a sequential memory-hard approach that depends on memory bandwidth. However, looking at eleven years of PoW blockchain history, dedicated mining hardware (ASIC) development has concentrated among a small number of manufacturers, and hardware more efficient than GPUs has actually appeared, such as the Antminer E3, an ASIC built for Ethash, to the point that up to 40% of the network is now mined by ASICs. This threatens Ethash's original design goals of mining accessibility and decentralization.

What changes

Today

After EIP-1057

Who is affected

In depth

Ethash's limitations and ProgPoW's goal

Ethash tried to secure ASIC resistance through a 'sequential memory-hard' approach. However, the text explains that across eleven years of PoW blockchain history, dedicated mining hardware development has concentrated among a small number of manufacturers, and hardware more efficient than GPUs has actually appeared, such as the Antminer E3, an ASIC built for Ethash, reaching a point where up to 40% of the network is mined by ASICs. ProgPoW adds a second path that Ethash did not take: making the computation itself general-purpose, so that 'specialized hardware' effectively becomes a commodity GPU, in order to restore ASIC resistance.

Five core algorithm changes

ProgPoW replaces keccak_f1600 (64-bit words) with keccak_f800 (32-bit words) to reduce power impact, increases the mix state, adds a randomly ordered sequence of math operations to the main loop, adds reads from a small, low-latency cache that supports arbitrary addresses, and increases the DRAM read size from 128 bytes to 256 bytes. This random operation sequence changes every PROGPOW_PERIOD (roughly 2 to 12 minutes depending on configuration), and during mining the source code for that period is generated and compiled on the host CPU, then executed on the GPU.

The gain obtainable with an ASIC is only 1.1 to 1.2x

Even if a custom ASIC is built for ProgPoW, the only parts that can be stripped out are the graphics pipeline, floating-point operations, and tuning a small number of instructions that line up exactly with the merge() function. The text estimates the resulting efficiency gain at around 1.1 to 1.2x, far smaller than Ethash's 2x or CryptoNight's 50x. It also compares the ASIC efficiency gains of existing PoW algorithms, summarizing that the SHA256/Scrypt/X11 family is around 1000x, Equihash and Cuckoo Cycle are around 100x, CryptoNight is around 50x, and Ethash is around 2x.

Tunable parameters

The original Specification defines PROGPOW_PERIOD, PROGPOW_LANES, PROGPOW_REGS, PROGPOW_DAG_LOADS, PROGPOW_CACHE_BYTES, PROGPOW_CNT_DAG, PROGPOW_CNT_CACHE, and PROGPOW_CNT_MATH. As of version 0.9.3 the values are PROGPOW_PERIOD=10, PROGPOW_LANES=16, PROGPOW_REGS=32, PROGPOW_DAG_LOADS=4, PROGPOW_CACHE_BYTES=16x1024, PROGPOW_CNT_DAG=64, PROGPOW_CNT_CACHE=11, PROGPOW_CNT_MATH=18. PROGPOW_PERIOD was reduced from 50 blocks in 0.9.2 to 10 blocks (about 2 minutes) in 0.9.3, to ensure that mining hardware must be fully programmable. ETHASH_DATASET_PARENTS, used for DAG generation, is 256, the same as in the existing Ethash.

Helper functions used in hash computation

ProgPoW uses a 32-bit FNV1a to mix mix data, which the authors explain has better distribution properties than Ethash's FNV1 variant. For random number generation it uses KISS99, the generator with the fewest instructions that still passes the statistical randomness test suite TestU01. More complex generators such as the Mersenne Twister were deliberately excluded because they leave room for ASICs to be made more efficient. The merge() function combines mix data while preserving entropy using one of four operations (multiply-add, XOR then multiply, or left/right rotate then XOR), and the math() function performs a random math operation using one of eleven operations: add, mul, mul_hi, min, rotl, rotr, and, or, xor, clz, popcount.

The main loop and overall hash flow

On each iteration, progPowLoop picks one lane as the leader to determine the address of a 256-byte DAG entry, and every lane sequentially reads PROGPOW_DAG_LOADS (4) 32-bit words from it. It interleaves PROGPOW_CNT_CACHE (11) cache accesses with PROGPOW_CNT_MATH (18) random math operations, then merges in the DAG data read at the start of the loop at the end. The full algorithm (progPowHash) hashes the header plus nonce with keccak_f800 to produce a seed, repeats progPowLoop PROGPOW_CNT_DAG (64) times, reduces the per-lane mixes with FNV1a, and produces the final hash with keccak_f800 again to compare against the target.

Audit results, known vulnerabilities, and current status

This EIP was audited by Least Authority (software) and Bob Rao (hardware). Least Authority proposed changing ETHASH_DATASET_PARENTS from 256 to 512 to prevent a 'Light Evaluation' attack, but the authors did not incorporate this change, recommending deployment of the audited code as is, since Ethash had not been exploited for years and ProgPoW's exploitability was also uncertain. Kik later found a vulnerability that bypasses ProgPoW's memory hardness, but the authors explain that actual exploitation is not possible on Ethereum, since it would require a custom node that accepts a modified block header, which would be blocked during block propagation. The authors themselves also found one similar vulnerability, but do not recommend a fix since its overhead is too large to be ASIC-friendly. The original text states that these vulnerabilities cannot lead to denial of service, double-spending, or network damage, and that in the worst case they give the discoverer only a slight efficiency edge. This EIP's status is Stagnant, and no active discussion is ongoing.

Original EIP · ← EIPs