Published
Edited
Jul 20, 2021
1 fork
Insert cell
# A Interactive Widget for Reorg EV Calculations
Insert cell
#### Methodology


Insert cell
These calculations were inspired by [this thread](https://twitter.com/0x9116/status/1413687423268175873) from 0x9116, with a few modifications. Unlike the original post, we don't assume that block production is a guarantee when considering the next two blocks we can mine, and instead probabilistically weight them based on hashpower percentage.



Insert cell
Let there exist a block A that we haven't mined, let N represent the decimal value of the share of the total mining hashrate we have (so if we had 50%, N = 0.5), and represent the miner payments for A as X, and the expected MEV payments as Y. If we mine the next two blocks on top of A, we have a (N x 100)% chance of mining each independently, so the expected payoff is N x (4 ETH + 2Y). If we attempt a time bandit (and, as 0x9116 originally assumed, quit if the next block B is mined):

1. With 1 - N probability the next block B is mined before we can uncle A and replace it with A'. We're then back at square one, where we just look to mine the next two blocks fairly. The expected payoff in this case is (1 - N) x N x (4 + 2Y).
2. With N x (1-N) probability A' is mined but B is then mined before we can mine B'. A' gets uncled to B, getting a 1.75 ETH reward, and you look to mine the block after B. The expected payoff in this case is N x (1 - N) x (1.75 + N x (2 + Y)).
3. With N<sup>2</sup> probability, we mine both A' and C'. The expected payoff in this case is N<sup>2</sup> x (4 + X + Y).

We then add together the expected payoffs to get the total expected payoff for the time bandit scenario. We then compare it to our expected payoff for honest mining, which is N x (4 + 2Y) to find the bound on X for a reorg to be worth it.
Insert cell
### Widget
Insert cell
import {slider} from "@jashkenas/inputs"
Insert cell
viewof hashRate = slider({
min: .01,
max: .5,
step: .01,
format: ".0%",
description:
"Share of total network hashrate available"
})
Insert cell
viewof blockAMev = slider({
min: 0,
max: 550,
step: .01,
format: ",",
description:
"The value of X, or the miner payments in block A, in ETH"
})
Insert cell
viewof blockRegMev = slider({
min: 0,
max: 550,
step: .01,
format: ",",
description:
"The value of Y, or the expected miner payments for future blocks"
})
Insert cell
The expected payoff of honestly mining the next two blocks on A:
Insert cell

honestMiningExpected = hashRate * 2 * (2 + blockRegMev);
Insert cell
The expected payoff of attempting a time bandit:

Insert cell
scenario1 = hashRate * (1-hashRate) * 2 * (2 + blockRegMev);

Insert cell
scenario2 = hashRate * (1-hashRate) * (1.75 * hashRate * (2 + blockRegMev));
Insert cell
scenario3 = Math.pow(hashRate,2) * (4 + blockAMev + blockRegMev)
Insert cell
timeBanditExpectedPayoff = scenario1 + scenario2 + scenario3
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more