FixedFloat Blog

Our news, cryptocurrencies guides and tutorials

Replacing and canceling Bitcoin transactions

What is the Replace by fee?

A situation arises when you want to cancel or replace a transaction. This may be due to the fact that transactions do not enter the block for a long time. All operations that were not added to the block after launch are considered unconfirmed. Unconfirmed transactions most often happen precisely because of the low fees. Such transactions still have the ability to become processed.

In the blockchains Bitcoin, Ethereum and others, there is a mechanism that allows you to replace an unconfirmed transaction with another transaction with a higher fee. This mechanism is called Replace by Fee.

Accelerating transactions by increasing fees

The replacement of transactions was envisaged by the creator of the system, Satoshi Nakamoto, but turned off at a certain moment. It was then modified to RBF and included in Bitcoin Core 0.12 and older. For replacement, a special nSequence field is provided in the transaction data, which signals which transaction is older. For a transaction to be potentially replaceable, the nSequence must be less than (0xffffffff - 1).

By default, most modern wallets nSequence immediately set the maximum, and the ability to replace transactions must be enabled in the settings.

Replace by fee adds a new fee to an existing transaction. During the creation of a transaction, the wallet adds a comment, which indicates the right to change the commission after the transfer is queued for processing. For this, for example, the Electrum wallet has an add-on "edit fees manually" and also "replace by fee".

Before sending coins, you need to make sure that the "replaceable" option is enabled in the wallet. If the transaction is not confirmed for a long time, you can increase the payment transfer. Select a stuck transaction in the wallet history and set a new additional fee.

By activating the RBF option, you inform the networks that you are ready to pay more in the event of a delay, and the new transfer is automatically accepted instead of the old one. Bitcoin wallets Bitcoin core, Electrum and Green Address have such a function.

Speeding up a transaction with Child Pays for Parent

Most transactions not only send BTC to the recipient but also return "change". This change can be spent on the next transaction. The CPFP function can be used by both the sender and the recipient of funds.

A new transaction (for example, between your addresses) with a high fee is attached to the expected transaction with a low fee. Some wallets allow you to do this even before the transaction is confirmed. Thus, for these two transactions, the total commission will be taken into account, on the value of which the speed of inclusion of a bundle of transactions into a block will depend.

If the wallet does not allow the use of unconfirmed change, you can send yourself all the funds that are in the wallet.

Not all miners support CPFP at the moment. However, they are enough for your transaction to be confirmed in the next blocks.

Canceling a transaction

If the Bitcoin transaction is confirmed, then the cancellation is not possible. But if the transaction has no confirmations, then you can do this in the following way: send a repeated payment from the same address output to any of your addresses, but with a higher fee than the previous transaction. The first will be the transaction that has the higher fee, and the second is automatically liquidated.