<p>So far as I can tell, it doesn't matter whether some software uses vbytes or weight to calculate a fee.</p>
<p>Neither the network nor the blockchain store fee rates. Even fees per transaction are implicit rather than explicit.</p>
<p>I believe some fee related rules such as minimum fee for relaying are node specific and don't affect consensus.</p>
<p>Fee rates are not fixed, each node is free to make its own estimates. Fees are simply a bid in a repeating auction of  block space so rounding errors don't matter much.</p>
<p>That auction is conducted by miners who want to maximise revenue while keeping within block size limits. If those size limits are expressed in weight units (WU), that is what I presume miners would be wise to use in calculations.</p>
<p>I don't know of any broader problem that would arise if some software estimates fee rates using floating point arithmetic based on vbytes while other software estimates fee rates using integer arithmetic based on weight.</p>
<hr />
<p>Related:</p>
<ul>
<li><a href="https://bitcoin.stackexchange.com/q/98810/13866">What&#39;s the blocksize limit after segwit and how do legacy nodes deal with segwit transactions?</a></li>
</ul>
<blockquote>
<p>Before the activation of segwit, the block was limited to 1,000,000 bytes. This limit got replaced by a blockweight limit of 4,000,000 weight units (WU) with the activation of segwit.</p>
</blockquote>

CC BY-SA 4.0
2023-09-15T18:37:28.847Z
Yes, the blockweight limit is forward compatible to the blocksize limit. I think it’s easier to sum up integers to 4,000,000 than it is to sum up fractions to 1,000,000, though.
Murch
CC BY-SA 4.0
2023-09-15T08:53:43.237Z
2023-09-15T09:19:45.977Z
2023-09-15T09:19:45.977Z
RedGrittyBrick
<p>In pre-segwit bitcoin, process of calculating transaction fee was easy. Actually everything was based on the fact that the byte has its own value/price (estimated by network) and then fee is obtained as <code>number_of_bytes * proce_of_single_byte</code>. So, for example, if the price of one <code>byte</code> is 10 sats, then the fee for a transaction of 250 bytes is 2500 sats.</p>
<p>But what about calculating a fee in post-segwit Bitcoin?</p>
<p>In post-Segwit Bitcoin, bytes have a different value/price depending on the type of byte. So, if the byte is segwit then it is worth 4 times less than a non-segwit byte, that is its price is 4 times smaller. The question is: <strong>how is the transaction fee calculated in this case?</strong></p>
<p><strong>Is it done by not using <code>bytes</code> now, but <code>vbytes</code> and then they have a value (price)? And at that, each byte of <code>non-segwit is one vbyte</code>, while each byte of <code>segwit is 0.25 vbyte</code>?</strong> So, for example, if the price of one <code>vbyte</code> is 10 sats, then the fee for a transaction of 250 bytes (150 non-segwit, 100 segwit) is (150 * 10 sats) + (100/4 * 10 sats) = 1750 sats. So, in post-segwit bitcoin for calculating transaction fee we use <code>(number_of_nonsegwit_bytes * price_of_single_vbyte) + (number_of_segwit_bytes / 4 * price_signle_vbyte)</code></p>
<p><strong>Is this how software and miners calculate transaction fee?</strong></p>
<p>I'm asking because <a href="https://bitcoin.stackexchange.com/questions/53623/why-does-bip141-define-both-virtual-transaction-size-and-weight">here</a>
<code>Pieter Wuille</code> said that <code>vsize has no meaning except for humans</code>, while bitcoin uses weight because of integer numbers. If this is true and vbytes are not actually used in softwares for calculating fee, how is the fee then calculated?</p>

CC BY-SA 4.0
2023-09-14T23:47:08.703Z
Related: https://bitcoin.stackexchange.com/a/84006/5406
Murch
CC BY-SA 4.0
2023-09-15T08:06:26.610Z
@Murch I saw it, but still not clear to me whether `weight` or `vbyte` are used for calculating fee. In the second answer to the question you left the link for  `zono` said the following `Miners consider fee(in satoshi) **per weight** of each transaction in order to maximize their profit.` However, you said the following `The virtual size corresponds to the blockweight which determines the fees`. Pieter Wuille (I linked in question) said that `vsize has no meaning except for humans` and that Bitcoin uses weight because of integer numbers. So what does bitcoin softwares use?
dassd
CC BY-SA 4.0
2023-09-15T08:38:26.757Z
If Pieter Wuille said "Bitcoin uses weight because of integer numbers", I would assume that is what Bitcoin core software uses.
RedGrittyBrick
<transaction-fees><segregated-witness>
What is the way that fee is calculated in post-segwit bitcoin?
dassd
# What is the way that fee is calculated in post-segwit bitcoin?

(Asked by: username_0 on 2023-09-14)

In pre-segwit bitcoin, process of calculating transaction fee was easy. Actually everything was based on the fact that the byte has its own value/price (estimated by network) and then fee is obtained as `number_of_bytes * proce_of_single_byte`. So, for example, if the price of one `byte` is 10 sats, then the fee for a transaction of 250 bytes is 2500 sats.

But what about calculating a fee in post-segwit Bitcoin?

In post-Segwit Bitcoin, bytes have a different value/price depending on the type of byte. So, if the byte is segwit then it is worth 4 times less than a non-segwit byte, that is its price is 4 times smaller. The question is: **how is the transaction fee calculated in this case?**

**Is it done by not using `bytes` now, but `vbytes` and then they have a value (price)? And at that, each byte of `non-segwit is one vbyte`, while each byte of `segwit is 0.25 vbyte`?** So, for example, if the price of one `vbyte` is 10 sats, then the fee for a transaction of 250 bytes (150 non-segwit, 100 segwit) is (150 \* 10 sats) + (100/4 \* 10 sats) = 1750 sats. So, in post-segwit bitcoin for calculating transaction fee we use `(number_of_nonsegwit_bytes * price_of_single_vbyte) + (number_of_segwit_bytes / 4 * price_signle_vbyte)`

**Is this how software and miners calculate transaction fee?**

I'm asking because [here](https://bitcoin.stackexchange.com/questions/53623/why-does-bip141-define-both-virtual-transaction-size-and-weight)
`Pieter Wuille` said that `vsize has no meaning except for humans`, while bitcoin uses weight because of integer numbers. If this is true and vbytes are not actually used in softwares for calculating fee, how is the fee then calculated?

**Tags:** transaction-fees, segregated-witness

> **Comments:**
> **username_1**: Related: https://bitcoin.stackexchange.com/a/84006/5406  
> **username_0**: @username_1 I saw it, but still not clear to me whether `weight` or `vbyte` are used for calculating fee. In the second answer to the question you left the link for  `zono` said the following `Miners consider fee(in satoshi) **per weight** of each transaction in order to maximize their profit.` However, you said the following `The virtual size corresponds to the blockweight which determines the fees`. Pieter Wuille (I linked in question) said that `vsize has no meaning except for humans` and that Bitcoin uses weight because of integer numbers. So what does bitcoin softwares use?  
> **username_2**: If Pieter Wuille said "Bitcoin uses weight because of integer numbers", I would assume that is what Bitcoin core software uses.  

---

## 1 answers

### Answer by username_2 on 2023-09-15. Score: 1 | Accepted answer

So far as I can tell, it doesn't matter whether some software uses vbytes or weight to calculate a fee.

Neither the network nor the blockchain store fee rates. Even fees per transaction are implicit rather than explicit.

I believe some fee related rules such as minimum fee for relaying are node specific and don't affect consensus.

Fee rates are not fixed, each node is free to make its own estimates. Fees are simply a bid in a repeating auction of block space so rounding errors don't matter much.

That auction is conducted by miners who want to maximise revenue while keeping within block size limits. If those size limits are expressed in weight units (WU), that is what I presume miners would be wise to use in calculations.

I don't know of any broader problem that would arise if some software estimates fee rates using floating point arithmetic based on vbytes while other software estimates fee rates using integer arithmetic based on weight.

---

Related:

* [What's the blocksize limit after segwit and how do legacy nodes deal with segwit transactions?](https://bitcoin.stackexchange.com/q/98810/13866)

> Before the activation of segwit, the block was limited to 1,000,000 bytes. This limit got replaced by a blockweight limit of 4,000,000 weight units (WU) with the activation of segwit.

> **Comments:**
> **username_1**: Yes, the blockweight limit is forward compatible to the blocksize limit. I think it’s easier to sum up integers to 4,000,000 than it is to sum up fractions to 1,000,000, though.  

---

