What is Segwit? Segregated Witness Explained Simply
Summary
TLDRIn this episode of Crypto Whiteboard Tuesday, Nate Martin from 99Bitcoins.com explains Segregated Witness (SegWit), an upgrade to the Bitcoin network activated in August 2017. SegWit addresses Bitcoin's scalability by increasing transaction capacity, moving digital signatures to an extended block, thus allowing more transactions to fit within the 1MB base block. It also solves the transaction malleability issue, ensuring the integrity of transactions for second-layer solutions like the Lightning Network. SegWit blocks, measured by weight rather than size, incentivize miners to include lighter transactions, enhancing efficiency. With almost 50% of Bitcoin transactions being SegWit, it's becoming the new standard, paving the way for further developments like Schnorr Signatures and mass adoption of Bitcoin.
Takeaways
- đ **Segwit Introduction**: Segregated Witness (Segwit) is an upgrade to the Bitcoin network activated in August 2017, introduced by developer Pieter Wuille to address scalability and transaction malleability issues.
- đ **Blockchain Transactions**: Bitcoin transactions are recorded on a blockchain, with blocks containing transactions created approximately every 10 minutes, limited by the 1MB block size.
- đ **Scalability Problem**: The 1MB block size limit results in an average of 2700 transactions per block, causing scalability issues and long transaction queues, especially when compared to Visa's 1,700 transactions per second.
- đ **Transaction Malleability**: Bitcoin's code allows digital signatures to be altered without invalidating the transaction, which can affect transaction IDs and cause problems for second-layer solutions like the Lightning Network.
- đ§ **Segwit Solution**: Segwit solves malleability by moving the digital signature (the witness) outside of the base transaction block, thus preventing signature alteration from affecting transaction IDs.
- đŠ **Block Structure Change**: Segwit introduces a new block structure with a 1MB base transaction block and a 3MB extended block for witness data, effectively increasing block size without a hard fork.
- đ€ **Backwards Compatibility**: Segwit is a soft fork, allowing both Segwit and non-Segwit blocks to coexist, with legacy nodes accepting only the base block and Segwit nodes accepting both.
- âïž **Block Weight Measurement**: Segwit introduces block weight measurement, which considers the size of the base transaction and the full transaction size, incentivizing miners to include lighter Segwit transactions.
- đ° **Transaction Fees**: Segwit transactions, being lighter, can fit more in a block, potentially increasing miner's fees and often requiring lower network fees for faster confirmation.
- đ **Adoption and Support**: Major wallet brands like Ledger, TREZOR, Electrum, Exodus, and Coinomi have adopted Segwit, with almost 50% of Bitcoin transactions being Segwit transactions.
- đ **Migration to Segwit**: Users with legacy wallets need to create a new Segwit wallet and transfer funds to it, as there is no direct upgrade path from legacy to Segwit wallets.
- âïž **Future Developments**: Segwit is a foundational upgrade that enables further developments like the Lightning Network and Schnorr Signatures, contributing to Bitcoin's readiness for mass adoption.
Q & A
What is Segwit and when was it activated?
-Segwit, which stands for Segregated Witness, is an upgrade to the Bitcoin network designed to address scalability and transaction malleability issues. It was activated in August of 2017.
How does Segwit help with Bitcoin's scalability problem?
-Segwit helps with scalability by changing the structure of blocks, moving the digital signature (the witness data) outside of the base transaction block into an extended block. This allows more transactions to fit within the 1mb base block, effectively increasing the transaction capacity without altering the block size limit in the protocol.
What is transaction malleability and how does Segwit address it?
-Transaction malleability is the ability to alter a transaction's digital signature without invalidating the transaction, which can lead to issues such as changing a transaction's ID. Segwit addresses this by moving the signature outside the base block, so changes to the signature do not affect the transaction ID.
How does the block size debate relate to Segwit?
-The block size debate centers around whether to increase the block size to improve transaction throughput. Segwit offers a solution that increases the effective block size to 4mb without a contentious hard fork, by using a 1mb base block with an additional 3mb extension.
What is a soft fork and how does it relate to Segwit?
-A soft fork is a type of blockchain upgrade that is backwards compatible, meaning that nodes running the old software can still validate transactions after the fork. Segwit is implemented as a soft fork, allowing both Segwit and non-Segwit nodes to coexist and validate transactions.
How does Segwit's block weight concept benefit miners?
-Segwit introduces the concept of block weight, which is calculated per transaction and incentivizes miners to include 'lighter' Segwit transactions. This is because they can fit more transactions in a block, increasing the potential miner's fee if the block is accepted.
What is the average block size with Segwit transactions?
-While Segwit theoretically allows for blocks up to 4mb in size, in practice, the average block size that includes Segwit transactions is around 2mb.
How do Segwit and legacy addresses differ in their starting digits?
-Segwit addresses start with a '3', while legacy addresses start with a '1'. This distinction helps users and systems differentiate between the two types of addresses.
What is the process for moving funds from a legacy wallet to a Segwit wallet?
-To move funds from a legacy wallet to a Segwit wallet, one must create a new Segwit wallet and then transfer all funds to the new wallet's address. There is no direct upgrade path for a legacy wallet to become Segwit-compatible.
Which popular wallets have adopted Segwit?
-Major wallet brands such as Ledger, TREZOR, Electrum, Exodus, and Coinomi have adopted Segwit, enhancing their support for Bitcoin transactions.
How does Segwit set the stage for further Bitcoin developments?
-Segwit is a foundational upgrade that allows for further developments like the Lightning Network and Schnorr Signatures. It paves the way for Bitcoin to scale and become more efficient, making it more suitable for mass adoption.
What is the significance of the 1mb base transaction block in Segwit?
-The 1mb base transaction block in Segwit is significant because it maintains the original block size limit defined in the Bitcoin protocol, allowing more transactions to fit due to the segregated witness data, without requiring a hard fork.
Outlines
đ Introduction to Segwit and its Purpose
The first paragraph introduces the concept of Segregated Witness (Segwit), an upgrade to the Bitcoin network activated in August 2017, designed to address Bitcoin's scalability and transaction malleability issues. It explains the limitations of the 1mb block size and how Segwit, proposed by developer Pieter Wuille, aims to increase transaction capacity to facilitate mass adoption. The paragraph also sets the stage for a deeper dive into how Segwit operates and its benefits.
đ How Segwit Works and its Impact on Bitcoin Transactions
This paragraph delves into the technical workings of Segwit. It describes how Segwit restructures blocks to separate witness data from the base transaction data, effectively increasing the capacity of the blockchain without violating the 1mb block size protocol. The explanation covers how this change reduces transaction malleability by keeping the transaction ID stable even if the signature changes. Additionally, it discusses the concept of block weight in Segwit, which incentivizes miners to include more Segwit transactions, leading to a more efficient and cost-effective network. The paragraph concludes by noting the growing adoption of Segwit in popular wallets and the need to create a new Segwit wallet for those transitioning from legacy wallets.
đ Segwit's Role in Bitcoin's Scalability and Future Developments
The final paragraph emphasizes Segwit's significance as a foundational upgrade for Bitcoin, enabling smaller transaction sizes and enhanced security against malleability issues. It invites viewers to ask questions in the comments and encourages engagement with the channel through likes and subscriptions. The speaker, Nate Martin from 99Bitcoins.com, wraps up the episode by highlighting Segwit as a precursor to further innovations like the Lightning Network and Schnorr Signatures, positioning it as a crucial step towards Bitcoin's scalability and mainstream acceptance.
Mindmap
Keywords
đĄSegwit
đĄScalability
đĄTransaction Malleability
đĄBlockchain
đĄBlock Size
đĄSoft Fork
đĄBlock Weight
đĄDigital Signature
đĄLightning Network
đĄLegacy Addresses
đĄMiner's Fee
Highlights
Segwit is an upgrade to the Bitcoin network activated in August 2017, aiming to solve scalability and transaction malleability issues.
Bitcoin transactions are limited by a 1mb block size, causing scalability problems when many transactions occur simultaneously.
Segwit increases transaction capacity by moving the digital signature, known as 'the witness,' outside the base transaction block.
Transaction malleability is a problem where the digital signature of a transaction can be altered without invalidating the transaction.
Segwit prevents malleability by ensuring a signature change does not affect the transaction ID.
Segwit blocks are structured as a 1mb base transaction block plus an additional 3mb extended block for witness data.
Segwit is a soft fork, maintaining backward compatibility with legacy nodes that only receive the base transaction block.
Segwit transactions are measured by weight, not size, incentivizing miners to include more lightweight transactions in a block.
The average block size with Segwit transactions is around 2mb, with almost 50% of all Bitcoin transactions being Segwit.
Legacy transactions, being larger, require higher network fees for faster confirmation.
Popular wallets and exchanges are increasingly supporting Segwit, with addresses starting with a '3'.
Moving to a Segwit wallet from a legacy wallet requires creating a new Segwit address and transferring funds.
Segwit is the foundation for further Bitcoin developments like the Lightning Network and Schnorr Signatures.
Segwit is expected to become the standard for Bitcoin transactions as more wallets adopt it.
Segwit addresses the scalability problem by allowing more transactions to be processed, thus facilitating mass adoption.
The introduction of Segwit is a fundamental change that enhances Bitcoin's transaction efficiency and security.
Transcripts
What is Segwit?
Will it truly allow for Bitcoin to scale for mass adoption?
And how does it even work?
Well stick around,
in this episode of Crypto whiteboard Tuesday
weâll answer these questions and more.
Hi, Iâm Nate Martin from 99Bitcoins.com
and welcome to Crypto Whiteboard Tuesday
where we take complex cryptocurrency topics,
break them down
and translate them into plain English.
Before we begin, donât forget to subscribe to the channel
and click the bell so youâll immediately get notified
when a new video comes out.
Todayâs topic is Segregated Witness, or Segwit for short.
Segwit is an upgrade to the Bitcoin network
that was activated in August of 2017.
It was first introduced by Developer Pieter Wiulle
at the Scaling Bitcoin conference in December 2015.
Segwit aims to solve several issues:
one of which is Bitcoinâs scalability.
Bitcoin transactions are written on a Blockchain,
an immutable ledger
on which transactions are bundled together into blocks
that are chained one to the other, in order to determine their order.
A new block is created roughly every 10 minutes.
Additionally,
Bitcoinâs protocol limits the capacity of a block to 1mb,
which limits a Bitcoin block to around 2700 transactions on average.
This creates a problem
when a lot of people are trying to send Bitcoins simultaneously
as the queue of transactions waiting to enter the blockchain
gets longer and longer..
While Visa can process 1,700 transactions per second,
Bitcoin can process only 4,
not nearly a scale that could handle mass adoption.
In order for Bitcoin to truly become usable on a worldwide scale,
it needs to find a way to increase its transaction capacity.
Another issue Segwit addresses is transaction malleability.
Every Bitcoin transaction has 3 parts -
who sent it (also known as input), who receives it (output),
and a digital signature
that verifies that the sender is eligible to send the coins.
It turns out that Bitcoinâs code allows digital signatures to be altered
while a transaction is still waiting to get confirmed.
The signature alteration can be done in such a way that
if you run a mathematical check on it, it is still valid according to the network.
But if you run a hashing algorithm on it,
it gives a different result.
Let me explain with an example:
For the sake of simplicity
letâs say that the signature value was â3â,
but instead of â3â I change it to â03â or â3+7-7â.
While mathematically, the values are all the same,
so itâs still a valid signature,
if I hash these different versions I will get different results,
since hashing depends on how you write the value
and not just the value itself.
Since the hash is the transactionâs id in the blockchain,
this means I can effectively change any unconfirmed transactionâs id
to a different id and it will still be valid.
Creating a new transaction id for an existing transaction
can be problematic for a number of reasons:
First, if you want to build second layer solutions
on top of the Bitcoin network, like the Lightning Network,
you need to make sure no one can alter the first layer
since the one relies on the other.
If you want to learn more about the Lightning Network
make sure to catch our episode about it as well.
Second, altering transaction ids can cause issues
if youâre spending or accepting unconfirmed funds.
Letâs go through another example:
Alice pays Bob in transaction X which is currently unconfirmed.
Bob uses these unconfirmed funds
to pay for a product online from Charlie (transaction Y).
Meanwhile, Charlie sends Bob his product
before waiting for confirmation on transaction Y.
After receiving his product,
Bob does some technical tinkering, and maliciously changes,
or malleates, Aliceâs payment
so that her transaction, X gets confirmed
but with a different transaction id.
Transaction Y, which is what Bob sent to Charlie,
is now invalid
since it relies on transaction Xâs original transaction id
that now no longer exists.
So Charlie wonât get paid
even though heâs already delivered the goods to Bob.
Bad Bob...
While scalability and malleability
are the two most burning issues that Segwit addresses,
there are a variety of other technical issues
that Segwit tackles
that donât necessarily affect the end user directly.
Now that you know what Segwit is,
letâs talk a bit about how it actually works.
Segregated Witness is a proposed change
to how blocks are structured.
Non segwit blocks, also known as legacy blocks,
have a total of 1mb space for all of the block data:
inputs, outputs, signatures and additional scripts.
Segwit blocks, on the other hand,
are in fact large 4mb blocks that consist of a base transaction block
and an extended block.
So contrary to popular opinion, Segwit is indeed a block size increase.
Segwit blocks move the digital signature
and other data known as âthe witnessâ outside of the base transaction block.
The witness data will still be transmitted,
but it is placed inside the extended block.
So the base transaction block includes the information about the sender
and the receiver
and the witness data is left blank and doesnât take up any more space.
This allows for more transactions to fit inside
the 1mb base transaction block.
The extended block (the additional 3mb)
include all of the witness data that isnât mandatory
in the base transaction block.
The new block format Segwit introduces
achieves two major goals:
First, it moves the digital signature outside of the base transaction block.
This way,
if someone changes the signature on the transaction,
it wonât affect the transaction id.
This in effect solves the transaction malleability issue....
you know...Bob.
Second, it shrinks down the base transaction data.
Since the witness data takes up to 65% of the transaction size,
moving it outside of the base transaction block
allows more transactions to fit inside that 1mb block.
I know what youâre probably thinking.
If Segwit is in fact a block size increase,
why not just increase the block size to 4mb in the first place?
Why all of this hassle and block size debate
if the end result is in fact bigger blocks.
The answer is really quite simple -
developers wanted to avoid a contentious hard fork
in the Bitcoin network.
You see, Bitcoinâs protocol specifically states that
blocks canât exceed 1mb.
So, developers had to find a solution
that will allow the network to accept both Segwit and Non Segwit blocks
if a hard fork were to be avoided.
The solution of a 1mb block with an âextensionâ of another 3mb
is something that is still acceptable under the existing protocol.
Legacy nodes receive only the 1mb base transaction block
without the extended block.
They still consider them valid.
Segwit nodes receive both the base and extended block
(up to 4mb in total)
and can validate the transactions in full.
This backwards compatibility is also known as a soft fork.
This approach is a lot less risky
since it doesnât require nodes to update their software to support Segwit.
It means that even if it takes years for all of the nodes to upgrade,
the network will still function.
Now letâs move on to how Segwit blocks are measured by miners.
While legacy blocks are measured in size,
Segwit blocks are measured in weight.
Block Weight is a new concept introduced in Segwit,
and itâs calculated on a per-transaction basis.
Each transaction has a âweightâ which is defined this way:
The size of your Base Tx
(meaning that which doesnât include the witness data) *3
+ the Full Tx size, that = your transaction weight.
Legacy transactions
donât have the ability to strip away the witness data from the base transaction,
so their weight will always be 4 times the tx size.
For example, a legacy TX of 1000 bytes
will have a weight of 1000*3 + 1000 = 4000.
Segwit transactions, on the other hand,
are going to have a weight of less than 4 times the tx size.
For example,
a 1200 byte Segwit transaction comprised of 400 bytes of witness data
will have a weight of
(1200 (the total transaction size)-400 (the size of the witness data))
leaving the base transaction size of 800, times 3,
making 2400,
add the total transaction size of 1200, and that = 3600.
In short,
the larger the size of the witness data, the lighter the tx weight will be.
This incentivizes miners to prefer âlighterâ Segwit transactions
over âheavierâ ones,
since they can fit more of them inside a base transaction block,
which increases the potential minerâs fee,
should that block be accepted and confirmed.
While in theory Segwit transactions can create a block up to 4mb in size,
in practice the average block size that includes Segwit transactions
is around 2mb.
Today, almost 50% of all Bitcoin transactions
are Segwit transactions.
Since legacy transactions are larger in size,
they require higher network fees to get confirmed faster.
And finally,
Segwit addresses start with a â3â while legacy addresses start with a â1â.
Thanks to its advantages,
more and more popular wallets and exchanges support Segwit.
Ledger, TREZOR, Electrum, Exodus and Coinomi
are just some of the major wallet brands
that have already adopted Segwit.
Itâs important to note that if you have a legacy wallet
and you want to move to a Segwit wallet
you will need to create a brand new Segwit wallet
and move all of your funds to its address.
Thereâs no way to just upgrade your existing legacy wallet
to work with Segwit.
Segwit is the first of many upgrades
that will gradually allow for Bitcoin to scale for mass adoption.
Itâs a fundamental change that will allow further developments
down the road
like the Lightning Network, Schnorr Signatures and more.
As more and more wallets adopt Segwit,
it will soon become the standard for any Bitcoin transaction.
Well, thatâs it for todayâs episode of Crypto Whiteboard Tuesday.
Hopefully by now you understand what Segwit is -
An upgrade to the Bitcoin protocol
that Segregates the witness data from the base transaction data,
hence achieving a smaller transaction size,
securing transactions from malleability issues and more.
You may still have some questions.
If so, just leave them in the comment section below.
And if youâre watching this video on YouTube,
and enjoy what youâve seen,
donât forget to hit the like button.
Then make sure to subscribe to the channel
and click that bell so that youâll be notified
as soon as we post new episodes.
Thanks for watching me here at the Whiteboard.
For 99bitcoins.com, Iâm Nate Martin,
and Iâll see youâŠin a bit.
Voir Plus de Vidéos Connexes
What is Bitcoin Cash? - A Beginnerâs Guide
Bitcoin Fees and Unconfirmed Transactions - Complete Beginner's Guide
What is Monero? A Beginnerâs Guide
Bitcoin Transactions - from "Send" to "Receive"
How to Keep Your Bitcoins Safe? avoiding scam, theft and fraud (2024 Updated)
Bitcoin Explained Simply for Dummies by: 99Bitcoins
5.0 / 5 (0 votes)