What is SegWit
Segregated Witness, commonly abbreviated as SegWit, is a Bitcoin improvement proposal designed to bypass the block size limit and increase transaction malleability through a soft fork. Unlike a hard fork, which would result in two separate chains being formed, SegWit does not involve a hard fork and therefore avoids the creation of two conflicting blockchains.
How Does it Work?
In order to understand how SegWit works, we must first understand how Bitcoin transactions work in the first place. When Bitcoins are sent from one wallet to another, the sender must first sign the transaction using their private key (this becomes the witness part of the transaction). Once this is done, the transaction is sent off to the Bitcoin network for verification. Once it reaches the network, miners verify the transaction using the transaction signature and permanently place a record of that transaction on the next block.
In a SegWit transaction, things work slightly differently. When the sender signs the transaction, nodes can strip the witness part of the transaction from the rest of the transaction (if possible). This allows more transactions to be verified in each block, and by splitting the transaction blocks can effectively store 2 MB of transactions.
Why do we need SegWit?
Currently, the Bitcoin block size is capped at 1 MB. However, with the removal of verification signatures from blocks using SegWit, the block size can indirectly be increased to 2 MB per block. In the last few years (specifically at the end of 2017), Bitcoin transactions skyrocketed and caused transaction fees and confirmation times to increase to unacceptable levels. With SegWit, block size can be indirectly increased, which will lower transaction confirmation times and fees as a result. Because of the current lack of consensus in the Bitcoin community on how to address scalability, SegWit is a good first step to addressing the scalability problem without forcing a hard fork of the network.
Sources: