Tail Removal Block Validation

cw-144 difficulty spikes and resulting extended block discovery times (fxramp scenario)
  • cw-144: green
  • k-1: blue
  • wt-144: purple
  • piec: red
credit fork.lol
cw-144, k-1, wt-144 and piec difficulty changes by time

Manipulating Difficulty for Profit

Miners have a monetary incentive to destabilize blockchain difficulty to increase total profit. Let us imagine that 2 blockchains are being stably mined at equal profitability. In this situation miners can switch chains without changing their profits. Can a miner increase profits by switching chains to take advantage of random difficulty changes or even to induce difficulty swings?

blue blocks are mined at low hash rates, purple at high rates
cw-144 10x hash 200 block wavelength
piec 10x wavelength 400
wt-144 10x wavelength 200
wt-144 running a low difficulty mining strategy with half the steady hashpower

Blockchain Difficulty Changes is a Control Theory Problem

The reality is that choosing a blockchain difficulty algorithm, as currently defined, is a provably impossible problem to solve unless some miners mine regardless of profitability. But these “benevolent” miners (the simulations assume 300PH/s), are giving profits away to greedy miners. And even with benevolent miners, the problem remains incredibly hard because these miners are only able to provide rare (1 data point per block) noisy (block discovery has large variation) feedback.

A new block validation algorithm: Tail Removal

In English, I’m proposing that miners mine for 20 minutes at the network difficulty, and then we ramp the difficulty down from its current value to 1 across the next 20 minutes. Nodes choose the active chain as the one with the most work including any difficulty reductions.

  1. The block’s timestamp is less than or equal to the current time, and greater than the prior block. Currently, a block is valid if it is up to two hours into the future. So this requirement proposes that we reduce that requirement to be the current time. This is not strictly necessary, but it will keep the time reported in the blockchain honest)
  2. The POW exceeds the block difficulty, and the block difficulty matches the current network difficulty (today’s algorithm) OR
  3. The current block’s timestamp — prior block’s timestamp > 1200 (20 minutes) and the POW exceeds the “effective difficulty”.

deltaT = block’s timestamp — prior block’s timestamp

decline = difficulty/1200

effective difficulty = max(1, difficulty — (deltaT — 1200)*decline)

“Effective Work” is of course directly calculable from the effective difficulty.

Analysis

This new algorithm cuts off the “long tail” of block discovery, almost guaranteeing that a block will be discovered within 40 minutes (given at least one $20 home ASIC miner is still running).

Eliminating Cheating

So by reducing the block time linearly and eliminating the “validity time window”, the incentive to cheat is reduced, and the ability to do so given a majority of honest miners is removed. Yes, a miner may choose to optimize his block production by “future-mining” but then he must hold off publishing an early discovery until the block’s timestamp is passed.

Majority Mining

In theory a majority of miners could conspire to cheat on the timestamp to increase inflation. However, this behavior would be obvious to all participants, causing a crisis of confidence in the currency. And economic nodes will not accept his block and therefore his new coins until the block’s timestamp has passed, making it impossible to “cash out” before the crisis.

1 Second Past Mining

This mining approach was suggested by Tom Harding in his review of this document. Basically a miner always sets the block timestamp to be 1 second greater than the current block (regardless of the actual time) so that every third block on average will be a difficulty reduced block, unless it is possible to mine difficulty-reduced blocks.

Effect on Difficulty Algorithms and Block Times

The “Tail Removal” block validity algorithm can easily be applied to the simulation without modifying the existing proposed difficulty algorithms. In difficulty assignment, these algorithms all behave similarly to their behaviour without tail removal:

cw-144, k-1, wt-144 and piec difficulty changes by time with tail removal
Block time without tail removal
block discovery time with tail removal

Code Changes

Code changes are minimal, which the great advantages of this approach over more interesting approaches. Since the idea of reducing difficulty already exists in the code as “testnet”, the code is well exercised with the concept of a changing difficulty and unexpected dependencies are unlikely to exist.

  • Changes must be made to the block validation routine to follow the “tail removal” algorithm
  • Chain difficulty should be calculated using the effective difficulty
  • Block headers with a future timestamp should not be downloaded, or downloaded and held until the timestamp is now.

Finale

Even with “benevolent mining”, control algorithms will not be able to choose block times without having extended gaps in block discovery due to the fact that the hash power feedback data is noisy, rare, and becomes even more rare when most needed.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store