Most of our financial transactions are managed by centralized institutions like banks and credit card companies. We trust that these companies will properly manage transactions, so no one can spend the same dollar twice. In other words, if you have $300 in your checking account, you can’t use your debit card to buy a $300 message chair, and then quickly purchase a $300 patio furniture set before the first purchase clears.
Satoshi Nakamoto, the enigmatic inventor of Bitcoin, wanted to set up a digital currency which would not be controlled by or dependent on any central institution. Rather, there would be a big network of thousands of independent computing nodes, which collectively would record and vet financial transactions. A big problem he faced was how to prevent the sort of double-spending described above. With a decentralized system, it was possible that one node, or a couple of nodes in cahoots, could quickly enter two transactions which would spend the same chunk of digital currency twice, before the rest of the nodes could catch the error. And without a central authority, who would have the authority to correct such errors?
Nakamoto’s solution was the blockchain. He defined and implemented it specifically for Bitcoin, but the concept is so elegant and powerful that hundreds of other digital coins were quickly set up also using blockchains. This in turn has spawned a whole multi-billion dollar “decentralized finance” industry around these blockchain based currencies.
So how does this work? The key concept is that each new set of transactional data (i.e. individual Bitcoin exchanges between parties) is bundled together and entered as part of a “block”; there is then a specific protocol for getting that block approved as part of the “official” history of transactions. The protocol makes it nearly impossible for anyone to go back and tamper with a block which has been approved.
A simplified schematic of the Bitcoin blockchain is shown below. The concept of “hashing” is important to understand what is happening. A hashing function maps one string of numbers or characters into another string of numbers (the “hash”) in a special way. (If you are not familiar with the concept of hashing, see last week’s post on this topic). In this figure, all the transactional data is condensed and represented as a single number, here shown as “Tx_Root”.
If Block 10 is the previous block in the blockchain, then the new, proposed Block 11 contains this Tx_Root, and several other numbers. The numbers shown here include a timestamp to establish the creation date/time for this block, the “hash” of all the numbers in the previous block, and a number called the “nonce”. (It’s not important for this level of discussion, but see here for a figure showing a complete list of all the numbers that go into a block).
Bitcoin “miners” operate on many nodes of the Bitcoin network. They do the work of entering transactions into blocks, and are rewarded for their work by getting assigned bits of Bitcoin for getting a block entered. The system deliberately makes it costly (in terms of computational hardware and time, and electricity to run those computers) to get a block approved. The “work” a miner must do is to try trillions of values of the nonce until a certain criterion is met. (This criterion is that the hash of the whole block is below a certain value, as discussed last week). This costly “proof of work” ensures that malicious actors cannot cheaply insert spurious blocks into the chain.
Let’s say that some miner has done all this work, and added Block 11 to be the latest block in the chain. How does the rest of the network signal approval of its validity? There is no central authority to conduct a fair poll. Rather, the other nodes approve a new block by provisionally accepting it (after checking that it meets the minimum hash criterion), and then adding the next “mined” block (e.g. Block 12) to be the next block in the chain. Because of the cost of mining a block, a mining node is motivated to only add a new block onto a legitimate previous block. This system incentivizes honesty.
One more feature that ensures data integrity is that a hash of the previous block (e.g. Block 10) is included among the numbers in Block 11. A functional impact of this is that if someone tried to sneak in and change some number in some previous block, say eight blocks back, the whole system would immediately know, because that change would ripple forward in changes in the chain of hashes from one block to another.
With this system, it is possible for two miners to add two different blocks to the end of the existing chain at about the same time. This generates a temporary (“soft”) fork in the chain. Other miners can choose to add onto one fork or the other. The rules of the system is that the longest chain (pre-fork chain plus whatever blocks have been added to either fork) is the one considered to be the real, valid chain. It is a waste of mining effort to compute a block and add it onto a fork which will end up being a dud, so the miners are incentivized to quickly settle on one out of the two forks. The blocks on other, shorter fork, are essentially ignored, and no Bitcoin is awarded to those miners. Whatever Bitcoin transactions were in those discarded blocks can be then incorporated in some new blocks.
Because of the possibility of a temporary soft fork, a given transaction is not considered firmly confirmed until another couple of blocks have been built on top of it. Each block takes about ten minutes to be mined and added. The usual standard is to wait until there are six blocks total (the one with your transaction, plus five more added) for a Bitcoin transaction to be fully confirmed, which can take an hour or more. This slow confirmation limits the practical number of transactions with Bitcoin; other blockchain currencies typically adopt different protocols to enable faster transactions.
The whole blockchain is always available to everyone, in real time. This is part of the policy of having no central authority or database. Bitcoin is protected from hacking, not by hiding information, but by displaying all in public. Also, with thousands of independent computing nodes, there is no single point of vulnerability. If you have a lot of disk space and a lot of time, you can download the whole thing onto your PC, from https://bitcoin.org/en/download .
So there it is, a self-regulating decentralized system for logging financial transactions. Wikipedia describes it as:
A blockchain is a decentralized, distributed, and oftentimes public, digital ledger consisting of records called blocks that is used to record transactions across many computers so that any involved block cannot be altered retroactively, without the alteration of all subsequent blocks. This allows the participants to verify and audit transactions independently and relatively inexpensively. A blockchain database is managed autonomously using a peer-to-peer network and a distributed timestamping server. They are authenticated by mass collaboration powered by collective self-interests.
Besides enabling Bitcoin itself (which, as we noted, has a value about as large as the whole economy of Sweden or Taiwan), the blockchain concept has set off a revolution in the broader realm of finance. All this sprang from the mind of Satoshi Nakamoto. He wrote a white paper describing the concept, then wrote the code to implement it, and then actually ran a computer node to grind away and mine Bitcoins back when they were not worth anything. Nakamoto has elected to stay anonymous, so he has missed out being called onto platforms to receive honors for his accomplishment. Hopefully he contents himself by contemplating his stash of Bitcoin, which at today’s value is worth about 45 billion dollars.
One thought on “Cryptocurrencies 3. Blockchain: The Ingenious Basis of Bitcoin”