SegWit, Big Blocks and Lightning Network – scaling Bitcoin

The controversy about the future and control of Bitcoin has sent the price of the cryptocurrency all over the place. From US$1,200 down to $880 and now settling around $1,160 at the time of writing in just a week. Consensus is that this has come about due to the emergence of two camps – one called SegWit (the programmers) and the other, Bitcoin Unlimited’s Big Blocks (Chinese bitcoin miners).

Both would at a glance seem to solve the same problem – a capacity crunch, the first by removing some information (the witness) from the blockchain (hence the name Segregated Witness or SegWit for short) and the other by simply doubling the size of the blocks. It is a simplification that non-geek investors seem to understand well but it is far from representative of what the two offer. Big Blocks offer more of the same. SegWit offers a bit more but at the same time opens up a whole new world of smart contracts that is currently impossible with Bitcoin.

Bear with me.

First off, let is look at the problem. Bitcoin was designed to be a decentralised form of e-money. In order to achieve this, it uses what is called the blockchain to encode each and every transaction that has ever happened. These blocks are copied (in the early days) to every single user of Bitcoin so they know exactly which address owns which bitcoin. These days with the blockchain being over 10GB, most people just use lite wallets instead of the full blockchain and depend on other volunteers to look up the full blockchain.

Updating the blockchain is done by mining. Mining is more like a super accountant that can solve really complex mathematical puzzles rather than actually mining for gold. A checksum of the previous block, all current transactions and a random number is put through a complex one-way algorithm. If the result of that mathematical calculation is lower than a certain target it is considered valid, if not the miners just try and try and try again.

Once a block is mined with a difficulty level more than the target then it is broadcast to everyone else in the network who verifies it against the consensus rules and if they agree, broadcast it further. The miner gets a reward in newly created Bitcoins. The target auto adjusts about every two weeks so that the time between blocks is approximately 10 minutes. If more miners compete then the difficulty gets harder and the mining becomes more difficult. If fewer miners compete then the difficulty readjusts so it is easier to maintain the 10-minute gap.

Now from the beginning of Bitcoin up until not too long ago, the blocksize was not a problem. Every transaction would get mined into the blockchain.

The way it is currently designed (and by over-simplifying things) the Bitcoin network can support around 7 transactions per second. A basic bitcoin transaction is 250 bytes in size. So what happens is that users needed to compete via miner fees for their transactions to be processed first. In 2013 mining fees were still negligible but today they have risen considerably and now stand at just under 50 cents per transaction. Paying less will mean that the transaction is delayed or worse, never mined and lost.

They say that at 50 cents per transaction, you can no longer buy coffee with Bitcoin. But should Bitcoin even compete with Visa and MasterCard? Or should it compete with international payments via the SEPA or SWIFT networks? 50 cents is a lot on a $2 cup of Starbucks, but is nothing compared to the $35+ cost of sending a payment from Hong Kong to the UK.

Both sides agree that at this stage Bitcoin is still in its infancy and still needs wider adoption so the fees must be made cheaper for the user – but how this will happen is where the two differ.

One way of increasing capacity is by increasing the size of the blocks from 1 MB to 2 MB. This would double the capacity of the network. For many years there have been groups arguing for big blocks. Bitcoin Classic and Bitcoin XT have come and gone with little adoption. Today we have Bitcoin Unlimited and the difference is that this time they have the might of some of the Chinese miners behind them and since they are the ones creating the blocks and securing the network, they could do pretty much whatever they want and kill any remnants who stick to the original Bitcoin. Or so they think.

The other way of increasing capacity that is being discussed is SegWit or by removing part of the transaction – the witness – from the data encoded in the blockchain and only keeping the actual transactions. Doing this increases capacity by around 70% without actually increasing the blocksize.

Big blocks would require a clean break – a hard fork – with the old system and break compatibility with existing Bitcoin wallets. SegWit would work fine with old wallets as long as they do not use the new SegWit addresses, making it a much more elegant solution.

More importantly SegWit fixes a bug in Bitcoin – the transaction malleability bug. If we think of bitcoin transactions like a cheque, the transaction malleability bug is akin to being able to change the cheque number but not the payee or the amount. That means it is not a big deal and money cannot be stolen with it (unless you are MtGox). But the uncertainty of transaction IDs mean that smart contracts simply cannot work reliably, and that, finally, is what this is all about.

This is crucial as there are many new technologies waiting in the wings that cannot function without the transaction malleability bug fixed first. Chief of which is Bitcoin Lightning Network which turns Bitcoin into a settlement layer taking the day to day transactions off the blockchain.

In Lightning Network everyone puts their Bitcoin up as a stake and then when transacting they exchange fully valid bitcoin transactions that are usually never broadcast and put into the blockchain. An analogy would be a dutch date where the two take turns paying for taxis, food, drink, dessert. Instead of putting every transaction on the blockchain, they can simply settle the bill once at the end of the evening with just one entry in the blockchain.

By the same token, Lightning Network smart contracts allow a channel between users and hubs to be set up and for fully valid bitcoin transactions to be exchanged but usually ones that will never hit the blockchain until the channel is closed. If one part of Lightning Network fails, they cannot run away with the money until after a certain time has elapsed in which case there is plenty of time for the user to simply cash in the transactions they have in hand and redeem it on the blockchain first.

Doubling the blocksize will only double the number of transactions from 7 to 14 a second. SegWit is the first step to taking transactions off the blockchain and using the blockchain only as a net settlement layer. This will allow Bitcoin to grow users regardless of the number of transactions they make. Lightning Network (or other similar projects like Thunder and Raiden) would mean that Bitcoin can still be used both for huge macro international payments and at the same time being cheap enough to buy coffee in the morning.

So the argument between big blocks and SegWit is like comparing apples and bamboo. You can eat bamboo (shoots) and you can eat apples, but you can use bamboo to create houses and bicycles and scaffolding and so much more.

The author is of the opinion that SegWit will win in the long run. The question is how much damage the Bitcoin unlimited miners can do in the meantime with their myopic power play, or will the hitherto quiet and forgotten Litecoin beat Bitcoin to SegWit and Lightning first and pull off a major coup? Many are betting on it and the price of Litecoin has skyrocketed in the past week.

With so much happening in this tumultuous clash of finance and technology, one can say that is a such a wonderful time to be alive.

Don is a contributing editor for Disruptive.Asia. For most of the 00s, he was the face of Database, the enterprise tech section of the Bangkok Post, and later covered Thailand and the region for Telecom Asia. Before becoming a journalist he was a civil servant at Thailand's ICT Ministry. He is currently studying for an M.Sc. in Digital Currency at the University of Nicosia. He is also an avid proponent of strong encryption and Bitcoin.

Related Articles

SHANGHAI (Reuters) – China’s three largest bitcoin exchanges said on Thursday they will strengthen oversight of customers’ identities and sources of funds, in the latest shift since the Chinese central bank stepped up its scrutiny Read more…

SHANGHAI (Reuters) – Virtual currencies like Bitcoin are assets but Bitcoin in itself does not have the fundamental attributes needed to be a currency that could meet modern economic development needs, a Chinese central bank adviser said. Sheng Songcheng, Read more…

Archives

Archives

Free Newsletter Subscription

Make your life simpler and more productive by opting for our daily headlines to be sent direct to you. We promise not to share your email with anybody. Go on, you know you want to.
Click or scan to subscribe: