Saturday, 19 August 2017

Understanding Segregated Witness

Understanding Segregated Witness

Segregated Witness (SegWit, for short) is scheduled to “lock in” within 24 hours and activate in about two weeks. Not everyone understands what this Bitcoin protocol upgrade actually does, so in this article, I seek to explain to a general audience what Segwit is.


But first, let’s take a look at bitcoin.

Bitcoin As A Global Ledger

To understand Segwit, we first have to understand a little bit about Bitcoin.

If you think of Bitcoin as a single global ledger, a Bitcoin transaction is a lot like a bank check. As the owner of some amount of money, you can sign over some of your money to someone else.

And, much like a check, a Bitcoin transaction has a signature. Instead of a physical signature, you create a digital signature using your private key.

Interestingly, while a signature on a physical check takes up maybe 10% of the check, a digital signature in bitcoin takes up more like 50% of the digital check.

To continue the analogy, a Bitcoin block is like a box of signed checks or transactions. Much like physical boxes in the real world, Bitcoin blocks have a limit on how many transactions they can contain.

Right now, those boxes come in a standard 1MB size — and they are full. You can put just a few checks into the box so that it’s almost empty, but you can never put more checks into the box than the box can hold.

To keep the global ledger consistent and cheat-proof, everyone that wants to can audit the ledger by auditing these blocks (boxes of checks). A copy of the box of checks is sent to anyone that wants to audit the ledger.

If, in an audit of these boxes of checks, someone found that one of the checks overspent (that is, the person writing the check does not have enough money in their account to cover the transaction), they would reject the entire box.

This is important since, otherwise, people would start writing bad checks. We also need to do this fairly often so people can actually have a good idea of how much money they have, so we send the boxes of checks to everybody (meaning every node on the system) to audit pretty frequently — every 10 minutes on average.

Contextualizing the Scaling Debate

Because there’s a limit to the block (box) size, there is a limit to how many checks that can clear on the network in a timely manner. That is, the throughput of Bitcoin transactions is limited. The scaling debate that’s been going on for the past few years in Bitcoin is really about how to get more transactions through the system.

The two solutions that groups came up with can be thought of in two ways. The first would be to make the box sizes bigger. The second would be to create a new type of check and only give bigger boxes to those who request them.

Making the Box Bigger

One group wanted to do away with the current boxes and make the boxes larger. This is great if everybody is forced to use a bigger box, but there are some problems with this idea.

If some people kept using the smaller box, this would cause discrepancies in the ledger and create two different ledgers. Additionally, even if everyone used the bigger box, a lot of people checking the ledger would not receive the bigger boxes in time to examine that all the checks were valid. 10 minutes is too little time to receive and audit the box for some people.

The main advantage of making the box bigger is that it’s a relatively simple change. There aren’t new style checks to worry about and everything can operate as before.

Bitcoin Cash is essentially using this solution by lifting the 1MB block size limit and implementing an 8MB block size instead.

Changing the Checks

The other solution is to introduce new style of check. We could still make larger boxes available, but only to those that want them. This “change the check” solution essentially cuts away the signature part of the check for everyone that isn’t accepting the bigger boxes.

Remember how the signature is about 50% of the transaction? SegWit cuts the checks in half and sends everything but the signature to everyone that’s accepting the old, smaller box. We send the larger boxes to everyone that’s accepting the new, larger box.

Given that the checks are half the size for the smaller boxes, we can fit about double the number of checks in the smaller boxes, increasing throughput. Anyone that’s receiving the larger box could audit everything in the box as normal and anyone receiving the smaller box could still audit without worrying about getting the signatures in time.

Because we’re accommodating the people that aren’t using the newer, bigger box, SegWit is backwards compatible. That means everyone will have the same copy of the ledger no matter what size box they’re using.

The main drawback to SegWit is that everyone will have to get used to the new style of checks before we see some gains in throughput. It’s also a bit more complicated than just making everyone use a larger box. Additionally, everyone receiving the new style checks but using a smaller box won’t get to audit the signatures since they won’t receive them.

Bitcoin is using the “new check” solution starting in a couple of weeks.

In Summary

Bitcoin is a distributed ledger, and it helps to think of transactions and blocks as checks and boxes. Bitcoin Cash is standardizing on a bigger box for everyone while SegWit is using larger boxes for some while accommodating those that don’t want to use larger boxes with new types of checks.

Does this help you understand SegWit better? Answer in the comments below.



Creamcoin Marketcap