For anyone interested in the code behind the halving, I had some fun dissecting the GetBlockSubsidy() function that takes care of halving & ending of block subsidy [1].
It continues to amaze me that I struggle to set up a 5-node database cluster without one going out-of-sync or split-braining every few weeks, yet the bitcoin network manages to keep thousands of miners in-sync. This has to be the best example of eventual consistency in a production network.
This is why Blockchain is such an elegant solution to distributed consensus.
I prefer calling it a distributed mechanism for emergent consensus. Consensus is not achieved explicitly - there is no election or fixed moment when consensus occurs. Instead, consensus is an emergent product of the asynchronous interaction of thousands of independent nodes, all following protocol rules.
It continues to amaze me that I struggle to set up a 5-node database cluster without one going out-of-sync or split-braining every few weeks, yet the bitcoin network manages to keep thousands of miners in-sync. This has to be the best example of eventual consistency in a production network.
[1] https://ma.ttias.be/dissecting-code-bitcoin-halving/