2021-04-17

Bitcoin is the first cryptocurrency in the world. It is implemented in order to simulate the properties of real currency. The transaction is completed without a bank in between. The currency is anonymous. The currency can avoid double-spending. In order to do so, it relies on blockchain technology. Blockchain is basically a chain of transactions it is storing all transaction history since the beginning of bitcoin. And each of the blocks contains about the transactions within about 10mins. The block is signed by the miner and based on the results of the last block. As each of the blocks is signed based on the last block, it became very difficult to be modified and override. If you want to undo a spending couple of blocks ago, you have to redo the block signature for all the blocks behind. And the second concept is proof of works. There are many miners in the world, in order to know which miners signed the block correctly. The wallet software will only accept the hash of the block smaller than a certain value. We call it difficulty. The difficulty is dynamic based on how fast we generate the next block. If the miner generates a block faster than 10mins, the difficulty will be increased, so that it will be kept in about 10mins a block. Every wallet validates the hash and signature so that every wallet will agree on the block generated by the miner. In order to generate the smaller hash, a miner required to have a huge amount of computation power, so that generates a block that meets the criteria is very difficult. Block generation is protected by the difficulty it is called proof of works. In order to modify the block unless you have the more than 50% of computation power in the world. This called a 51% attack. The successful miner could get the reward as an incentive to continually mining. Because only the winning miner will get the reward, that miner individual may never get a chance the reward when competing with the miner all over the world. That's why mining pools are appearing. A group of miners joins together to get a higher chance to win the reward and share the profit. Mining pools may cause the risk of a 51% attack because the owner of the pool could have gathered a huge amount of computation power. The energy usage of Bitcoin is huge, because of its proof of works. A huge amount of energy is spent on calculating the hash. Millions of kilo watts of power are spent on mining. The mining reward is halved every 210K blocks, it is about 4 years. When the reward is decreasing, the transaction fee will become the incentive of mining. But transaction fee is relatively low and not mandatory, so it will hard the be the major income of miners. The mining reward will end about 2140, so it is still a very long time to go. Miners do not need to worry about it.