The malleability of transactions again affects the entire Bitcoin network. In general, this leads to confusion and seemingly duplicate transactions until the next block is dismantled. This can be seen as follows:
- Your original transaction is never confirmed.
- Another transaction is displayed in which the same amount of coins goes to and from the same addresses. This has a different transaction ID.
This different transaction ID is often confirmed, and certain block explorers display warnings that the original transaction is duplicated or otherwise invalid.
Ultimately, however, only one transaction should be confirmed with the correct number of bitcoins sent. If no or more transactions are confirmed, this is probably not directly related to the malleability of transactions.
However, it was found that some transactions were sent that were not mutated and were not confirmed. This is because they are dependent on a previous entry, which is also not confirmed.
For Bitcoin transactions, inputs (which can be viewed as "within" a Bitcoin address) have to be made and then changed again. For example, if I had a single entry of 10 BTC and wanted to send 1 BTC to someone, I would create a transaction like this:
10 BTC -> 1 BTC (for the user) and 9 BTC (for myself)
In this way, there is a kind of chain that can be created for all bitcoins from the first mining transaction.
When Bitcoin Core makes a transaction like this, it trusts that it will get the 9 BTC change back, and that will be because it generated this transaction itself, or at least the entire transaction is not confirmed, but nothing is lost. It can send this 9 BTC immediately in another transaction without waiting for this to be confirmed as it knows where the coins are going and knows the transaction information on the network.
However, this assumption is wrong.
If the transaction is mutated, the Bitcoin core may try to create a new transaction with the 9 BTC change, but based on incorrect input information. This is because the actual transaction ID and associated data in the blockchain have changed.
Therefore, Bitcoin Core should never trust itself in this case and should always wait for confirmation of the change before sending the change.
Bitcoin exchanges can configure their primary Bitcoin node so that changes with zero confirmations can no longer be taken into account in any Bitcoin transaction. This can be configured by running bitcoind with the option -spendzeroconfchange = 0.
However, this is not enough and this can result in transactions not being able to be sent because there are not enough entries with at least one confirmation to send a new transaction. Therefore, we also run a process that does the following:
- Checks available, not output but confirmed entries by calling bitcoin-cli listunspent 1.
- If there are fewer than x inputs (currently twelve), proceed as follows:
- Find the entrance for about 10 BTC.
- Think about how you can split this into as many 1 BTC transactions as possible and leave enough room for a fee.
- Call bitcoin-cli sendmany to send these ~ 10 BTC inputs to about 10 output addresses, all of which belong to the Bitcoin marketplace.
In this way, we can convert a 10 BTC input into approximately 10 1 BTC inputs that can be used for further transactions. We do this when we run out of entrances and twelve are left.
These steps ensure that only transactions with fully confirmed entries are sent.
However, one problem persists – before we implemented this change, some transactions were sent that are based on mutated changes and are never confirmed.
We are currently looking for the best way to resend these transactions. We will likely zap the transactions out of peak times, although we want to list all the transactions that we think should be zapped in advance, which will take some time.
An easy way to reduce the likelihood that malleability is a problem is to connect your Bitcoin node to as many other nodes as possible. In this way, you "call out" your new transaction and it will become popular very quickly, which probably means that any mutated transaction will drown and be rejected first.
There are some nodes that already contain an anti-mutation code. These can recognize mutated transactions and only forward the validated transaction. It is useful to connect to trusted nodes like this, and it is worth thinking about implementing it (which of course involves its own risk).
All of these formability issues will not be a problem once the BIP 62 extension for Bitcoin is implemented, making the formability impossible. Unfortunately, this is a long way off and there is currently no reference implementation, let alone a plan for migrating to a new block type.
Although only brief considerations have been made, future versions of Bitcoin software may be able to detect whether formability has occurred when making changes, and then do one of the following:
- Mark this transaction as declined and remove it from your wallet as we know it will never be confirmed (potentially risky, especially if it is a reorg). You may need to inform the node owner.
- An attempt is made to "repackage" the transaction, i. H. Use the same parameters from and, but with the correct input details from the change transaction as accepted in the block.