Satoshi Bomb

    Why economic feasibility can lead to the collapse of Bitcoin.

    The author of the article is Alexei Malanov, an expert at the Kaspersky Lab’s antivirus technology development department.

    We will discuss how the profitability of bitcoin mining is determined, what principles for adapting the mining speed were laid down in it, and why these principles were ultimately may crash this cryptocurrency.



    We assume that the reader has an idea of ​​the main mechanisms of Bitcoin functioning, such as: blockchain , mining , mining pools, block rewards.

    Warning.In this article, we explore the theoretical possibility of developing the described scenario taking into account the algorithms embedded in Bitcoin. We did not set ourselves the goal of analyzing in detail the cost structure of miners, electricity prices in various parts of the world, bank rates and payback periods for equipment.

    Attack 51%


    In the Bitcoin community, the 51% Attack is well known. If a miner controls more than half of all mining capacities, then he has the opportunity:

    1. Pay with your bitcoins (for a product, service) or simply exchange them for the usual money.
    2. Start generating blocks in which the perfect deal is not included. Do not show the generated blocks to other miners.
    3. Wait for the goods.
    4. Disclose the block chain it generated.

    Wherein:

    • All other miners will have to accept the version of the attacker blockchain as the only true one, because it is longer, since the miner has more mining power than all other participants combined;
    • The attacker receives the goods and saves his bitcoins, since in his version of the story he did not spend them;
    • An attacker receives a reward for all generated blocks, and not for half of the blocks that he would generate if he played honestly and built a common chain. Although his income will remain the same until the next recount of complexity;
    • Most likely, when carrying out an attack, an attacker will buy coins of another cryptocurrency for bitcoins, because it is fast, quite safe and irreversible.

    The community agrees that such an attack, if it were feasible, would cast doubt on the further functioning of the Bitcoin network.

    It is also important to understand that for a successful attack, it is not necessary to control 51% or more of the capacities. With some probability, it is feasible and with a smaller share. For example, having 30% of the power, an attacker can, with a probability of ~ 18%, secretly generate a chain of 5 blocks in a row, which will be longer than the public one. In this case, the attacker gets the same advantages as in the “51% attack”. And in case of failure, he can simply try again. Most services that accept payments in bitcoins require only five “confirmations”, that is, such a generated chain will be enough.

    Mining difficulty adaptation


    After generating every 2016 blocks, the Bitcoin network adapts the mining complexity. The norm is such complexity, in which it takes an average of 10 minutes to mine one block. Thus, two weeks should be spent on calculating 2016 blocks. If, for example, it took just one week to generate, then after the next recalculation, the complexity will be doubled (thus, the next 2016 blocks with the same network capacity will need to be generated again 2 weeks).

    Note that the Bitcoin network prohibits programmatically changing the mining complexity by more than 4 times for one allocation.

    Direct consequences of these rules. If mining power is added or turned off somewhere in the middle of a period of 2016 blocks, then:

    • This does not affect the reward that the remaining miners will receive. The reward is determined by the hashrate of the miner, and not its share in the total hashrate. For example, when half the power is turned off, the remaining miners will get twice as many blocks, but in twice as much time. Profit will remain.
    • This directly affects the speed of production. If 99% of miners stop mining, then another recalculation of complexity will occur in about 4 years. And the generation time of one block will be approximately 16 hours.

    The authors of Bitcoin suggested that the described algorithm would smoothly regulate the power of the network, displacing the least energy-efficient equipment and returning the margin of the remaining to a reasonable extent. However, in reality, such a rare recalculation of complexity leads to a different strategy for miners: they can cheat the algorithm, artificially lowering network performance. Indeed, with a sudden shutdown of equipment, the profit for the day remains at the same level, and with a sudden turn on, costs are reduced.

    Mining commissions and miners free will


    In addition to the block reward (of the emitted currency), miners also take away a commission for conducting transactions included in the block. Now commissions are about 10% of the block reward. We will not dwell on this in detail, however, according to our calculations, it turns out that the existence of commissions makes the miners' strategy under study even more profitable.

    Another aspect, mining pools often do not directly control the mining power in their composition. Each participant and equipment owner is free to choose which pool to work in. Usually, the decision to move from pool to pool is made for economic reasons.

    However, the policy of turning on / off capacities, switching capacities to mining alternative currency (Bitcoin Cash) is determined by the pool manager. In other words, we believe that the described behavior strategy should be accepted and implemented by only ~ 20 participants - owners of pools, although the equipment owners themselves have “free will”, but they do not play a role.

    Suppose that the total power of all miners has stabilized, consider one of the strategies to increase margin.

    An example of the behavior of a miner with a stable Bitcoin network power


    For simplicity, let's say that you control half of the total power of the Bitcoin network. You can keep the equipment on all the time and get a reward for about 1008 blocks (50%).

    Or you can do the following:



    1. Wait for the start of the next period of 2016 blocks.
    2. Turn off your power.
    3. Wait for the remaining miners to mine 2016 blocks in 4 weeks.
    4. After that, the Bitcoin network will halve the mining complexity for the next period.
    5. You turn on your capacities, this will allow the entire network to mine 2016 blocks in one week.
    6. In just one week you will receive a reward for the same (approximately) 1008 blocks.

    Please note that in the first scenario for 5 weeks of normal work you would receive a reward for 5/2 * 1008 = 2520 blocks, but you would pay for electricity for the whole time. In the second scenario, for the same five weeks you get a reward for 1008 blocks, but pay for electricity for only one week.

    Assume that the cost of electricity is approximately 90% of the reward. It is easy to calculate that the profit in the first scenario for five weeks is equivalent to the reward for 2520 * 0.1 = 252 blocks, and in the second scenario “reward-costs” = 1008 - 0.9 * 1008/2 = 554.4. That is, the proposed strategy is 2 times more profitable.

    Cost-effective miner behavior with various parameters


    Let be:

    • Smart miner controls share $ x $ of the total network power.
    • For all 2016 blocks, the reward in bitcoins is $ A $.
    • For the operation of all network equipment in two weeks, the costs of electricity and maintenance amount to $ C $. We assume that the rental of premises and the cost of equipment downtime are negligible. For simplicity, we intentionally do not consider depreciation of equipment.

    Then:

    1. In normal operation, the miner’s reward is $ Ax - Cx $ for a period of two weeks.
    2. If a smart miner turns off its equipment, the network will generate 2016 blocks in a period of $ \ frac {1} {(1-x)} $more.
      For example, if$ x = 1/3 $it will take one and a half times more time to finish the job.
    3. After the period of adaptation of complexity by the network and the inclusion of the equipment of the smart miner, the network performs work in $ (1-x) $times faster than conceived two weeks.
      For example, if$ x = 1/3 $then after turning on his equipment it will take 2/3 of the usual time, about 10 days.
    4. The total duration of two periods will be $ (\ frac {1} {1-x} + 1-x) * (2 weeks) $;
    5. Thus, in a normal situation (without shutdowns), miners, working these two periods, earn $ P_ {regular work} = (\ frac {1} {1-x} + 1-x) * (A - C) = (2+ \ frac {x ^ 2} {1-x}) * (A - C) $
      That is, all miners get a little more than two net profits for such an extended conditional period.
    6. A smart miner working with shutdown will not earn anything for the first period, but for the second, shorter period it will receive $ P_ {smart} = Ax - Cx (1-x) = Ax - Cx + Cx ^ 2 $
      That is, a smart miner gets one habitual net profit and additionally saves a share $ x $ from the costs.
    7. All non-disconnected miners for a slow period will earn $ P_ {slow period} = AC $, and for a quick period $ P_ {fast period} = A - C (1-x) $, because the reward is the same, but they work faster.

    It is easy to see that:

    • If the costs of the miner are exactly equal to his reward (the miner works with zero margin), then a smart approach will allow him to get a net profit of $ Ax ^ 2 $.
    • If the miner works with free electricity (100% margin), then during normal work it will earn more than two profits per period, and when working with downtime - one.
    • Find out how much equipment x needs to be turned off to maximize the profit of all miners at margin $ M = (A - C) / A $:

      $ max_ {x} (P_ {slow period} + P_ {fast period} - P_ {normal work}) = $

      $ max_ {x} (AC + AC (1-x) \ ldots - \ ldots (2+ \ frac {x ^ 2} {1-x}) (AC)) $

      $ max_ {x} (M + M + (1-M) x \ ldots- \ ldots (2+ \ frac {x ^ 2} {1-x}) M) $

      $ max_ {x} (\ frac {(x-Mx) (1-x) - Mx ^ 2} {1-x}) = $

      $ max_ {x} (\ frac {-x ^ 2-Mx + x} {1-x}) $

    This expression reaches a maximum at$ x = 1- \ sqrt {M} $. For example, when$ M = 4% $ smart miners should temporarily turn off 80% of the equipment.

    Why miners do not use the described strategy now



    Bitcoin network capacity growth. Over the year, the network capacity has grown more than 4 times ( Source )

    The increase in the complexity of the Bitcoin network for all time. Since January 2016, the complexity has grown 8 times, as well as the cost of bitcoin. ( Source )

    The described strategy makes sense only if the overall complexity of the network does not grow. Otherwise, turning off the equipment does not lead to a decrease in complexity and is economically disadvantageous.

    Until now, mining capacities have been growing at a rapid pace; this is a consequence of the growth of the Bitcoin exchange rate. The profit of the miner is calculated in bitcoins, and he bears the costs in traditional currency.

    Bitcoin Rate Growth ( Source )

    However, it is reasonable to assume that if Bitcoin does not grow infinitely in price, then sooner or later it will become economically impractical to commission new mining capacities, and the cost of electricity will almost equal the reward.

    What threatens the shutdown of mining capacities


    When the commissioning of new mining capacities ceases, miners will be able to apply the strategy described above.

    Bitcoin Capacity Distribution by Pools ( Source)

    If mining pools maximize their own profit, then at a margin of 6.25%, shutdowns of up to 75% of capacities should be expected. It makes no sense to turn off more equipment, because the network will not reduce complexity by more than 4 times.

    After that, to carry out the “51% Attack”, the attacker must either control more than half of the remaining capacity (which is easily feasible with the current distribution of capacities), or suddenly turn on more equipment than worked before (which is not feasible given the share of the largest pool).

    The question arises: is it profitable to attack the network to a person who has invested heavily in increasing mining capacities? Yes, profitable. Given the low mining margins, the cost of existing mining equipment is also reduced. In other words, if mining does not make a profit, staying honest becomes unprofitable. In addition, the attacker can remain anonymous, and, among other things, play to lower the price of bitcoin.

    Bitcoin Cash Attack


    We deliberately do not consider a situation in which the cost of electricity will quickly and significantly increase, or, more likely, the cost of bitcoins will quickly and significantly fall. In this case, the strategy of the miners is quite obvious. In case of sharp adverse price fluctuations, all 100% of miners will turn off the equipment. Only those who use free electricity will stay afloat. In this case, the network’s work will simply stop - it will take time commensurate with life to complete the “two weeks”, and the inability to conduct transactions will further lower the price of bitcoin.

    Just the other day, our colleague analyzed at BitcoinMagazinethe situation with the Bitcoin Cash currency, which appeared as a result of the split of the Bitcoin network on August 1, 2017. The new currency has the principle of Emergency Difficulty Adjustment. EDA allows you to adapt complexity in the Bitcoin Cash network even more often, namely: if less than 6 blocks were formed in 12 hours, then the complexity is reduced by 20%. The author comes to conclusions similar to ours, but, more importantly, notes that he is already observing the manipulations of smart miners. He fears the destabilization of the Bitcoin Cash network and expects early intervention by developers.

    Conclusion


    We analyzed one of the economically feasible strategies for honest miners to behave in conditions when the Bitcoin network capacity stops growing. We calculated some key parameters of such a strategy and found that following it is beneficial for each participant individually, but significantly increases the risks of an “51% attack” and the potential collapse of the Bitcoin system as a whole.

    If all the miners were able to reliably agree, they could go further: conditionally turn off all equipment, except for one device. This would be optimal in terms of profit, but fatal in terms of network security.

    How should miners act to guarantee security? We see a couple of analogies here. The first is the crisis of overproduction, when it happens, producers agree and publicly destroy part of the goods (at least that was the case in the Middle Ages). The second is nuclear disarmament, the countries that possess large arsenals agree on their proportional reduction.

    In an ideal world, all miners should agree to disable a certain portion of their equipment and, most importantly, to control it for destruction. It is important not only to systematically destroy, but also strictly control its production.

    Count on such a "peaceful" result is not necessary. The recent split of the Bitcoin chain into two and the formation of Bitcoin Cash shows that miners are not always able and willing to solve common problems together. Perhaps in the future, the ability to cooperate will become a decisive factor.
    Time will show how our theoretical research fits into practice.

    Read also:



    Also popular now: