Then after the block halving, mining profitability nearly halves
I think you meant to say that mining
revenue halves. If they were already operating on a tight margin, then
profitability is eliminated and until enough hash power is shut off, everyone is operating at a loss.
and many miners have to switch off their equipment. The equilibrium is reached when half the miners switch off.
Actually, equilibrium will be reached when half of the hash power is shut off. This could be more than half the miners, it could be less than half the miners. Since the most inefficient mining equipment is most likely to be shut off the earliest, the number of "miners" will largely depend on how many miners are running older more inefficient equipment.
The market of mining equipment is over-supplied, the prices drop to almost zero. Thus one can buy all those switch-off miners - that represent half the network hash power- for a very small cost.
Except that if a single person is trying to buy ALL the available mining power, this would be a huge increase in DEMAND. So, while the supply would increase, the demand would be increasing along with it. This huge demand would drive prices for the equipment through the roof and make it extremely expensive to purchase this left over equipment. Those with access to extremely cheap electricity would also be competing with the potential attacker to purchase this equipment, making it exceedingly difficult for a single entity to gain control of 100% of the equipment that was shut off. I think you'll find that acquiring more than 50% of the entire global hash power will not be a "very small cost". Furthermore, the equipment that is available to purchase will be the most inefficient (and therefore most expensive to actually operate).
Let's say he wants to mine k consecutive blocks. With 50% power he should
expect to wait 2^k blocks before he gets these. Running half the network for that long costs (since we assumed miners operated on low margin before the halving) 1/2 2^k BR in electricity where BR is the block
reward before halving.
Remember that the equipment that was sold off was the most inefficient equipment. The more efficient equipment would still be in the hands of the original owners and still running in locations with competitive electricity costs. Therefore, the cost to operate the most inefficient 50% of the pre-halving hash power should be significantly more than 1/2 2^k BR.
Since during this time he also gets half of the new block rewards, the total cost is 3/4 2^(k-1) BR + N
You are mistaken. In order to successfully perform a 50%+1 attack, the attacker would receive 100% of the new blocks during the attack.
Therefore, the attacker would gain 1/2(2
k)(BR) in revenue. Theoretically, if the attacker wasn't running inefficient equipment, this would exactly offset the 1/2(2
k)(BR) in operating costs. In addition to the fact that the attacker is running inefficient equipment, an additional catch is that the costs would be incurred at the time that the equipment is running, and the revenue wouldn't be available until the attack was over. Once the attack is over, the revenue is worth significantly less (due to loss of faith in bitcoin security). The attacker will still need to pay for their operating costs in non-BTC currency, but will not have earned enough BTC value to cover those costs.
Putting some numbers here: current BR=25 BTC; we can take k=6 (now some big exchanges accept as little as 3 confirmations, I guess all the big ones accept less than 6), we get 3/4 * 800 BTC + N. Now given the discussion above I think it's not unreasonable to assume N<200BTC, bringing the total to 800BTC.
As we've already explained, your "3/4 2^(k-1) BR + N" is incorrect. Even if it was correct, you got the math wrong:
2
6 = 64
64 * 25 = 1600 (not 800)
3/4 * 1600 = 1,200
If we are willing to accept your unlikely prediction of N<200, you are still looking at a total cost (using your formula) of nearly 1,400 BTC.
This means that the attacker would need to successfully complete an attack that allows them the opportunity to steal at least 1,400 BTC and would need to cash out those 1,400 BTC before the attack was noticed and the exchange rate crashed. This overlooks all the logistics costs of transporting, housing, and connecting all that equipment.
what do you guys think? Did I make any major mistake in this calculation? Has this been discussed and dismissed before?
50%+1 attacks are a common concept re-introduced by people that don't take the time to consider all the ramifications. It's been discussed in hundreds of ways. You made some mistakes in your calculations, and you made some very unlikely assumptions.