<p>The <code>incrementalfee</code> actually indicates a feerate in ₿/kvB. Translated 0.00001 ₿/kvB are 1 ṩ/vB. A replacement transaction must both at least match the sum of absolute fees of the replaced transactions and surpass the feerate of each replaced transaction by the <code>incrementalfee</code>.</p>
<p>Since the <code>incrementalfee</code> is 1 ṩ/vB and the original transaction paid 10 ṩ/vB, your replacement transaction must pay at least a feerate of 11 ṩ/vB. Since the original transaction paid 10 ṩ/vB × 200 vB = 2000 ṩ in absolute fees, the replacement must pay at least 2000 ṩ. As the replacement transaction in your example is the same size as the original, the replacement would need to pay 2200 ṩ to achieve 11 ṩ/vB.</p>
<p>Let’s say your original transaction of 200 vB paying 2000 ṩ (10 ṩ/vB) had a child transaction of 10,000 vB paying 10,000 ṩ (1 ṩ/vB), and your replacement transaction had only 100 vB.<br />
The replacement transaction would need to pay at least 11 ṩ/vB (1100 ṩ), but also pay more fees than the replaced transactions together (10,000 ṩ + 2000 ṩ = 12,000 ṩ). So in this case, the replacement transaction would end up paying 120 ṩ/vB (12,000 ṩ / 100 vB).</p>

CC BY-SA 4.0
2023-08-17T01:17:42.067Z
Thanks for your help! Can you tell me where to find related documents?
John Smith
CC BY-SA 4.0
2023-08-17T02:35:31.023Z
RBF was originally described in [BIP125](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki). You may also find useful the first section of [Glozow’s RBF Improvement Gist](https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff), the [opt-in RBF FAQ](https://bitcoincore.org/en/faq/optin_rbf),  the [RBF topic](https://bitcoinops.org/en/topics/replace-by-fee/) on the Optech site, and perhaps the list of [frequent questions about RBF](https://bitcoin.stackexchange.com/questions/tagged/replace-by-fee?tab=Frequent) here on BSE
Murch
CC BY-SA 4.0
2023-08-16T15:15:31.510Z
2023-08-16T19:22:57.803Z
2023-08-16T19:22:57.803Z
Murch
<p>Suppose I just sent Tx1, which has length of 200 bytes and fee rate of 10 satoshi/byte, totaling fee 0.00002 BTC. Now I replace it with Tx2 that has the same count of inputs and outputs, and also has a length of 200 byetes. The <code>relayfee</code> and <code>incrementalfee</code> returned by RPC <code>getnetworkinfo</code> are both 0.00001.</p>
<p>How can I calculate the fee for Tx2? I found that the existing docs are too vague about this.</p>

<transaction-fees><replace-by-fee>
How to properly calculate fee for RBF transaction?
John Smith
# How to properly calculate fee for RBF transaction?

(Asked by: username_0 on 2023-08-16)

Suppose I just sent Tx1, which has length of 200 bytes and fee rate of 10 satoshi/byte, totaling fee 0.00002 BTC. Now I replace it with Tx2 that has the same count of inputs and outputs, and also has a length of 200 byetes. The `relayfee` and `incrementalfee` returned by RPC `getnetworkinfo` are both 0.00001.

How can I calculate the fee for Tx2? I found that the existing docs are too vague about this.

**Tags:** transaction-fees, replace-by-fee


---

## 1 answers

### Answer by username_1 on 2023-08-16. Score: 0 | Accepted answer

The `incrementalfee` actually indicates a feerate in ₿/kvB. Translated 0.00001 ₿/kvB are 1 ṩ/vB. A replacement transaction must both at least match the sum of absolute fees of the replaced transactions and surpass the feerate of each replaced transaction by the `incrementalfee`.

Since the `incrementalfee` is 1 ṩ/vB and the original transaction paid 10 ṩ/vB, your replacement transaction must pay at least a feerate of 11 ṩ/vB. Since the original transaction paid 10 ṩ/vB × 200 vB = 2000 ṩ in absolute fees, the replacement must pay at least 2000 ṩ. As the replacement transaction in your example is the same size as the original, the replacement would need to pay 2200 ṩ to achieve 11 ṩ/vB.

Let’s say your original transaction of 200 vB paying 2000 ṩ (10 ṩ/vB) had a child transaction of 10,000 vB paying 10,000 ṩ (1 ṩ/vB), and your replacement transaction had only 100 vB.  
The replacement transaction would need to pay at least 11 ṩ/vB (1100 ṩ), but also pay more fees than the replaced transactions together (10,000 ṩ + 2000 ṩ = 12,000 ṩ). So in this case, the replacement transaction would end up paying 120 ṩ/vB (12,000 ṩ / 100 vB).

> **Comments:**
> **username_0**: Thanks for your help! Can you tell me where to find related documents?  
> **username_1**: RBF was originally described in [BIP125](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki). You may also find useful the first section of [Glozow’s RBF Improvement Gist](https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff), the [opt-in RBF FAQ](https://bitcoincore.org/en/faq/optin_rbf),  the [RBF topic](https://bitcoinops.org/en/topics/replace-by-fee/) on the Optech site, and perhaps the list of [frequent questions about RBF](https://bitcoin.stackexchange.com/questions/tagged/replace-by-fee?tab=Frequent) here on BSE  

---

