...by Daniel Szego
quote
"Simplicity is the ultimate sophistication."
Leonardo da Vinci

Tuesday, August 8, 2017

Forks in Blockchains, forks in cryptocurrencies

Introduction

Last week, we encountered one of the most important and surprising events of Bitcoin's cryptocurrency: The currency was hard-forked, meaning it was finally separated into two different competing crytopocurrency, Bitcoin Cash was born out of Bitcoin. In the following article we briefly summarize what exactly means if a Blockchain system is forking and what are the consequences in a short and long term.

Forks in a Blockchain

From a technical point of view a Blockchain based system has got two important building blocks: the P2P network, containing a huge amount of independent nodes and the distributed ledger itself in which e summarize the valid transactions of the system in blocks (Picture 1). One important feature of the system is that the nodes independently store the entire block chain and each block is chained together by a special cryptographic pointer (u.n hash pointer). One of the most important elements of the algorithm is the decentralized consensus, which is a mechanism for summing up new transactions into a block and attaching this block into the chain. There are several algorithms for consensus, but perhaps the most important is the so called Proof of Work where some special mining nodes solve an algorithmically difficult cryptographic puzzle. The node that first solves the puzzle and attaches  the new block into the chain takes a reward for it.


Picture 1, Standard forks in a Blockchain

Given that nodes are geographically distributed across the globe, there may be two separate independent blocks in the network that solves the puzzle and attached a new block, for example, a miners in China will pick "Block 4" and a miners in Canada will use the "Blokk 4 * ", so the nodes in Canada consider another Blockchain valid than the nodes in China (Picture 1). This situation is called the Blockchain fork. It is important to note that it is normal to have such a forks only on short-term, because an important property of consensus algorithm, that always the most longest Blockchain should be considered as a valid Blockchain. If, for example, Chinese miners find a "Block 5" Five and spread over the network, Canadian nodes will automatically detect that the longest chain is "Block 4" - "Block 5" and it will be considered as a valid one. "Block 4 *" will be ineffective (Orphaned Blocks) and the transactions in it will be processed in a new block based on "Block 5".

Although it may seem a bit odd for the first run that forking occurs in the Blockchain during normal operation, however they rarely take long and rarely longer than one or two blocks. In order to create a a forking situation, mining nodes in two different parts of the world needs to find a valid block roughly at the same time. In order for a fork to survive, it is necessary to find the next blocks "Blocks 5" and "Blocks 5" at roughly again at the same time. With the number of blocks, this chance decreases exponentially; the probability that a 6 long fork  is created microscopically small. That is the reason for example that as a rule of thumb one has to wait 6 validations for a Bitcoin transaction, meaning that the transaction is part of a block that has already been  followed by 5 further mined blocks, so the chance of forking is minimal.

Hard fork versus soft fork

Certainly, the situation can be more complicated. The problem is that the software on each node is not static one but it is constantly being developed. New versions and updates of software often affect what we consider to be valid transactions or valid blocks. In addition, since it is a massively distributed public network, each node operator can freely decide whether or not to run the new version of the software. If half of the nodes work with an old software and consider the transactions as valid under the old rules, whilst the other half already take the new rules into account, it can cause long running forks in the Blockchain (Picture 2).


Picture 2, forks at software update

Practically speaking, there are two kinds of different forks. At the so called soft-fork, the new software is compatible with the old one in a sense that the new software only narrows the range of possible valid transactions or blocks. With other words, if an updated node finds a transaction or block valid, than the old nodes will find it valid as well. For soft-forks, if the updated software is running for most of the nodes, only short-term forks will be created in the block chain. On the contrary, at hard-fork  the new software is not compatible with the old one (Picture 2). If not all of the nodes are updated to the new software version, it causes that the Blockchain will eventually branch out into two competing ones: old nodes will build blocks with old rules and only these blocks will be stored, new nodes will count with the new rules and only blocks are stored that are validated by them. Virtually the system is split into two parallel subsystems.

Picture 3, soft fork versus hard fork

Value of a cryptocurrency

Of course, it is an interesting question is how good or bad is when a block chain-based system finally forks. The value of most cryptocurrency and Blockchain based services are relative complex concept that depends on the following major independent actors and groups:

- Developers: The more developers support the system, the faster you can implement new services, fixing existing errors and more.
- Operators - Miners: The more independent nodes are in the world, the more robust and stable the whole system works. The more miners working with more sophisticated tools the harder it is to break the system.
- Traders: Traders have the interest of a more stable and reliable operation and that a huge amount of users can buy with the given cryptocurrency.
- Customers: For them the major motivation is to have the possibility to buy as many shops as possible and that the  the whole system operates smoothly.
- Investors and Speculators: This category usually uses the given cryptocurrency only to realize short or long-term profit on exchange rate changes.

Generally speaking the more stakeholder or the bigger community is to be found the more stable is the system and basically it the interest of almost everyone that the system behaves stable.    Overall, it is overall interest that the more people use the system and the more stable it runs, so a hard-core is fundamentally no long-term advantage, but finding a common solution with such a large number of independent actors is relatively difficult. In addition, it is worth mentioning that if a block chain system hard-fork-ol then existing cryptovaluta can be used in both new systems, of course another question is what happens to the exchange rates after block chain branching.

Bitcoin fork: Bitcoin and Bitcoin Cash

The Bitcoin protocol has long been suffering from a pretty serious scalability problem: the 10-minute block validation time and 1 MB block sizes allow the entire network to handle approximately 7 transactions per second, compared to Visa with the few thousands or even PayPal's hundreds of transactions per second. There have been a number of technical solutions to solve the problem that usually work with increasing block size, however these software updates risks a hard-forks. As mentioned above, hard-fork can be avoided if all participants agree hundred percent and all operators and miners will install the new software version roughly at the same time.

To avoid this risk for a hard fork, an alternative possibility has been proposed that is backwards compatible and might make only a soft-fork. it operates with a special extra block complementing the original blocks of the chain (SegWit), so the transaction number per second can be doubled. In the Bitcoin community, a long-term discussion was carried out which version is more practical: the main criticism of the SegWit system argued that this is just a temporary solution that needs to be upgraded on a long run. The debate escalated on August 1 as a group of operators miners and programmers rolled out a version that uses an 8 MB block size and that is incompatible with the old software version. This caused a permanent fork in the Bitcoin Blockchain and a new cryptocurrency called the Bitcoin Cash was borne. At the end of the hard-fork, nodes and miners who updated their software processed the blocks and transactions of the new Bitcoin Cash system, operators and miners running the old version stayed with the old system. 

Of course, it is an interesting question what happens on a long run with Bitcoin Cash. It is important to note that community support for the new cryptocurrency is pretty low even if it is technically more advanced than the classic Bitcoin. With other words, only a small number of operators support the new system and fewer customers and merchants are available. As a consequence, the chance that a stable and long-running cryptocurrency has been borne seems to be little at the moment.