Welcome to another beginner’s guide to crypto! Today, I’m going to be telling you about what is SegWit.
There are hundreds of cryptocurrencies on the market and they each have a set of rules that guide the way they work. This set of rules is called a protocol. So, what does any of this have to do with SegWit? What is SegWit?
Well, like all computer programs, cryptocurrencies need to be updated and improved. Bugs and glitches are discovered that need to be fixed. This is what’s happening when your laptop asks you to shut down and update.
When a cryptocurrency needs to be updated or improved, changes have to be made to its protocol. SegWit was an update made to the Bitcoin protocol last year.
In this guide, I’m going to tell you everything you need to know about SegWit. I’m going to tell you what SegWit is and how it works. I’m also going to tell you what improvements it has made to the Bitcoin network and what these improvements mean for its users.
By the end of this guide, you’ll never have to ask yourself, “What is SegWit?” again.
Let’s begin by looking at where SegWit came from and what it was trying to achieve…
Did you know?
Want to get smarter & wealthier with crypto?
Subscribe - We publish new crypto explainer videos every week!
What is Polygon in Crypto? (Animated Explainer)
Table of Contents
- 1. The Story of SegWit
- 2. The Fundamentals of Blockchain
- 3. Transactions For Beginners
- 4. Standard Bitcoin Transaction
- 5. How Transaction Malleability Works
- 5.1. Patching Transaction Malleability
- 6. Bitcoin SegWit Scalability
- 6.1. The Lightning Network
- 7. What is SegWit: The Pros
- 8. What is SegWit: The Cons
- 9. Conclusion
The Story of SegWit
Latest Binance Coupon Found:
CLAIM $600 BONUS
Exclusive $600 Binance Offer
Don't miss this limited-time deal that's only available for our readers. Follow the Binance referral code link & receive up to $600 in rewards and bonuses!
The idea for SegWit was first introduced by Pieter Wuille at a Bitcoin conference in 2015. Wuille is a Bitcoin developer and the co-founder of Blockstream, a software company that specializes in digital security for financial services.
Wuille suggested SegWit as a solution to a flaw in the Bitcoin protocol. In software development, solutions to flaws are called patches. The problem he wanted to fix is called transaction malleability. Transaction malleability is a nerdy way of saying that Bitcoin can be stolen from users by changing tiny pieces of transaction information. Don’t worry, I’m going to cover all this in more detail in the next section.
Wuille’s SegWit proposal caused a big debate in the Bitcoin community and it was nearly two years before it went live. It was finally activated on August 23, 2017. The same patch was applied to the Litecoin protocol on May 10, 2017.
Note: Litecoin is a cryptocurrency whose code is based on the Bitcoin protocol. Because they are very similar, they shared the problem of transaction malleability.
SegWit fixed the transaction malleability problem and also made some other improvements to the Bitcoin protocol possible. However, it still has a lot of critics and not all users of the Bitcoin network have welcomed the changes. Some members of the Bitcoin community disagree with SegWit so much that they’ve created their rival cryptocurrencies!
Before we get into any of that, let’s look more closely at the problem of transaction malleability. So, what is transaction malleability and what is SegWit doing to stop it?
Transaction malleability is quite complicated. To understand it, you first need to understand how Bitcoin transactions work...
The Fundamentals of Blockchain
Bitcoin is a huge network made up of thousands of computers called nodes. Each node keeps a full record of every Bitcoin transaction that has ever been made. This record is called a blockchain.
Most of the work involved in processing new transactions is done by special nodes called miners. Users pay miners transaction fees for the work they do. New transactions can only be added to the blockchain after miners have put them into groups of transactions called blocks. Each block on the Bitcoin blockchain contains 1MB of transaction information.
It should take around 10 minutes for the network to process one block of transactions but it can take a lot longer. The Bitcoin network can process between 3-7 transactions per second (Tx/s). However, this can slow down a lot when the network is busy.
Now I’m going to use two examples to show you how simple Bitcoin transactions work. The first will be a standard Bitcoin transaction. The second will be a transaction where one user takes advantage of transaction malleability to steal Bitcoin from another user.
Transactions For Beginners
Lucy wants to send 10 Bitcoin (BTC) to Jude. To do this, Lucy and Jude need two kinds of information:
- A public address: This is like a Bitcoin email address. A public address is a digital location for Lucy to send Bitcoin to. Jude has a public address to receive Bitcoin. Public addresses can be seen by the whole network.
- A private key: If public addresses are like email addresses, then private keys are like passwords. They prove that the public addresses - and therefore the Bitcoin itself - belong to Lucy and Jude. Only Lucy can see Lucy's private key and only Jude can see Jude’s private key.
Let’s see what the transaction looks like on the Bitcoin network...<
Standard Bitcoin Transaction
How does 10BTC get from Lucy to Jude?
- Lucy broadcasts a request to the network. The request contains Jude’s public address, the amount being sent (10BTC) and a transaction fee for the miners. It also contains Lucy’s private key signature which she uses to prove that she has 10BTC to send. This signature information is called witness data.
- Miners process the transaction. They put Lucy’s information together with Jude’s and hash it. This means that they turn the information into a line of computer code. This code is called the transaction ID.
- The transaction queues, waiting to be processed. If Lucy has attached a low transaction fee then it could queue for a long time! It’s like ordering food in a restaurant. If you don’t tip the waiter, then it could take a long time for your food to arrive! Lucy can speed the process up by sending the transaction again with a higher fee. The transaction ID is now added to the transaction IDs of other users and encrypted again. This process continues until the limit of 1MB of transaction information is reached and a block is formed.
- The block is confirmed. The block is broadcasted to the network and if more than half of all nodes agree that the information on it is valid in it can be confirmed and added to the blockchain. Jude receives 10BTC from Lucy.
This is how most Bitcoin transactions happen. Next, I want to show you how transaction malleability can affect transactions and then we can ask, what is SegWit doing about it?
How Transaction Malleability Works
Using the example again, I’ll show you how transaction malleability can be used by Jude to trick Lucy into sending him 20BTC instead of 10. Here’s how it works…
The transaction malleability flaw in Bitcoin’s code allows Jude to change Lucy’s witness data before the transaction is confirmed. This changes the transaction ID without changing the transaction itself (which is still 10BTC being sent from Lucy to Jude).
When this altered transaction is confirmed by the network, it cancels out the original transaction. Now Jude contacts Lucy to complain that he hasn’t received 10BTC, even though he has!
Lucy checks and sees that the original transaction hasn’t gone through. She now attaches a higher transaction fee and sends it again. This new transaction is processed by the network. Jude receives 10 more Bitcoins!
Lucy, the miners and the rest of the network have no way of knowing that this is happening. Once the transactions are confirmed and added to the blockchain they can’t be changed or deleted. Below is a chart showing what a serious problem transaction malleability is for the Bitcoin network.
The transactions effected by transaction malleability are shown in red.
So, what is SegWit and what does it do to solve the problem of transaction malleability?
Patching Transaction Malleability
As I mentioned earlier, SegWit is a patch designed by Pieter Wuille to prevent transaction malleability. The way it works is pretty simple. To stop witness data from being used to change transaction IDs, Wuille suggested removing it from the transaction! Simple, right?
SegWit’s full name is a segregated witness. Segregate means remove or separate, so SegWit means to remove the witness data.
A segregated witness creates a sidechain where witness data is stored away from the main blockchain. This prevents transaction IDs from being altered by dishonest users like Jude!
The clever thing about Bitcoin SegWit is that it’s backward compatible. This means that nodes that are updated with the SegWit Bitcoin protocol can still work with nodes that haven’t been updated. This kind of update is called a soft fork. Updates that aren’t backward compatible are called hard forks. Hard forks can divide networks and lead to new cryptocurrencies being created.
Pieter Wuille wanted SegWit to be backward compatible, and therefore, a soft-fork update. To do this, he needed to design it so that witness data was still recorded on the main blockchain. The solution he found was to encrypt all the witness data of a block on the SegWit sidechain and store this root code on the main blockchain. This allowed Bitcoin SegWit to patch transaction malleability without becoming a hard-fork update.
Now you know how segregated witness prevents transaction malleability, but the story of SegWit Bitcoin doesn’t end there. SegWit has affected the Bitcoin network in ways that Pieter Wuille didn’t even think of when he created it!
Next, I’m going to tell you about scalability and the lightning network. I’ll begin with scalability...
So, what is SegWit scalability?
Bitcoin SegWit Scalability
First, let me explain what scalability is. Scalability is the ability of a network to process huge amounts of transactions without transaction speeds going down. If a network is scalable, it will be able to process transactions as fast, or even faster, as it gets bigger. Unfortunately, most cryptocurrencies process transactions slower the bigger they get.
Cryptocurrencies have a scalability problem because transactions are processed by consensus. As I mentioned earlier, more than half the nodes on the Bitcoin network need to agree that a transaction is valid before it can be added to the blockchain. The more nodes there are on the network, the longer it takes to reach an agreement or consensus.
The Bitcoin community has been debating different ways to scale the network for a long time. The problem gets worse as the platform becomes more popular so time is running out to find a solution.
When Pieter Wuille created Bitcoin SegWit he accidentally improved the network’s scalability as well! Witness data used to take up 65% of every Bitcoin block. By removing witness data, SegWit Bitcoin blocks now have room for much more transaction information.
Each block now has a set block weight which is capped at 4MB. A block’s weight is a combination of the 1MB of information stored on the main blockchain and the witness data stored on a sidechain. A segregated witness allows the network to process more transactions without changing the overall Bitcoin blockchain size.
So, if someone asks you, “what is SegWit scalability?” you can tell them that it’s a way of processing more transactions on the Bitcoin network. It makes the network lighter by removing witness data from transactions without affecting the Bitcoin blockchain size.
Now, I want to tell you about another exciting development that SegWit is making possible. What is SegWit being used for now?
The Lightning Network
The lightning network is another solution to the Bitcoin scalability problem and it wouldn’t work without a segregated witness.
The lightning network allows users to set up payment channels for micropayments. Let’s use Lucy and Jude for another example:
Jude works for Lucy. She pays him 1BTC per day. Rather than processing the transaction on the main blockchain, Lucy and Jude set up a private payment channel where Lucy can send Bitcoin directly to Jude. She sends him a micropayment of 1BTC per day. Each micropayment needs to be signed by both Lucy and Jude. They are called multi-signature transactions for this reason.
Jude works for Lucy for ten days. At the end of the ten days, Lucy and Jude close the payment channel. At this point, all the micropayments are broadcast to the network as one transaction for 10BTC.
Payment channels like these form the basis of a lightning network of thousands of micropayments taking place away from the main blockchain. Transactions are only added to the main blockchain when users close the payment channel. So, what is SegWit doing to make this possible?
Micropayments are unconfirmed transactions that only become valid when the payment channel is closed and the total balance of transactions is processed by the network. Without Bitcoin SegWit, users could alter transaction IDs in multi-signature transactions using transaction malleability. This would mean chaos for the system and leave it completely unworkable.
You now know what SegWit is, how it works and what it means for the Bitcoin network. Before I finish, I’ll give you a quick recap of what’s great about SegWit. I’ll also tell you about some of the criticism it’s had and some of the issues it’s caused...
What is SegWit: The Pros
✓ Transaction malleability a thing of the past. SegWit is a simple and creative solution to a major problem in the Bitcoin protocol.
✓ Bitcoin transactions faster. SegWit makes the Bitcoin blockchain lighter. It allows more transactions to be processed without increasing the overall Bitcoin blockchain size.
✓ Bitcoin transactions cheaper. Higher transaction speed means lower transaction fees. Bitcoin transaction fees can be incredibly high so any changes that bring them down should be welcomed by the community.
✓ New and exciting developments possible. If Bitcoin is going to serve a network of millions of people, then it needs to solve the problem of scalability. SegWit helps to make scalability projects like the lightning network a reality.
What is SegWit: The Cons
✗ It isn’t being used by enough nodes. A lot of miners don’t like SegWit. Lower fees affect their profits and they also don’t appreciate having to support the witness-data sidechain which doesn’t provide any fee revenue at all. Other Bitcoin services - like wallets - have also been slow to support the SegWit changes. In February 2018, almost six months after it was activated, only 14% of Bitcoin transactions were made using SegWit Bitcoin. The numbers have improved since then, but the network is still a long way from being completely updated.
✗ It’s a short-term solution to long-term problems. Some Bitcoin developers have complained that the SegWit protocol doesn’t go far enough to solve the scalability problem. They claim that only major changes to the Bitcoin blockchain size and the way transactions are processed will help the platform to scale in the future.
✗ SegWit has caused divisions in the Bitcoin community. The disagreements surrounding SegWit have caused several hard forks. The most well known of these is Bitcoin Cash (BCH).
Now you’ve got all the facts, you can answer “What is SegWit?” for yourself. Before I go, I want to share a few closing remarks with you...
When Pieter Wuille designed SegWit, he wanted to fix the problems that transaction malleability was causing. But SegWit did much more than that, it created a massive discussion about the future of the Bitcoin platform itself. Bitcoin is nearly ten years old. It’s still the biggest cryptocurrency in the world but some are starting to question whether it’s the best.
There are hundreds of new blockchain projects offering some of the most advanced crypto techs ever seen. Some see SegWit Bitcoin as a positive change for the network. However, others see it as a symbol of Bitcoin’s limitations.
The SegWit debate continues throughout the Bitcoin community, and now you know enough to have your say. What is Segwit to you? Is it an exciting new development that will take Bitcoin into the future? Or is it a temporary solution to the much bigger problems that the Bitcoin network faces? Think about it, and I’ll see you next time!
Leave your honest feedback
Leave your genuine opinion & help thousands of people to choose the best crypto exchange. All feedback, either positive or negative, are accepted as long as they’re honest. We do not publish biased feedback or spam. So if you want to share your experience, opinion or give advice - the scene is yours!