Bitcoin Forum
May 13, 2024, 12:58:02 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Is witness script itself malleable?  (Read 128 times)
polaker (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 3


View Profile
January 27, 2020, 04:00:30 PM
Merited by ABCbits (1)
 #1

With segwit, now the transaction id is not malleable. However, I could still modify the witness part during relaying and make the modified transaction still valid. Am I missing something here?

A potential attack is to make the block size larger by making the witness script larger?
1715605082
Hero Member
*
Offline Offline

Posts: 1715605082

View Profile Personal Message (Offline)

Ignore
1715605082
Reply with quote  #2

1715605082
Report to moderator
1715605082
Hero Member
*
Offline Offline

Posts: 1715605082

View Profile Personal Message (Offline)

Ignore
1715605082
Reply with quote  #2

1715605082
Report to moderator
Make sure you back up your wallet regularly! Unlike a bank account, nobody can help you if you lose access to your BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715605082
Hero Member
*
Offline Offline

Posts: 1715605082

View Profile Personal Message (Offline)

Ignore
1715605082
Reply with quote  #2

1715605082
Report to moderator
1715605082
Hero Member
*
Offline Offline

Posts: 1715605082

View Profile Personal Message (Offline)

Ignore
1715605082
Reply with quote  #2

1715605082
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
January 27, 2020, 04:39:04 PM
Merited by ABCbits (2)
 #2

Yes, the scriptWitness is malleable.

While you could malleate a transaction to be larger, I'm not sure why you would. You can't change the fee that is paid by that transaction, so your malleated one would have a lower fee rate than the original, so it would most likely be rejected in favor of the original. That also means that the malleated transaction is less likely to show up in a block than the original transaction. Additionally, such malleation would make the transaction non-standard, so most nodes would discard it regardless of whether they had seen the original.

polaker (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 3


View Profile
January 27, 2020, 04:56:44 PM
Merited by ABCbits (1)
 #3

Yes, the scriptWitness is malleable.

While you could malleate a transaction to be larger, I'm not sure why you would. You can't change the fee that is paid by that transaction, so your malleated one would have a lower fee rate than the original, so it would most likely be rejected in favor of the original. That also means that the malleated transaction is less likely to show up in a block than the original transaction. Additionally, such malleation would make the transaction non-standard, so most nodes would discard it regardless of whether they had seen the original.

Since the original transaction and the malleated transaction have the same transaction id, the mempool will accept the first it receives, right? Will mempool compare the fee rate for transactions with the same id?

Users do not have any motivation to malleate the transaction. Just some malicious relaying node could do that. I admit that it's not a big issue in practice.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
January 27, 2020, 06:58:57 PM
Merited by ABCbits (1)
 #4

Since the original transaction and the malleated transaction have the same transaction id, the mempool will accept the first it receives, right? Will mempool compare the fee rate for transactions with the same id?
Ah, yes, that's right. Because they have the same txid, they would be treated as the same transaction even though the contents are different. So if a node received the malleated one first, it would ignore the correct one later, and vice versa.

gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4172
Merit: 8420



View Profile WWW
January 27, 2020, 07:01:10 PM
Merited by ABCbits (1)
 #5

The fact that witnesses are push only makes the witnesses for many common scripts non-malleable, but you're correct for other scripts.

One of the motivations for annex in taproot is being able to later add a field that sets the weight of a transaction (which must be greater than or equal to the actual weight) which gets covered by a signature to address the point you were thinking of, among other reasons.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!