Segregated Witness, Segwit - Discussion

In segwit the witness data or the unlocking script within a tx was removed from the block data so only the public key hash remained :slight_smile:

2 Likes

Where are the signatures stored, since it was removed from the transaction data structure? Is there a separate data structure? What I conceived from the video is that the signatures are stored in a query, waiting to be confirmed by a full node or Miner… Is this right?

Yes the signatures are stored in a separate data structure and nodes don’t need to store them but can query a node that has the signature :slight_smile:

2 Likes

Thanks you for the confirmation. I needed to triple check.

1 Like

The goal of Segwit was to create a soft fork by contracting the rules rather than Expending them. the way that was achieved was to put the signature outside of the block and the TX ID would be the hash of txs. in the block excluding the sig. Therefore fixing the problem of maleability. Now the nodes have to differentiate between the old type Tx. and the segwitTx. and that was achieved by implementation of a simpler script which only the updated nodes can interpret and verify. All this contributes to a drastic reduction of the block size by reducing size of signature and locking script. Now updated nodes and non updated node can have their blocks accepted on the chain to create a backward compatibility where new blocks (segwit blocks) are accepted alongside (legacy blocks).

1 Like

in segwit videos you was saying that the signatures was removed from the blockchain but where are the signatures stored now?

They are part of a separate data structure that some nodes may opt in to store :slight_smile:

1 Like

how this nodes are motivated to store it?

I’m sorry I was wrong.
Yes segwit nodes are required to store the witness data, but old nodes are not required to store them which is what makes them backwards compatible.
So in a sense Segwit did increase the block size (and also didn’t):


Again sorry for this, I should have double check.
2 Likes

how were the nodes motivated to be segwit compatible?

It seems to me that Bob does not try to change the actual signature, just the format it is written in or the “fluff” around it? It this correct?

The upgrade was necessary for everyone that wanted to create segwit txs, so you had to upgrade to be able to use segwit features.

1 Like

I’m confused: why is HF = expansion of rules? If rules are expanded, previously allowed transactions are still allowed right? That seems to be backward compatible which is a SF.

Kind of. One could switch the order in the unlocking script a bit, resulting in a different txid.

2 Likes

It kind of depends on the type of the upgrade. The example of larger and smaller blocks is used as a simplified example that is easy to understand.
Forks are not necessarily related to transactions. In case of an increased block size hard fork, transactions remain the same, but old nodes will reject these blocks because they don’t confirm to their consensus of blocks size (the block is to large).
In soft forks like Segwit the block size remained the same and the new type of transaction is still valid according to non updated nodes (they see this transaction as being “spendable by all” and will accept it as valid).

1 Like

Hey Filip,

My question is about the signatures: if signatures removed from transaction ID (which is stored on the blockchain), then where are the signatures stored? If it is still part of the blockchain, the size reduction is not fulfilled. If it is not part of the blockchain, how can it be queried by smaller nodes?

Many thanks for your help!

Best wishes,

Tamas

1 Like

The signature is stored in a separate data structure that is not part of the block but all segwit enabled nodes have it. Smaller nodes query these nodes to get the signature.

3 Likes

What I didn’t get in the Transaction malleability lesson, how could Bob just go in and change a signature that wasn’t his transaction? Wouldn’t the transaction be signed with Alice’s private key?

Many thanks Alko89! :slight_smile:

Alice creates a signature of the unlocking script that allows her to spend the Bitcoin locked in the UTXO, this is the input of the transaction and only a part of it. The rest of the transaction is serialized and hashed to get the txid.
The reason Bob can then change the id is because he can make changes to the locking scrpit which (also called a witness) like inserting an OP_DROP at the end of it which does nothing but it does chane the txid. To learn this in more detail I recommend the Bitcoin programming course in the academy :slight_smile:

3 Likes