Alapt

Cryptocurrency news

How to speed up a bitcoin transaction with the Replace-By-Fee function

How to speed up a bitcoin transaction with the Replace-By-Fee function

The number of bitcoin users and transactions is constantly growing, which, along with other factors, creates an additional load on the network. Miners often do not have time to process all transactions, they accumulate in the queue and the confirmation time increases significantly.

If during the origin of bitcoin, almost any transaction took place within 10 minutes, and the network Commission was absent, now you sometimes have to wait for hours or days for confirmation. There is no hope for an improvement in the situation in the near future, since. demand for bitcoin continues to grow. In this article, you will learn what determines the time of the transaction and how you can speed up a suspended transaction in bitcoins.

The factors that affect the speed of a transaction in BTC are described below.

The “weight” of a transaction

Each planned transaction in bitcoins has a certain “weight” in bytes, which directly affects the amount of Commission required for quick confirmation.

The “weight” of The transaction includes (on the right, the approximate number of bytes):

each of the inputs (addresses from which crypto assets came): ~148 bytes

each of the outputs (addresses to which crypto assets are transferred): ~34 bytes

The transaction itself: ~10 bytes.

That is, if 1 BTC came to you from ten addresses, then the number of inputs is determined as follows: Input (in bytes) = 148*10 = 1480 bytes.

The number of outputs (output) is calculated similarly, you also need to remember about the “change”. If you send part of the available coins to 1 address, the change will be returned to your wallet. Thus, the number of outputs will be at least two: one for sending and one for delivery. There will be no change if the amount sent in BTC is exactly the same as the amount of one or more inputs. By adding up all the parameters, the user can determine the number of bytes, that is, the “weight” of the transaction.

Mempool and transaction speed

Each transaction in bitcoins must be confirmed by miners who receive a Commission for it. The user or wallet program determines the actual cost of transferring the amount of data in the network (Satoshi/byte), forms a transaction and sends it to the network, as a result, it will get to the miners in the mempool.

Further, all transactions in mempool are ranked depending on the amount of Commission charged and form a queue for confirmation. Therefore, the speed of confirmation depends on the total number of transactions and the amount of Commission: the higher in the queue it is, the faster it will be included in the block.

How to determine the optimal size of the Commission

From the above, it becomes clear that for a quick transaction, the Commission set by the user (wallet) when sending it plays a key role. The total transaction fee will be the product of the “weight» transactions for the cost of transferring the amount of data in the network (Satoshi per byte). And if the “weight” of a transaction is a constant value, then the price in Satoshi per byte is dynamic and, by and large, has a market nature – the higher the demand for transactions, the higher the cost of confirmation per byte of information.

For example, a transaction of 374 bytes at a cost of 138 Satoshi/byte will cost 374*138=51612 Satoshi, or 0.00051612 BTC, or$ 5.16 at a bitcoin price of $10,000.

You can always view the current cost per byte in the block browser, for example, in
Blockchair. It is worth noting that the Commission in the Bitcoin network does not depend on the amount sent, that is, you can send both 0.001 BTC and 10 BTC with the same Commission.

Different services offer different ways to pay users a network Commission. Some immediately set a fixed Commission, which is often higher than the current one, while others shift the decision to the user. For example, in
Trustee Wallet, the user is offered three types of Commission, as well as the ability to set the network Commission manually.

When sending, the user can choose any of the proposed fees, of course this will directly affect the speed of the transaction – Slow, Medium, Fast. The options show the price per byte, the cost of the Commission in bitcoin and Fiat($).

These options are automatically calculated by the app based on individual information about “weight» transactions and current network load, which is taken from public sources. In the same tab, you can set the Commission manually, and the user can set any value, either higher or lower than the recommended one. After selecting the Commission, just click Submit and the transaction will be sent to the mempool.

It is worth noting that the recommended Commission is calculated by the application at the time of creating the transaction, so if there is a surge in activity during the formation of a new block in the network, the transaction may move in the queue — it will be pushed back by more attractive transactions for miners. With a small network load, the transaction will simply get to the next block, that is, it will be confirmed in 5-30 minutes, in the worst case, in a few hours. However, in moments of sharp activity, with sharp changes in the bitcoin exchange rate, the Commission can grow instantly several times and for a long time. In this case, the transaction may hang for several hours or days, which is quite unpleasant, since the coins remain blocked all this time.

Variants of events when “hanging» transactions

There are the following options:

wait for confirmation (this may take days, weeks, or even forever);

wait for the transaction to be canceled. This happens when most miners decide to “throw” a transaction out of the mempool. After that, bitcoins become free and can be used again (there is no exact time when this will happen, but according to statistics, this process takes at least 3 days);

increase the Commission in an already created transaction while it is in the mempool (Replace-By-Fee function).

So, Replace-By-Fee (RBF) is editing an existing transaction that is located in a mempool. This means that the new transaction will use the same parameters (inputs and outputs) as the old one, but the Commission will be changed. Bitcoin network nodes perceive the edited transaction as old and it is transferred in the mempool queue to more attractive positions for miners.

Thus, if the transaction is “stuck” due to a small Commission, the best way to speed up the transaction is to use this function.

How to use the Replace By Fee function

In fact, the Replace-By-Fee feature is available in a limited number of cryptocurrency wallets. The order of action is almost the same for everyone. here we will consider the process of speeding up a transaction using the example of a Trustee Wallet.

By default, all outgoing transactions with BTC in Trustee can be accelerated. However, before sending bitcoin, it is better to check this add-on. To do this, go to settings in the Bitcoin tab and check that “editing unconfirmed transactions ” is active. It is also recommended to activate “Use unconfirmed transactions” – this will allow you to use incoming bitcoins that have not yet been confirmed by the network, as well as send a queue of outgoing transactions (one after another).

Since the RBF function is currently in test mode and is still being developed by Trustee specialists, it needs to be activated. To do this, perform a simple action:

on the home screen, tap and hold the “Add asset” button until a special notification appears. After that, the RBF function becomes active.

Commission change process: Go

back to the transaction history (Bitcoin tab);

Select the desired “frozen” transaction and click “Increase Commission”

In the tab that opens, set the current price per byte manually or from the suggested options. You can check the current price on the browser’s website.

Click “Send”. The notification “Your transaction was sent successfully” means that the Commission increase was successful.

Now the transaction details will contain two hashes, one old (inactive), and the other current, with an increased Commission. This once again confirms the reliability of the Bitcoin Protocol and the absence of “double spending” when increasing the Commission.

Note that the blockchain is a chain of data, and each transaction refers to the previous one. If you have several “frozen” transactions, then you need to speed up the last one sent. In this case, the Commission must be set taking into account the acceleration of all “frozen” transactions – that is, the actual price per byte is multiplied by the number of transactions.

It is also recommended to use Segwit addresses for receiving and sending bitcoins (starting with bc1 or 3), so transactions will be cheaper than with Legacy addresses (starting with 1).

Author of article: Mikhail Kutsenko, Deputy Director for business development at Trustee Wallet.