Segregated Witness, or Segwit, has finally been activated by a super majority of the current hashpower on the Bitcoin network. Segwit fixes many bugs currently in the protocol, and allows for some scaling using an effective blocksize increase.
Almost two years of debate
In December of 2015, the source code for Segregated Witness (Segwit) was released. It was meant as a fix for the ever-problematic transaction malleability bug, which allowed for someone to change one or two characters of a transaction’s ID before it was cemented into the blockchain. Along with that, it provided a method of scaling Bitcoin. Doing away with the concept of a blocksize, a new metric was made called blockweight.
For years the software was not added to the Bitcoin protocol as it never garnered the necessary 95% of the hashpower needed to activate. It was to be implemented though means of a softfork, which meant it would comply with all currently consensus rules and be backwards compatible with those running old software and did not wish to upgrade.
Whether you believe that Segwit was a direct result of the grassroot approach of BIP148 forced miners to finally activate it after all this time, or the New York Agreement was the reason everyone came together to signal for Segwit, it is finally here.
A second BIP was released weeks ago to lower the activation threshold to 80% of the hashpower, but even with the lowered bar Segwit still achieved around 97% signaling and locked in during the beginning of August.
After the official lock-in period, the network allowed for two weeks to provide grade period of sorts for people to upgrade their software to work with Segwit.
How Segwit Works
There has been a ton of misinformation about Segwit, so this article will hopefully clear some things up of how it actually works. As stated earlier the whole idea of a blocksize has been gotten rid of. Instead, the network will now use blockweight.
There’s two types of data that are contained in a transaction. Firstly, there is actual transaction data, such as the address the coins are being sent to. Then there is the witness data, which is all the information that is only needed when the transaction is confirmed, and then that data is essentially never used again.
Segwit provides a “discount” to the witness data, and once committed to the blockchain it gets pruned. These 1000 1KB transactions would obviously fill the current blocksize of 1MB, but remember blocksize isn’t even a metric any more. It’s been replaced by blockweight, the new limit of which will be set at 4,000,000 “units.”
The way the new unit system works is the number of units in a transaction is simply the number of bytes of transaction data multiplied by four. Witness data is, as said before, discounted. The bytes of the witness data are essentially a direct translation to units at a 1:1 rate.
So, for example, let’s say there’s 1000 transactions in the mempool, all at 1KB of data. Now let’s say in each of the transactions, 400 bytes is witness data and the other 600 bytes is transaction data. The 600 bytes for transaction data is now worth 2,400 units, while the witness data is now worth 600 units giving the whole transaction a weight of 2,800 units. All of these transactions together will only take up 2,800,000 of the 4,000,000 units, leaving room for more transactions.
The actually size of each block still won’t go over 1MB of data. Once the transaction is confirmed by the network, the not needed witness data will be pruned off the blockchain, to save storage space and decrease bandwidth use.
How Do I Actually Use SegWit?
For those of you expecting an immediate sign that Segwit is helping everything, I’m sorry to let you down. In reality, it could be weeks or even months before Segwit really starts to have widespread adoption.
Segwit transactions can only be sent from Segwit addresses. So, every single address that currently contains coins would have to send them to a Segwit address before we see the full effect of the upgrade. And even then, there could be a decent chunk of users who still don’t trust Segwit and don’t want to use it. Which is perfectly fine, that’s the point of a softfork. It doesn’t force users who don’t agree to it to upgrade to it.
For you to use segwit and send segwit transactions, you’ll need to send your coins to wallet that generates Segwit addresses. Otherwise, it will just be a normal transaction.
Moving forward, Segwit was an important setup to the upgrading and scaling of the Bitcoin network, which has been woefully overloaded in the past several months. Segwit opens the door to better implementation of the lightning network, which can allow for transactions to be sent off chain for pennies.
Coming in November, the second half of the New York Agreement is set to take place calling for a doubling of the blockweight to even further scale the network though means of a hardfork.
Will you be using segwit from here on in? How do you think this will effect the network? Let us know in the comments below!
Images courtesy of Shutterstock, Segwit.co