Bitcoin Forum
May 13, 2024, 03:49:05 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: I still don't get transaction malleability.  (Read 169 times)
lordbelford (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 17


View Profile
July 14, 2022, 10:28:05 AM
Merited by o_e_l_e_o (4), NotATether (4), BlackHatCoiner (4), vapourminer (2), NeuroticFish (1), pooya87 (1), DdmrDdmr (1)
 #1

I'm trying to understand transaction malleability in Bitcoin (before SegWit solved it).

Every explanation of it reads the same and basically says "Bob alters the signature of Alice's transaction before it gets confirmed, thus producing a new transaction ID".

But what does changing a transaction actually mean? How do I approach that? Saying you grab a transaction from the mempool and flipping its bits really does not provide the explanation for me.

Looking forwards to your replies Smiley
1715615345
Hero Member
*
Offline Offline

Posts: 1715615345

View Profile Personal Message (Offline)

Ignore
1715615345
Reply with quote  #2

1715615345
Report to moderator
1715615345
Hero Member
*
Offline Offline

Posts: 1715615345

View Profile Personal Message (Offline)

Ignore
1715615345
Reply with quote  #2

1715615345
Report to moderator
1715615345
Hero Member
*
Offline Offline

Posts: 1715615345

View Profile Personal Message (Offline)

Ignore
1715615345
Reply with quote  #2

1715615345
Report to moderator
Every time a block is mined, a certain amount of BTC (called the subsidy) is created out of thin air and given to the miner. The subsidy halves every four years and will reach 0 in about 130 years.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10558



View Profile
July 14, 2022, 11:02:50 AM
Merited by o_e_l_e_o (4), BlackHatCoiner (4), ABCbits (2), vapourminer (1)
 #2

You can't practically perform any of the cases and create a duplicate valid transaction simply because all of the possible cases that are outlined in BIP62 are prohibited through the enforcement of standard rules. What SegWit did was to enforce some of those rules as part of the consensus rules.
In simple terms when you broadcast the modified transaction, any full node receiving it will reject it as non-standard.

Saying you grab a transaction from the mempool and flipping its bits really does not provide the explanation for me.
What exactly are you looking for, a walkthrough or an example?
The simplest way would to take a transaction spending a P2PKH output and injecting an arbitrary message at the beginning of its signature script.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
lordbelford (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 17


View Profile
July 14, 2022, 11:24:50 AM
 #3

What exactly are you looking for, a walkthrough or an example?
The simplest way would to take a transaction spending a P2PKH output and injecting an arbitrary message at the beginning of its signature script.

Just a technical explanation. I don't get how you would "take a transaction". In my understanding, an unconfirmed transaction exists on a multitude of miners working to find a new block. So that only works for me if we are the miner ourselves and also successful in finding the block that ultimately prevails in the blockchain.
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10558



View Profile
July 14, 2022, 12:08:55 PM
Merited by NeuroticFish (3), ABCbits (3)
 #4

Just a technical explanation. I don't get how you would "take a transaction". In my understanding, an unconfirmed transaction exists on a multitude of miners working to find a new block. So that only works for me if we are the miner ourselves and also successful in finding the block that ultimately prevails in the blockchain.
Transactions are relayed through the network and eventually reach the node that the miner uses (in other words you don't directly send your transaction to the miner, you send it to node A that sends it to node B that sends it to ... and eventually sends it to Node X that the miner connects to). So anybody in this process is getting the transaction and can modify it before relaying it to the other node.

Obviously as you may have already guessed, only one of these transactions could be confirmed. One problem could have been if the sender was watching the transaction ID of the first tx they'd sent themselves but was replaced by a modified tx with a different ID when it reached the miner. If the second tx confirmed the first one never would so the sender could be fooled into thinking that the receiver hasn't received the funds and send them again.
This is simply solved if the sender watches the mempool and sees the modified tx or their own inputs/balance and obviously solved by the fact that the modified transaction is non-standard and won't propagate.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
BlackHatCoiner
Legendary
*
Online Online

Activity: 1512
Merit: 7364


Farewell, Leo


View Profile
July 14, 2022, 02:06:11 PM
Merited by vapourminer (2), NeuroticFish (2), ABCbits (1)
 #5

Every explanation of it reads the same and basically says "Bob alters the signature of Alice's transaction before it gets confirmed, thus producing a new transaction ID".
Altering the signature (specifically replacing the high s value with the low s value) is just one way of changing the transaction ID without invaliding the transaction. You can check other ways in: https://en.bitcoin.it/wiki/BIP_0062#Motivation.

The key to understanding transaction malleability is that:
  • OP_CHECKSIG doesn't take into account the entire scriptSig, as it only expects two values; public key & signature.
  • ECDSA is itself malleable, even if you are not the sender.
  • Sender can create unlimited valid signatures for the same message.

Note that being non-standard (that is said above) doesn't mean that the transaction is invalid. Full nodes just choose to not relay it.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5829


not your keys, not your coins!


View Profile WWW
July 14, 2022, 11:44:49 PM
Merited by NeuroticFish (2), pooya87 (2), ABCbits (2), BlackHatCoiner (2), vapourminer (1), DdmrDdmr (1)
 #6

You can't practically perform any of the cases and create a duplicate valid transaction simply because all of the possible cases that are outlined in BIP62 are prohibited through the enforcement of standard rules. What SegWit did was to enforce some of those rules as part of the consensus rules.
In simple terms when you broadcast the modified transaction, any full node receiving it will reject it as non-standard.

Note that being non-standard (that is said above) doesn't mean that the transaction is invalid. Full nodes just choose to not relay it.
Both are correct, but fail to mention that it is possible to practically perform this, in the rare occasion that you're a big solo miner and / or a mining pool operator that builds block candidates.
While full nodes wouldn't relay such transactions, such large miners could perform this 'attack', altering transactions before attempting to mine them into a block, resulting in correct blocks. However, software monitoring the transaction through its ID would fail to pick up that it was mined.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
odolvlobo
Legendary
*
Offline Offline

Activity: 4312
Merit: 3214



View Profile
July 15, 2022, 06:05:45 AM
Merited by vapourminer (1), PowerGlove (1)
 #7

Every explanation of it reads the same and basically says "Bob alters the signature of Alice's transaction before it gets confirmed, thus producing a new transaction ID".

In short, it is possible to make valid copy of a transaction by modifying a signature in a certain way, and the copy has a different transaction ID. Now, that is not a problem for Bitcoin because only one of the copies will make it into the block chain and the others will be forgotten. The problem occurs in software that monitors transactions using the transaction ID.

For example, suppose a customer of an exchange wants to withdraw some bitcoins. The exchange creates a transaction and records the transaction ID. Normally, the exchange debits the customer's account when it sees the transaction ID in a block. However, if a copy of the transaction with a different transaction ID is included in the block instead, then the exchange doesn't know that the bitcoins were received and it won't debit the account as it should.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
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!