Selfish Mining & Stubborn Mining Simulation

Selfish & Stubborn Mining Strategies

Selfish mining.


In year 2010, user RHorning described the idea of selfish mining in the Bitcoin forum bitcointalk. The forum user provided simulation results for the attack, at the time called the mining cartel attack. Later in 2013 the term selfish mining and its formal description was introduced by Cornell researchers Emin Gün Sirer and Ittay Eyal in the paper Majority is not enough: Bitcoin mining is vulnerable.

The selfish mining attack is a method for mining pools to increase their returns by not playing fair.

The selfish miner continues to mine the next block but not broadcast it. They continue to do so maintaining their lead. This way there would be a hidden fork in the blockchain which can only be seen by the selfish miner. When the rest of the network is about to catch up with the selfish miner then the selfish miner releases their portion of solved blocks into the blockchain.

The result is that their chain and proof of work is longer and more difficult so the rest of the network adopts their block solutions and they claim the block rewards.

Stubborn mining.


After introducing selfish mining some further researches showed that more generalized selfish mining strategies could be even more profitable.

for example Theoretical Bitcoin Attacks with less than Half of the Computational Power (draft)

and specially Stubborn Mining: Generalizing Selfish Mining and Combining with an Eclipse Attack

provided a comprehensive generalization of selfish mining and also introduced different names for each of its variations:

Lead Stubborn Mining Strategy

A Lead Stubborn Miner waits until the honest miners catch up with him to broadcast all of his secret blocks as opposed to the selfish miner who does not take the risk of being caught by the honest miners and broadcasts his blocks if his advance shrinks to one block.

j–Trail Stubborn Mining Strategy

trail Stubborn Mining is an amelioration of Lead Stubborn Mining. When a trail Stubborn Miner's private chain falls behind the public chain, they may decide to continue mining on it anyway, in the hope of catching up. We consider a family of trail stubborn strategies parameterized by a threshold j, such that a j–trail stubborn miner accepts the public blockchain only when their private chain falls behind the public chain by j + 1 blocks). So by definition the 1–trail stubborn mining is the same as lead stubborn mining. Here we study only 2–trail, 3–trail and 4–trail stubborn mining since the other trail stubborn strategies can be easily dominated by other strategies.

Equal Fork Stubborn Mining Strategy

An Equal Fork Stubborn Miner waits for the official blockchain to overcome his secret fork by one block. He/she only gives up when the length of the official blockchain is equal to the length of his secret fork plus one.

Try it yourself.


Of course these strategies are not generally more profitable than the honest mining strategy. For example if you own even a 25% hash rate share of the network (which is usually denoted by α), being a selfish miner would never be more profitable than being an honest miner unless for some reason more than half of the other miners chose to mine on the fork you have created (which is usually denoted by γ).

If you are interested in seeing when you can exploit the network by being a selfish or a stubborn miner in the next section you can find a simulation of these strategies. You can change the sliders and click the simulate button to see that in comparison with an honest miner, which strategy is more profitable and by how much.

This is a simulation based on a random number generator used in the simulation of mining a block, so every time you push the button the results would be a little bit different.

So

Simulate.


α      ∣      

γ      ∣      

n      ∣      

In other words


  • NOTE : If you set n very low, selfish and stubborn strategies won't be more profitable than being honest, no matter how high your α and γ are (because before first difficulty adjustment profitability of selfish and stubborn mining are always less or at best equal to honest mining).

Need more stats?


First you can go back and change the α , γ and n again and click simulate.

POOL STATS

Here you can find some information about the mining blocks of different strategies based on your chosen α , γ and n.

Honest
Mining
Selfish
Mining
Lead
Stubborn Mining
2 – Trail
Stubborn Mining
3 – Trail
Stubborn Mining
4 – Trail
Stubborn Mining
Equal Fork
Stubborn Mining
You Published
Others Published
Total Blocks Published
Orphaned Blocks
Total Blocks Mined
Orphaned Percentage
You Published % of all blocks
Others Published % of all blocks


PROFITABILITY

Here you can find some information about the apparent hash rate, profitability, difficulty changes and attack duration of different strategies based on your chosen α , γ and n.

Honest
Mining
Selfish
Mining
Lead
Stubborn Mining
2 – Trail
Stubborn Mining
3 – Trail
Stubborn Mining
4 – Trail
Stubborn Mining
Equal Fork
Stubborn Mining
Your Real Hash Rate
Your Apparent Hash Rate
Your Profitability Ratio
Difficulty Changed
Difficulty Will Change To
Attack Cycles Duration


THEORETICS

Here you can find the expected theoretical values of the apparent hash rate and profitability ratio of different strategies based on your chosen α , γ and n.
For more information click here

Honest
Mining
Selfish
Mining
Lead
Stubborn Mining
2 – Trail
Stubborn Mining
3 – Trail
Stubborn Mining
4 – Trail
Stubborn Mining
Equal Fork
Stubborn Mining
Your Apparent Hash Rate Would Be
Your Profitability Ratio Would Be

Mathematical formulation.


Although some mathematical formulations for these strategies have been developed before, they usually lack a consideration of the time(duration) of the attack and also the proper analysis of the costs of the attack. For example in Optimal Selfish Mining Strategies in Bitcoin selfish mining strategies are considered to be optimal. The same goes for some textbooks like Bitcoin and Cryptocurrency Technologies and Distributed Ledger Technology: The Science of the Blockchain .

In contrast in year 2018 three articles On Profitability of Selfish Mining , On Profitability of Stubborn Mining and On Profitability of Trailing Mining were published providing a deep and comprehensive study on these strategies.

Let's take a look at some parts of the these articles.

As you know

  •         α  is your hash rate share of the network.
  •         β  is the others' hash rate share of the network ( β=1α ) .
  •         λ  is the relative hashing power of the attacker ( λ = α β < 1 ) .
  •         γ  is the proportion of honest miners who mine on the fork you created.

you should also know

  •         b  is the reward for finding a block.
  •         τ0  is the average inter-block validation time (which is around 10 minutes for bitcoin).

now we define

  •         A  as your Apparent Hash Rate (find the definition below).
  •         P  as your Profitability Ratio (find the definition below).

First of all your Hash Rate ( α ) means that we expect in the long term the average proportion of blocks mined by you would be also α . Then since you are adapting a selfish or stubborn strategy the average proportion of blocks mined by you could be different than α so we define your Apparent Hash Rate ( A ) which is a function of α and γ. On the other hand Profitability Ratio ( P ) is a function of α , γ , b and τ0 which is the benchmark for the comparison of different strategies, more precisely, strategy x is more profitable than strategy y if and only if Py<Px .

For example profitability ratio of selfish mining strategy ( Psm ) has different values before and after difficulty adjustment:

P s m = { ( α ( 1 γ ) β 2 α ( β α ) ( 1 + β α ) ( β α ) + β α ) b τ 0 b e f o r e d i f f i c u l t y a d j u s t m e n t ( α ( 1 γ ) β 2 ( β α ) ( β α ) ( 1 + β α ) ( β α ) + β α ) β α + β α ( β α ) β α β 2 α + β α b τ 0 a f t e r d i f f i c u l t y a d j u s t m e n t

This fact also holds for apparent hash rate of selfish mining strategy ( Asm ) :

A s m = { ( α ( 1 γ ) β 2 α ( β α ) ( 1 + β α ) ( β α ) + β α ) b e f o r e d i f f i c u l t y a d j u s t m e n t ( α ( 1 γ ) β 2 ( β α ) ( β α ) ( 1 + β α ) ( β α ) + β α ) β α + β α ( β α ) β α β 2 α + β α a f t e r d i f f i c u l t y a d j u s t m e n t

The reason for that as described in the article is:

“The protocol underestimates the real hashing power in the network since only the blocks that are in the (offcial) blockchain are taken into account. The number of orphan blocks grows in the presence of a selfish miner and a signi cant amount of honest hash rate is lost. The average time used by the network to validate blocks increases. After 2016 blocks, a difficulty adjustment is done automatically ignoring the production of orphan blocks. Despite the fact that the total hashing power of the network remains the same, the new difficulty is lower than it should be, and the block validation time decreases. So the revenue per unit of time of the selfish miner improves and makes the attack profitable.”

Here you can find profitability ratio and apparent hash rate of different strategies:

(   hm           |           Honest Mining Strategy,
    sm            |           Selfish Mining Strategy,
    lsm           |           Lead Stubborn Mining Strategy,
    j–tsm       |           j–Trail Stubborn Mining Strategy,
    efsm        |           Equal Fork Stubborn Mining Strategy.   )

  •          A h m = α
  •          P h m = α b τ 0
  •          A s m = { ( α ( 1 γ ) β 2 α ( β α ) ( 1 + β α ) ( β α ) + β α ) b e f o r e d i f f i c u l t y a d j u s t m e n t ( α ( 1 γ ) β 2 ( β α ) ( β α ) ( 1 + β α ) ( β α ) + β α ) β α + β α ( β α ) β α β 2 α + β α a f t e r d i f f i c u l t y a d j u s t m e n t
  •          P s m = { ( α ( 1 γ ) β 2 α ( β α ) ( 1 + β α ) ( β α ) + β α ) b τ 0 b e f o r e d i f f i c u l t y a d j u s t m e n t ( α ( 1 γ ) β 2 ( β α ) ( β α ) ( 1 + β α ) ( β α ) + β α ) β α + β α ( β α ) β α β 2 α + β α b τ 0 a f t e r d i f f i c u l t y a d j u s t m e n t
  •          A l s m = { ( α β α ( β α ) ( 1 γ ) γ 1 β ( 1 γ ) C ( ( 1 γ ) β α ) β + α ( β α ) ) b e f o r e d i f f i c u l t y a d j u s t m e n t ( α β α ( β α ) ( 1 γ ) γ 1 β ( 1 γ ) C ( ( 1 γ ) β α ) β + α ( β α ) ) β + β α α 2 β + β α α a f t e r d i f f i c u l t y a d j u s t m e n t
  •          P l s m = { ( α β α ( β α ) ( 1 γ ) γ 1 β ( 1 γ ) C ( ( 1 γ ) β α ) β + α ( β α ) ) b τ 0 b e f o r e d i f f i c u l t y a d j u s t m e n t ( α β α ( β α ) ( 1 γ ) γ 1 β ( 1 γ ) C ( ( 1 γ ) β α ) β + α ( β α ) ) β + β α α 2 β + β α α b τ 0 a f t e r d i f f i c u l t y a d j u s t m e n t
  •          A e f s m = { ( α 1 γ γ ( β α ) ( 1 β C ( ( 1 γ ) β α ) ) ) b e f o r e d i f f i c u l t y a d j u s t m e n t ( α 1 γ γ ( β α ) ( 1 β C ( ( 1 γ ) β α ) ) ) 1 β a f t e r d i f f i c u l t y a d j u s t m e n t
  •          P e f s m = { ( α 1 γ γ ( β α ) ( 1 β C ( ( 1 γ ) β α ) ) ) b τ 0 b e f o r e d i f f i c u l t y a d j u s t m e n t ( α 1 γ γ ( β α ) ( 1 β C ( ( 1 γ ) β α ) ) ) 1 β b τ 0 a f t e r d i f f i c u l t y a d j u s t m e n t
  •          A j t s m = { α + ( 1 γ ) β α ( β α ) ( β + β α α 2 ) [ j + 1 ] ( ( [ j 1 ] + 1 β P j ( λ ) [ j + 1 ] ) λ 2 2 1 4 ( 1 γ ) β α + β α ) 1 + ( 1 γ ) β α β + β α α 2 ( j + 1 ) ( [ 2 ] [ j + 1 ] 2 j + 1 ) b e f o r e d i f f i c u l t y a d j u s t m e n t α + ( 1 γ ) β α ( β α ) ( β + β α α 2 ) [ j + 1 ] ( ( [ j 1 ] + 1 β P j ( λ ) [ j + 1 ] ) λ 2 2 1 4 ( 1 γ ) β α + β α ) β + β α α β + β α α 2 + ( 1 γ ) β α β + β α α 2 ( j + λ ) ( 1 [ j + 1 ] 1 j + λ ) a f t e r d i f f i c u l t y a d j u s t m e n t
  •          A j t s m = { α + ( 1 γ ) β α ( β α ) ( β + β α α 2 ) [ j + 1 ] ( ( [ j 1 ] + 1 β P j ( λ ) [ j + 1 ] ) λ 2 2 1 4 ( 1 γ ) β α + β α ) 1 + ( 1 γ ) β α β + β α α 2 ( j + 1 ) ( [ 2 ] [ j + 1 ] 2 j + 1 ) b τ 0 b e f o r e d i f f i c u l t y a d j u s t m e n t α + ( 1 γ ) β α ( β α ) ( β + β α α 2 ) [ j + 1 ] ( ( [ j 1 ] + 1 β P j ( λ ) [ j + 1 ] ) λ 2 2 1 4 ( 1 γ ) β α + β α ) β + β α α β + β α α 2 + ( 1 γ ) β α β + β α α 2 ( j + λ ) ( 1 [ j + 1 ] 1 j + λ ) b τ 0 a f t e r d i f f i c u l t y a d j u s t m e n t

In Equal fork stubborn mining C(x) is generating series for Catalan numbers and is the n-th Catalan number

C ( x ) = n = 0 + C n x n = 1 1 4 x 2 x = 2 1 + 1 4 x

C n = 1 2 n + 1 ( 2 n n ) = ( 2 n ) ! n ! ( n + 1 ) !

In j–trail stubborn mining j1 and j N

[ j ] = 1 λ j 1 λ

P j ( λ ) = 1 j λ j 1 + j λ j + 1 λ 2 j ( 1 λ ) 3

Read more.


If you are intrested in these stuff, here is some links for you :

For selfish mining this is probably the best source.

For stubborn mining this is the best source.

For mathematics of selfish mining this is the best source.

For mathematics of stubborn mining this and this are absolutely the best sources.

Contact.


Do you have any question?

diba.meysami@gmail.com

makh.khosravi@gmail.com