Friday, May 15, 2015

Why Bitcoin is a superior settlement system. Bitcoin and the CAP theorem.

    Bitcoin, despite being commonly referred to as a payment network is not. It is actually a settlement network that will allow for superior payment networks to be built on top of it. Jeff Garzik's tweet on this subject was particularly succinct: https://twitter.com/jgarzik/status/595606257936957440. So, now that we know what to compare Bitcoin to (other settlement mechanisms), one might wonder why Bitcoin is superior? I will argue that the answer lies in the CAP theorem: http://en.wikipedia.org/wiki/CAP_theorem.
    The CAP theorem states that a distributed database cannot be simultaneously: consistent, available, and partition tolerant. Since all systems (including traditional banking settlement systems and Bitcoin) must accept partitions due to both network related partitions and in the past even partitions due to time delays in settling between bank branches which might have been done overnight, a settlement system must make a design decision about whether it wants to prioritize consistency or availability. The traditional banking system has chosen availability and Bitcoin chose consistency. I will explain the consequences of those design decisions in this blog.
    To further expand on how traditional banking chose availability and Bitcoin chose consistency, we have to look at what happens when there is a partition. In the traditional banking system, individual banks are actually setup in a sort of permanent partition mode. This is probably for historical reasons due to the fact that in the past you would actually need to physically hand messages from one bank to another to determine state. They use what's known as fractional reserve banking, so they can create up to a certain amount of money at any given time as long as they meet certain reserve requirements. See http://en.wikipedia.org/wiki/Fractional-reserve_banking. When you go into a bank to request a car loan, the bank can actually loan you money that it doesn't have. This leads to the problem that occurs when many people want to make a withdrawal at the same time, you have a possibility that the bank may become insolvent. This led to the need for a central bank who has the ability to create unlimited money who could always loan a troubled bank money to fix the problems. The central bank also operates as the settlement network between banks because it can guarantee that when bank A sends money to bank B, the payment will always go through and is guaranteed by the central bank who can create money at will. Today there is a settlement network called Fedwire that facilitates these types of transactions. Other countries have similar systems. This system assumes permanent long term partitions and favors availability over consistency. What I mean by that is that you can always get a loan at bank (availability), but the money supply is highly inconsistent and actually cannot be known by any one person in real time because it depends on the up to the minute activities of each bank.
    Bitcoin, on the other hand, chooses consistency over availability. To just briefly describe how the Bitcoin network confirms transactions, there is a competition among all nodes on the network to solve a proof of work puzzle that includes all transactions that are to be confirmed. See the Bitcoin white paper for full details: https://bitcoin.org/bitcoin.pdf. If the Bitcoin network is partitioned (lets just say you can only connect to one node), your transaction cannot be committed to the network. So the Bitcoin network very clearly chooses consistency over availability. While some might argue that you can have competing blocks of which one or more will be orphaned, that's actually a slightly different scenario than what I'm describing because if you have connectivity to the entire network and you are not attempting a double spend, your transaction should be included in both of the competing chains.
    So, what are the consequences of this design decision you ask? First, there is a consistently known state of the Bitcoin money supply at any given point in time. Anyone can easily look at websites that display information about the network to determine how many bitcoins are in circulation. Also, we do not need to create a lender of last resort because members of the Bitcoin network can settle debts directly.
    The next question is: what trade-offs do we make by giving up availability? It turns out very few because of the way the system was designed and some things that can be implemented in the layer above the Bitcoin system. Since Bitcoin is implemented on the internet, network partitions fairly rare. They definitely happen, but the visa network and other payment networks already depend on the internet with acceptable results. In Bitcoin, blocks are solved on average every 10 minutes, so there is the question of how you can get instant payments. This again is a result of Bitcoin's insistence on consistency over availability. However, there are some possible solutions to this problem that are being implemented in the layers above the Bitcoin protocol. For instance, the lightning network https://lightning.network/ uses something called payment channels which allow you to settle instantly. There is also something called green address (https://greenaddress.it/en/) which allows you to add a trusted third party needs to be trusted to track double spends and ensure they don't occur. This is another way to prevent double spends.
    So, to summarize: Bitcoin chooses consistency over availability while the traditional banking system choose the opposite prioritization. This results in a system more suited to modern technology. Layers above the Bitcoin settlement network will be able to resolve all currently perceived problems.