Sunday, November 5, 2017

Basic guide to bitcoin cash


 What is Bitcoin Cash? A Basic Beginners Guide

In this guide, we are going to be telling you about all the incidents that have led up to the creation of Bitcoin Cash. This is purely for educational purposes.
Bitcoin is, without a doubt, one of the most incredible innovations in the recent past. However, it has also come under a lot of criticism for its scalability issues which has given rise to a lot of debates which are politically as well as ideologically motivated. Finally, on August 1, 2017, bitcoin went through a hard fork which gave birth to Bitcoin Cash. We are not going to be telling you which side is right and which side is wrong, that is totally up to you.

How do bitcoin transactions work?

Bitcoin was introduced by an unknown man/woman/group going by the pseudonym, Satoshi Nakamoto in their, now legendary, research paper “Bitcoin: A Peer-to-Peer Electronic Cash System”. What bitcoin provided was a peer-to-peer decentralized, digital currency system. The entire system of bitcoin functions due to the work was done by a group of people called “miners”.

So what do these miners do? The two biggest activities that they do are:
  • Mining for blocks.
  • Adding transactions to the blocks.

Mining for blocks
All the miners use their computing power to look for new blocks to add to the blockchain. The process follows the “proof of work” protocol and once a new block has been discovered, the miners responsible for the discovery get a reward, currently set at 12.5 bitcoins (it is halved after every 210,000 blocks), however, this isn’t the only incentive that the miners have.

Adding transactions to the blocks
When a group of miners discovers and mine a new a new block, they become temporary dictators of that block. Suppose Alice has to send 5 bitcoins to Bob, she isn’t physically sending him any money, the miners have to actually add this transaction to the blocks in the chain and only then is this transaction deemed complete. In order to add these transactions to the blocks, the miners can charge a fee. If you want your transaction to be added quickly to these blocks, then you can give the miners a higher fee to “cut in line” so to speak.

For a transaction to be valid, it must be added to a block in the chain. However, this is when a problem arises, a block in the chain has a size limit of 1 MB and there are only so many transactions that can go at once. This was manageable before, but then something happened which made this a huge problem, bitcoin became famous!

The bitcoin scalability problem aka does size matter?


Yes, Bitcoin became popular and with that came its own series of problems.

In this graph you can see the number of transactions happening per month:What is Bitcoin Cash? A Basic Beginners Guide
Image source: Wikipedia

As you can see, the number of monthly transactions is only increasing and with the current 1mb block size limit, bitcoin can only handle 4.4 transactions per second. When Bitcoin was first created, the developers put the 1mb size limit by design because they wanted to cut down on the spam transactions which may clog up the entire Bitcoin network.

However, as the number of transactions increased by leaps and bounds, the rate at which the blocks filled up were increasing as well. More often than not, people actually had to wait till new blocks were created so that their transactions would go through. This created a backlog of transactions, in fact, the only way to get your transactions prioritized is to pay a high enough transaction fee to attract and incentivize the miners to prioritize your transactions.

This introduced the “replace-by-fee” system. Basically, this is how it works. Suppose Alice is sending 5 bitcoins to Bob, but the transaction is not going through because of a backlog. She can’t “delete” the transaction because bitcoins once spent can never come back. However, she can do another transaction of 5 bitcoins with Bob but this time with transaction fees which are high enough to incentivize the miners. As the miners put her transaction in the block, it will also overwrite the previous transaction and make it null and void.

While the “replace-by-fee” system is profitable for the miners, it is pretty inconvenient for users who may not be that well to do. In fact, here is a graph of the waiting time that a user will have to go through if they paid the minimum possible transaction fees:
What is Bitcoin Cash? A Basic Beginners Guide
Image courtesy: Business Insider.

If you pay the lowest possible transaction fees, then you will have to wait for a median time of 13 mins for your transaction to go through.
To repair this inconvenience, it was suggested that the block size should be increased from 1mb to 2mb. As simple as that suggestion sounds, it is not that easy to implement, and this has given rise to numerous debates and conflicts with team 1mb and team 2mb ready to go at each other with pitchforks. As already mentioned, we want to take a neutral stance in this whole debate and we would like to present the arguments made by both sides.

Arguments against block size increase

  • Miners will lose incentive because transaction fees will decrease: Since the block sizes will increase transactions will be easily inserted, which will significantly lower the transaction fees. There are fears that this may disincentivize the miners and they may move on to greener pastures. If the number of miners decreases then this will decrease the overall hashrate of bitcoin.

  • Bitcoins shouldn’t be used for everyday purposes: Some members of the community don’t want bitcoin to be used for regular everyday transactions. These people feel that bitcoins have a higher purpose than just being regular everyday currency.

  • It will split the community: A block size increase will inevitably cause a fork in the system which will make two parallel bitcoins and hence split the community in the process. This may destroy the harmony in the community.

  • It will cause increased centralization: Since the network size will increase, the amount of processing power required to mine will increase as well. This will take out all the small mining pools and give mining powers exclusively to the large scale pools. This will in turn increase centralization which goes against the very essence of bitcoins.

Arguments for the block size increase

  • Block size increase actually works to the miner’s benefit: Increased block size will mean increase transactions per block which will, in turn, increase a number of transaction fees that a miner may make from mining a block.

  • Bitcoin needs to grow more and be more accessible for the “common man”. If the block size doesn’t change then there is a very real possibility that the transactions fees will go higher and higher. When that happens, the common man will never be able to use it and it will be used exclusively only by the rich and big corporations. That has never been the purpose of bitcoin.

  • The changes won’t happen all at once, they will gradually happen over time. The biggest fear that people have when it comes to the block size change is that too many things are going to be affected at the same time and that will cause major disruption. However, people who are “pro block size increase” think that that’s an unfounded fear as most of the changes will be dealt with over a period of time.

  • There is a lot of support for block size increase already and people who don’t get with the times may get left behind.

In order to solve the scalability issues there were two suggestions made:

Before we go into any of them, however, let’s understand the fundamental difference between a soft fork and a hard fork. A fork is a condition whereby the state of the blockchain diverges into chains were a part of the network has a different perspective on the history of transactions than a different part of the network. That is basically what a fork is, it is a divergence in the perspective of the state of the blockchain.

What Is A Soft Fork?

Whenever a chain needs to be updated there are two ways of doing that: a soft fork or a hard fork. Think of soft fork as an update in the software which is backwards compatible. What does that mean? Suppose you are running MS Excel 2005 in your laptop and you want to open a spreadsheet built in MS Excel 2015, you can still open it because MS Excel 2015 is backwards compatible.

BUT, having said that there is a difference. All the updates that you can enjoy in the newer version won’t be visible to you in the older version. Going back to our MS excel analogy again, suppose there is a feature which allows to put in GIFs in the spreadsheet in the 2015 version, you won’t see those GIFs in the 2005 version. So basically, you will see all text but won’t see the GIF.

What Is A Hard Fork?

The primary difference between a soft fork and hardfork is that it is not backward compatible. Once it is utilized there is absolutely no going back whatsoever. If you do not join the upgraded version of the blockchain then you do not get access to any of the new updates or interact with users of the new system whatsoever. Think PlayStation 3 and PlayStation 4. You can’t play PS3 games on PS4 and you can’t play PS4 games on PS3.
What is Bitcoin Cash? A Basic Beginners Guide

Andreas Antonopoulos describes the difference between hard and soft fork like this:
If a vegetarian restaurant would choose to add pork to their menu it would be considered to be a hard fork. if they would decide to add vegan dishes, everyone who is vegetarian could still eat vegan, you don’t have to be vegan to eat there, you could still be vegetarian to eat there and meat eaters could eat there too so that’s a soft fork.

However, for any major changes to happen in bitcoin, the system needs to come to a consensus. So, how does a decentralized economy come to an agreement on anything?
Right now the two biggest ways that are achieved are:
  • Miner Activated: Basically changes that are voted on by miners.
  • User Activated.: Changes that are voted on by people with active nodes.

Before we go on any further, we need to understand what Segwit is.

What is segwit?

We won’t go very deep into what segwit is but, in order to get why bitcoin cash came about, it is important to have an idea of what it is. Just to reiterate what we have mentioned before, we won’t be taking any side in this debate, we will simply be educating you about it.

When you closely examine a block, this is what it looks like:
What is Bitcoin Cash? A Basic Beginners Guide
There is the block header of course which has 6 elements in it, namely:
  • Version.
  • Previous block hash.
  • Transaction Merkle roots.
  • Epoch time stamp.
  • Difficulty target.
  • Nonce.
And along with the block header, there is the body, and the body is full of transactions details.
So, what does a bitcoin transaction consist of? Any transaction consists of 3 elements:
  • The sender details which is the input.
  • The receiver details i.e. the output.
  • The digital signature.

The digital signature is extremely important because it is what verifies whether the sender actually has the required amount of funds needed to get the transaction done or not. As you can see in the diagram above, it is part of the input data.  Now, while this is all very important data there is a big big problem with it. It takes up way too much space. Space that already is in limited availability thanks to the 1 MB block size. In fact, the signature accounts for nearly 65% of the space taken by a transaction!

Dr. Peter Wuille has come up with a solution for this, he calls it Segregated Witness aka Segwit.
This is what will happen once segwit is activated, all the sender and receiver details will go inside the main block, however, the signatures will go into a new block called the “Extended Block”.
What is Bitcoin Cash? A Basic Beginners Guide

So what this will do is that it will create more space in the blocks for more transactions. Now that you have a very basic understanding of what segwit is, let’s check out its pros and cons.

What are the pros and cons of segwit?


Pros of segwit:
  • Increases a number of transactions that a block can take.
  • Decreases transaction fees.
  • Reduces the size of each individual transaction.
  • Transactions can now be confirmed faster because the waiting time will decrease.
  • Helps in the scalability of bitcoin.
  • Since the number of transactions in each block will increase, it may increase the total overall fees that a miner may collect.

Cons of segwit:
  • Miners will now get lesser transaction fees for each individual transaction.
  • The implementation is complex and all the wallets will need to implement segwit themselves. There is a big chance that they may not get it right the first time.
  • It will significantly increase the usage of resources since the capacity, transactions, bandwidth everything will increase.

When the developers built SegWit they added a special clause to it. It can only be activated when it has 95% approval from the miners. After all, it is a huge change in the system and they figured that getting a super majority was the way to go. However, this caused a disruption in the system. Most miners don’t want segwit to be activated. They are afraid that since the available block space will increase, it will drastically reduce the transaction fees that they can get. As a result, they stalled segwit which in turn infuriated the users and businesses who desperately want segwit to be activated.

Eventually, they came up with the idea of a UASF aka User Activated Soft Fork called BIP 148.

What is a BIP?

BIPs or Bitcoin Improvement Proposals is a design document which introduces various designs and improvements to the bitcoin network. There are three kinds of BIPs:

  • Standards Track BIPs: Changes to the network protocol, transaction, and blocks.
  • Informational BIPs: Dealing with design issues and general guidelines.
  • Process BIPs: Changes to the process.

So what is BIP 148?


The BIP 148 is a user activated soft fork i.e. a soft fork that has been activated by the users. What it states is that all the full nodes in the bitcoin networks will reject any and all blocks that are being created without segwit ingrained in it. The idea is to motivate the miners to put segwit activation in the blocks that they mine for it to be part of the system.

It is hoped that by encouraging more and more miners to come over to the BIP 148 side, eventually the 95% threshold limit will be crossed and segwit will be activated. There are legit fears of a chain split happening but that can be easily avoided if just 51% of the miners come over to the BIP 148 side. Have more than half of the miners to the other side will greatly reduce the hash rate of the legacy chain i.e. the original chain.

Going by the coordination game-theory, the miners will be compelled to come over to the other side with the majority. This however raised a serious concern. What if the change over doesn’t happen smoothly and what if it does cause a legitimate chain split? This could spell disaster and this is the exact issue raised by the mining company Bitmain. So, as a contingency plan for BIP 148, Bitmain proposed a UAHF aka User Activated Hard Fork.

What is the UAHF?


The User Activated Hard Fork is a proposal by Bitmain which will enable the construction of a whole new form of bitcoin and blocks with larger sizes. Since this is a hard fork, the chain will not be backwards compatible with the rest of the bitcoin blockchain. The biggest reason why this looks so appealing is that the hard fork does not require a majority of hashpower to be enforced. All nodes who accept these rule set changes will automatically follow this blockchain regardless of the support it gets. At the same time, many people just weren’t happy with the idea of signatures being kept separate from the rest of the transaction data, they considered it to be a hack.

Bitmain visualizes this as a voluntary escape for everyone who is not interested in following up with the BIP 148 proposal. If you don’t like it then jump ship and you can be a part of this new chain. At the “Future of Bitcoin” conference a developer named Amaury Séchet revealed the Bitcoin ABC (Adjustable Blocksize Cap) project and announced the upcoming hardfork. Following the announcement, and after Bitcoin ABC’s first client release, the project “Bitcoin Cash” (BCC) was announced which came into full effect on August 1.

What is Bitcoin Cash?


This is how Bitcoin Cash project website is defining itself: “Bitcoin Cash is peer-to-peer electronic cash for the Internet. It is fully decentralized, with no central bank and requires no trusted third parties to operate.” Did you notice the emphasis on the words “peer-to-peer electronic cash”? It is done by design because the primary motivation of bitcoin cash’s existence depends solely on carrying out more transactions as Jimmy Song points out in his Medium article.
What is Bitcoin Cash? A Basic Beginners Guide
Bitcoin Cash (BCH) is a lot like Bitcoin but has some very noticeable differences:

  • The blocksize is 8 MB.
  • It won’t have segwit.
  • It won’t have the “replace by fee” feature.
  • It will have replay and wipeout protection.
  • It offers a way to adjust the proof-of-work difficulty quicker than the normal 2016 block difficulty adjustment interval found in Bitcoin.

Since BCH is a result of a hardfork, anyone who possessed BTC got the equal amount of coins in BCH PROVIDED they didn’t have their BTC in exchanges and were in possession of their private keys at the time of the hardfork. So now let’s go through certain interesting features of Bitcoin Cash.

How Bitcoin Cash prevents replay attacks?


One of the best features of Bitcoin Cash is how it circumnavigates one of the biggest problems that any cryptocurrencycan face post-forking, the replay attack.

What is a replay attack?


A replay attack is data transmission that is maliciously repeated or delayed. In the context of a blockchain, it is taking a transaction that happens in one blockchain and maliciously repeating it in another blockchain. Eg. Alice is sending 5 BTC to Bob, under a replay attack she will send him 5 BCH as well, even though she never meant to do that.

So, how does Bitcoin cash prevent replay attacks? (data are taken from Andre Chow’s answer in stack exchange)

  • Using a redefined sighash algorithm. This sighash algorithm is only used when the sighash flag has bit 6 set. These transactions would be invalid on the non-UAHF chain as the different sighashing algorithm will result in invalid transactions.

  • Using OP_RETURN output which has the string “Bitcoin: A Peer-to-Peer Electronic Cash System” as data. Any transaction which contains this string will be considered invalid by bitcoin cash nodes until the 530,000th block.  Basically, before that block you can split your coins by transacting on the non-UAHF chain first with the OP_RETURN output, and then transacting on the UAHF chain second.

How does Bitcoin Cash attract miners?


Any cryptocurrency depends heavily on its miners to run smoothly. Lately, bitcoin cash has attracted a lot of miners which has significantly improved its hash rate. Here is how they did that. For this, we will take the brilliant Jimmy Song’s help again.

Bitcoin cash has a set rule as to when it decreases its difficulty. Before we see the rule it is important to understand what Median Time Past (MTP) is. It is the median of the last 11 blocks that have been mined in a blockchain.  Basically, line up the last 11 blocks one after another and the time at which the middle block is mined is the median time past of the set. The MTP helps us determine the time at which future blocks can be mined as well. Here is a chart of the MTP of various blocks:
What is Bitcoin Cash? A Basic Beginners Guide

Image courtesy: Jimmy Song Medium article.

So, this is the rule for difficulty adjustment in bitcoin cash: If the Median Time Past of the current block and the Median Time Past of 6 blocks before is greater than 12 hours then the difficulty reduces by 20% i.e. it becomes 20% easier for miners to find newer blocks. This gives the miners some power to adjust difficulty, eg. checkout the 13-hour gap between blocks 478570 and 478571. The miners may have simply been doing this to make the blocks easier to mine.

Another interesting thing to note is how and when the difficulty rate can adjust in a cryptocurrency. This is a graph which tracks the difficulty rate of BCH:
What is Bitcoin Cash? A Basic Beginners Guide
Image courtesy: Bitinfocharts.com

The difficulty rate adjusts according to a number of miners in the system. If there are fewer miners, then the difficulty rate goes down because the overall hashing power of the system goes down. When bitcoin cash first started it was struggling a bit to get miners, as a result, its difficulty dropped down drastically. This, in turn, attracted a lot of miners who found the opportunity to be very lucrative. This caused an exodus of miners from BTC so much so that the hashing power of BTC halved, decreasing the transaction time and increasing the fees. Reports on social media stated that BTC transaction was taking hours and even days to complete.
Here is the graph that shows the drop in hash rate of BTC:
What is Bitcoin Cash? A Basic Beginners Guide
Image courtesy: Investopedia

The value of Bitcoin Cash

As of writing, BCH is the second most expensive cryptocurrency in the world behind BTC at $573.35 per BCH with a market cap of $9.4 billion (which is the third highest behind BTC and ETH). Its value once surged over $700. You can checkout the graph below for more details:
What is Bitcoin Cash? A Basic Beginners Guide

Image Courtesy: Coin Market Cap.

So what is the driving force behind the value of bitcoin cash?


Reason #1:
More and more exchanges are agreeing to take up bitcoin cash. When it first started most exchanges were reluctant to take up BCH, but now more and more exchanges are accepting it. This, in turn, gives it credibility which increases its value.
The following are the wallets and exchanges which are supporting BCH:
What is Bitcoin Cash? A Basic Beginners Guide
Image courtesy: Coinsutra

Reason #2:
More and more miners are coming into it. As explained above, BCH currently is very lucrative for miners and many of them are coming in and giving their hashing power which in turn increases its value. At the same time, since the block size is 8 MB as well, it will enable more transactions within the block which will generate more transaction fees for the miners.

What is the future of Bitcoin Cash?


In short, we don’t know. We have no idea how bitcoin cash is going to turn out in the future nor do we know the long term repercussions that it will have on BTC. What we do know is that this is the first time that anyone has successfully hardforked from BTC whilst keeping the records of the existing transactions. What we have here is a very interesting experiment which will teach us a lot of lessons moving forward. At the same time, the 8 mb block size is definitely a very alluring aspect and it remains to be seen how this affects the miners in the long run. Can this really address all the scalability issues? Can BCH ever overtake BTC and become the primary chain? All these questions are mere speculations for now. What we can say for sure is that we have a very interesting future ahead.

No comments:

Post a Comment