Bitcoin programming #
Controlled supply: #
Understanding bitcoin (core) source code: #
Hash functions and shit #
Steemit paper (for content reference) #
Books and journals #
CONCEPTUALIZING BLOCKCHAINS: CHARACTERISTICS & APPLICATIONS #
Script on txes #
Bitcoin technical details #
http://learnmeabitcoin.com/glossary/coinbase-transaction - coinbase tx
http://royalforkblog.github.io/2014/08/11/graphical-address-generator/#brettonwoods_7_1_1944 - address creation
https://en.bitcoin.it/w/images/en/e/e1/TxBinaryMap.png - transaction structure map
encryption algorithms #
- dsa (ecdsa predecessor)
- schnorr (multisig)
Lightning network #
Chain reorganization #
binance hack cz calls for chain reorg event.
The transaction happened on block 575012
BTC is on block 575090
You need to rewrite 78 blocks at a difficulty of 6,702,169,884,349.
Every block that goes by, the harder it is.
The 49.9% of other miners will be mining the actual chain which would increase the real chain’s block count.
So in order to make this “reorg” possible:
You need to go back 78 blocks (as of this post, probably more if you’re reading this later)
then you have to take 50.1% of the hashing power away (why would miners agree to this? they can mine the actual btc chain and get the block reward but assume they do)
meanwhile, the 49.9% of the miners are mining the real chain.
So let me do the math for you. Right now it’s 78 blocks so I’m going to use 78 blocks. Again, if you’re reading this in the future it’ll probably be more blocks and the numbers will be higher
78 blocks * 2 (because you only have 50% of the hashing power) * 10 minutes (time on average per block) gives you 1560 minutes or 26 hours. Now, that only brings you to block #575090. You need to account for the other 49% of miners mining the real chain while you’re trying to catch up.
You’re literally asking 50% of the miners to mine nothing for a minimum of 26 hours.
These miners aren’t mining for free, they have electricity cost and other cost. To “bribe” these miners, you’ll have to give them a lot more than $40 million.
This is if the attack starts right now. If you start the attack tomorrow, it’s 144 + 78 blocks you have to rewrite.
So another analogy would be
you’re going 50.1 mph (bad miner)
the other car is going 49.9 mph (good miner)
Except the car that’s going 49.9 mph has a 26 hour head start (because it’s 78 blocks ahead)
every 10 minutes, the car going 49.9 mph is getting more than $12.5 dollars for gas (block reward)
you have to pay your own gas every 10 minutes
The question is, who would you bet to win?
Again, this is if you start the race right now. If you wait 24 hours, it’ll be 4440 minutes which is 74 hours. The 49.9 mph car is getting a 74 hour head start if you wait just 24 hours.
26 hours of mining = 6 * 26 = 156 blocks missed. That’s 1950 BTC just in block rewards but you also have to include transaction fees. Looking at the latest block right now, the miner got a total of 14.05735655 btc for mining that block so it’s more than just 12.5 BTC.
So 1950 BTC is the minimum you’re going to lose. That also brings you to just block #575090, not the latest block. You’ll have to mine for more than 26 hours (I just don’t know how much because I don’t know how fast the good chain will grow).
On top of that, you’re not mining BTC’s chain but you’re wasting all the electricity for 26 hours, you need to consider the electrical cost of 1 million+ antminers (I believe there’s around 2 million miners).
So instead of you earning 1950 BTC, you’re losing money.
Then on top of that, if someone just flips 0.1% hash rate (or add new hash rate) of just 0.2%, you will never catch up. If you’re in a pool and your miner isn’t mining the real BTC chain, you’re going to switch pools and go to pool that’s mining the real BTC chain. You literally have to own 1 million miners and mine at a loss for a long time (at minimum, 26 hours as of this post, longer if the blockchain is longer) just to re-org a transaction.
This is much bigger than a $40 million gamble.
I should also add, if you own 1 million miners (those things didn’t come for free)
Once this attack happens, BTC price will go down (dunno by how much) so you literally shot yourself in the foot because a 1 million miner investment + all the electricity contracts you have, you will lose a lot of money.
So if you’re a bad miner (50%) you lose money if the attack fails (electricity & time wasted when you could’ve mined the real BTC chain)
you lose money if the attack succeeds (all your equipment loses value as btc price falls)
It’s a lose-lose situation for miners if they collude. This is why proof of work is important & BTC is the most immutable chain that exists. It’s designed to be that way.