User:Frederikwh91/sandbox
The selfish mining strategy is a strategy in the Bitcoin network to achieve greater revenue on mining. The Bitcoin protocol currently spreads revenue uniformly over the network based on computing power relative to the total computing power on the network. The selfish mining strategy lets a pool of miners with less than 50% of the computing power in the network effectively mine more blocks than it relative size.
The strategy
[edit]The main idea for the selfish pool is to let the others waste their superior computing power. Whenever the pool finds a block they keep it a secret. Now the pool will have a chance at mining another block to gain a lead of two blocks in which case the selfish miners will be sure to get reward for two mined blocks even though the others find a block.
If the pool has a lead of two blocks they are able to publish their two blocks if the other miners publish a block. The protocol states that one should mine on the longest chain and this is the selfish miners chain. So for a lead of 2 or more blocks in favor of the pool, the pool will always get full revenue of keeping their blocks a secret.
In the case of a lead of one where the others mine a block before the pool, the pool will publish their block. In this case where both chain are of equal length the protocol states that a node should mine on the head of the chain it heard of first. This means that a parameter γ comes in to play. γ is the relative size of the network that the pool are able to publish their block to first such that this part of the network will mine on the pool's head. There are three outcomes in case of an equalizer. Either the honest miners that mine on the head of the public branch will mine the next block. In this case the honest miners gain reward for two mined blocks and the selfish miners get nothing. Else the honest miners that mine on the head of the selfish miners branch or the selfish miners will mine the next block. In the first case the honest miners will get a reward for one and the selfish miners will get a reward for one block. In the last case the selfish miners will get a reward for one block.
So both the computing power of the pool α and the γ parameter will be important for the selfish miners.
Revenue
[edit]The theoretical relative revenue of the selfish miner is
We note that in order for the strategy to be successful the revenue should be larger than the revenue of following the ordinary mining strategy which is . This turns out to give a relationship between :
The algorithm
[edit]To implement the selfish mining strategy this block-publishing algorithm[1] should be implemented instead of the current block-publishing procedure. The selfish miners mine on their own private branch.
Algorithm Selfish-Mine Initialization public chain ← publicly known blocks private chain ← publicly known blocks privateBranchLength ← 0 Mine on head of private chain if Selfish miners find a block Δprev ← length(private chain)-length(public chain) append new block to the private chain privateBranchLength ← privateBranchLength + 1 if Δprev = 0 and privateBranchLength=2 then publish all of the private chain privateBranchLength ← 0 Mine at the new head of the private chain if Other miners find a block Δprev ← length(private chain)-length(public chain) append new block to the public chain if Δprev = 0 then private chain ← public chain privateBranchLength ← 0 else if Δprev = 1 then publish last block in private chain else if Δprev = 2 then publish all of the private chain privateBranchLength ← 0 else publish first block in private chain
- "←" denotes assignment. For instance, "largest ← item" means that the value of largest changes to the value of item.
- "return" terminates the algorithm and outputs the following value.