What is Segregated Witness (Segwit)?

what is segwit

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 Benefits

SegWit improves Bitcoin and fixes a number of bugs. The main features of Segwit are described in detail below.

Capacity Increase

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.

block height

Segwit Fixes Transaction Malleability

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.

transaction malleability illustrated
A view of a malleated transaction

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

Segwit adoption is increasing. Nearly 40% of all Bitcoin transactions use SegWit addresses.

segwit adoption chart

Why Segwit is Important

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.

segwith and lightning network logo

How Bitcoin Works

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.

transaction signature illustration
Signatures represent about 60% of the file size of a transaction

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.

bitcoin fees in 2017
This graph shows the height of Bitcoin fees in December of 2017

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.

bitcoin trannsaction lifestyle

How Segwit Works

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.

segwit cuts out the signature data
Removing the signature from the transactions frees up space for more transactions

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)

block weight over time
block weight table over time

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.

segwit address vs legacy address

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.

What’s The Bottom Line on SegWit?

Before After
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.


What Does Segwit Mean?

Segwit is short for ‘segregated witness’.

Is Segwit a Fork?

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.

Do Hardware Wallets Support Segwit?

Yes, hardware wallets like Ledger and TREZOR support Segwit.

Who Created Segwit?

Segwit was developed by Peter Wuille. He’s one of Bitcoin’s most prolific developers, and won Coindesk’s 2017 Most Influential Award.

Is Segwit Activated On Litecoin?

Yes, congrats Litecoin! :) Litecoin will also be adding more features in the future.