SegWit (Segregated Witness) was a major upgrade for Bitcoin. The code was released in 2015, and Segwit finally went live on Bitcoin in August 2017.
SegWit improves Bitcoin and fixes a number of bugs. The main features of Segwit are described in detail below.
Segwit doubled the capacity of the Bitcoin network.
A lot of people are claiming that SegWit did not increase the block size. It’s very easy to see that, yes, SegWit was a block size increase!
Here, for example, we can see a 2,177 KB (2.17 MB) Bitcoin block mined in January 2018.
In addition to increasing Bitcoin’s ability to process transactions, SegWit fixes a fatal flaw in Bitcoin’s protocol that allowed users to tamper with transaction identities.
Before SegWit, the Transaction ID of a transaction could have been changed by manipulating the unlocking code of the transaction (your digital signature). After you digitally sign a transaction, it is sent through Bitcoin’s cryptographic hash function which results in a unique transaction ID.
If one character is changed in the digital signature, it will result in an entirely different transaction ID. SegWit moves the signature to the end of the transaction data, so the Transaction ID is created from everything but the digital signature.
In effect, this change renders it impossible to change the Transaction ID – if malicious nodes were able to tamper with Transaction IDs, the Lightning Network wouldn’t be possible.
Segwit adoption is increasing. Nearly 40% of all Bitcoin transactions use SegWit addresses.
Bitcoin is by far the largest cryptocurrency by market cap, and for good reason. However, many in the crypto space have criticized Bitcoin because it is having trouble scaling to its ever-expanding user base.
Bitcoin is only capable of processing a mere 7-10 transactions per second on the base layer. Bitcoin’s underlying technology, although revolutionary, has also become one of Bitcoin’s most significant challenges.
Nevertheless, prominent developers in the Bitcoin community are working to develop a solution to the problem. SegWit and the Lightning Network together will allow Bitcoin to process millions (or more) transactions per second.
Before you can understand SegWit, you must first understand how Bitcoin transactions are processed.
This video may help give you some background before reading on:
You can think of the Bitcoin (bitcoin is modeled after gold) network like a chain, and each link in the chain is a block. For the sake of simplicity, let’s picture a block that only contains one transaction. If Mike sends 1 BTC to Bob, he’d add important data to the block:
Mike’s public key and digital signature must be included in the block to prove that the transaction is legitimate and really did come from him. The digital signature is included in the block as script (you can think of script as code). Just like people sign checks to authorize them, users of the BTC network must sign transactions to authorize them.
Despite being necessary to authenticate transactions, digital signatures fill up a lot of space that could otherwise be used for transaction data.
When thousands of transactions are initiated at once, there is not enough room for all of them to enter the same block. Users must pay a transaction fee which incentivizes miners to include their transaction in the block before others’. The more you pay, the faster your transaction will go through.
Unfortunately, transaction fees can get quite pricey. In December of 2017, it wasn’t unheard of to pay $50 per transaction if you wanted it to be validated within 10-20 minutes. Bitcoin’s scalability issue is one of its most significant obstacles prior to mainstream adoption. Nobody in today’s society wants to pay $20 for a cup of coffee while waiting around for their payment to clear.
Something must change.
Some believe the best way to solve the problem is expanding Bitcoin’s block size – however, that solution would require Bitcoin to hard fork. Rather than forking into a completely new cryptocurrency, SegWit has been implemented to significantly increase Bitcoin’s ability to process transactions.
For an easy primer on the lifecycle of a standard Bitcoin transaction, you can reference the image below from the Bitcoin wiki.
Segwit was activated via UASF. As mentioned previously, every block is composed of transaction data (public key, amount of BTC, etc.) and script (the sender’s public key and their digital signature). Although it is imperative that digital signatures are included in the validation process, they use a lot of space in blocks that could otherwise be used for more transactions.
Digital signatures, also known as witnesses, take up 60% of transaction data and usually the witness data exists in the middle of the transaction data. Segregated Witness is a way to remove the witness (signature) from the transaction – instead, SegWit transactions move the witness data to the end of the transaction. When a SegWit transaction is being validated by a Legacy node (one that hasn’t upgraded), the witness data is stripped from the transaction. By removing signatures from the main block of transactions, transaction size is notably smaller, thus allowing far more transactions per block.
It is important to note that prior to SegWit, Bitcoin’s maximum block size was 1,000,000 bytes (1MB) – that is, once that data limit was reached, the block was no longer able to accept more transactions and any other transactions that weren’t included in the block had to wait in the mempool.
SegWit, contrary to popular belief, is indeed a block size increase. SegWit has implemented a new way to measure the size of transactions. Instead of relying on a 1,000,000-byte block size, SegWit measures blocks using something known as block weight.
Here’s the formula used to calculate block weight:
(tx size with witness data stripped) * 3 + (tx size)
Legacy transactions don’t have any witness data because it was stripped. So, the weight of a legacy transaction is effectively four times larger. SegWit transactions do have witness data, but it’s at the end of the transaction rather than being in the middle, so they are less than four times the size.
Since Segwit transactions are broadcasted to all nodes with the witness data stripped, the legacy nodes will never have to validate a block greater than 1,000,000 bytes, therefore adhering to Bitcoin’s original protocol.
Conversely, SegWit nodes can receive blocks that are very close to, but not quite 4MB in size. In order for a block to be (near) 4MB, it would have to consist of primarily witness data rather than transaction data. It would be incredibly close to 4MB with the witness data, but still, less than 1,000,000 bytes when stripped of the witness data.
Although SegWit nodes are capable of validating a 4MB (4,000,000 bytes) block, in practice, that block size is ridiculously large. In most cases, a SegWit block will not exceed 2MB.
|Max Block Size||1 MB||4 MB|
|Transactions per Second||3 TX/s||7 TX/s|
|Transaction Malleability Bug ||Broken||Fixed|
SegWit is the foundation for the Lightning Network. By eliminating the possibility for transaction malleability, secure payment channels can be created that will eventually allow the Bitcoin network to process millions of transactions per second. Lastly, SegWit is a way to help Bitcoin scale to accommodate its ever-expanding user base, without forcing a hard-fork.
Segwit is short for ‘segregated witness’.
Segwit was a soft fork. This is opposed to a hard fork which would create a separate coin (such as Bitcoin Cash). It added features and fixes to Bitcoin in 2017.
Yes, hardware wallets like Ledger and TREZOR support Segwit.
Segwit was developed by Peter Wuille. He’s one of Bitcoin’s most prolific developers, and won Coindesk’s 2017 Most Influential Award.
Yes, congrats Litecoin! :) Litecoin will also be adding more features in the future.
In 2017, Bitcoin was enjoying massive growth.
At the start of the year, the price hovered around $1000, but by November it had soared to $7000. It was also fluctuating wildly.
The decentralized monetary system had been presented with the kinds of challenges that they weren’t prepared for.
The increase in demand for the cryptocurrency led to a massive increase in transactions, which then drove the cost of operations and the length of time it took for transaction confirmations due to the mempool always being full.
If Bitcoin was going to scale in any real sense, it needed a software upgrade to its protocol. Which is where SegWit and SegWit2x were supposed to help.
It helps here to explain a little bit about how blockchain upgrades work. Part of the issue with SegWit2x was that it required a hard fork, as opposed to vanilla SegWit, which would only require a soft fork.
A soft fork is, at its core, backwards compatible. It allows for a shift in network rules and creates blocks that will still be recognized by existing, non-upgraded software.
On the other hand, a hard fork involves taking a blockchain and splitting it into two permanently. It performs a complete overhaul of the rules that apply to the blockchain and completely redesigns it so that it will not recognize old software.
In some cases, a hard fork can split a network into two, creating different systems that allow people to choose which they wish to adopt. This was seen in the case of bitcoin and bitcoin cash.
However, a split can also be caused if enough people adopt both possible outcomes, causing disruption to networks and systems.
In 2017, users had been paying miners a lot of money to make transactions. Fees were high and users were annoyed. Bitcoin needed to scale to service more transactions.
SegWit2x was a proposal that would require a hard fork, and it was built on the back of a soft fork proposal.
At it’s heart, Segwit2x was two separate changes to Bitcoin combined into one.
First, you have Segregated Witness or ‘Segwit’ which removes the witness or ‘signature’ data from the input field of a block.
Segwit was the “small blocker” solution to scaling Bitcoin - instead of increasing the block size, you would instead use the existing block space more efficiently.
Then you had the “big blocker” solution, which is where the ‘2x’ comes from. Their solution was to simply double the size of existing blocks.
And that is where the New York Agreement came into play.
This agreement was initially formed so that the Bitcoin network would prevent splitting into two different coins.
The solution proposed by the agreement runners was to give both parties what they wanted: a doubling of the block size and an activation of Segwit.
In order to implement SegWit2x, there would have to have been a considerable change in the rules of bitcoin governance.
However, the revolutionary aim was that SegWit2x would keep all existing bitcoin users on the same singular blockchain.
In the run-up to its proposed adoption, startups and miners were the most overt supporters of the new update. Fundamentally, this was based on the frustrations people had over bitcoin adoption. Bitcoin’s slowness caused other cryptocurrencies to overtake it.
Existing upgrades had caused massive amounts of frustration as they failed to address many of the issues that bitcoin was facing - and where a remedy was made, it often wasn’t anywhere near what it could have been.
While the initial Segwit proposal failed to excite miners, SegWit2x actively incentivized on-chain transactions, allowing them to turn a profit. With the time and investment that miners spend on their equipment, it was only common sense that they hoped to see better returns on their investment.
The other huge fans of the SegWit2x proposal were larger bitcoin companies like Circle and Coinbase. While they would ultimately suspend their support, their logic was similar to that of miners and startups.
For the most part, these companies make money when there is lots of coin circulation. More transactions equals more fees for them to charge. If users don’t want to send their coins to your exchange because the transaction fees are too high, that is bad for business.
This satisfied many of the shared aims of the various stakeholders. It would allow Bitcoin to increase its transaction throughput in the short term and allow exhcanges and miners to continue to make money as usual even if it meant potentially harming what made Bitcoin great.
The opposition to SegWit2x came from node operators and developers. Part of the debate came from an inherently different understanding of what matters most about Bitcoin.
For opposers of Segwit2x, decentralization was of prime importance. Doubling the block size would make it harder to run your own node and verify your own transactions.
Fans of Segwit2x wanted on-chain Bitcoin transactions to be more like ‘coffee money’, meaning it was something you could use today to buy a cup of coffee without paying high fees.
The risk of introducing a new protocol challenged this, and with people feeling like miners and businessmen would reap the rewards, the risks outweighed any potential benefits. While SegWit2x would increase the speed of transactions, the burden would have been felt more keenly by node operators who would have to store more data.
With opposition in both ideology and the rollout of the protocol, SegWit2x led to a battle within the blockchain community. While attempts were made to create a consensus on when and how the protocol should be implemented, it was ultimately too wide a gulf to bridge.
The SegWit2x hard fork was scheduled for November 16, 2017. Yet on November 8, the proposal was suspended due to the ongoing resistance to the protocol. Companies such as Coinbase and Circle revoked their support, and ultimately the protocol failed.