Bitcoin Forum
November 17, 2024, 05:54:28 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Some questions about Fee per byte and Fee per vbyte  (Read 133 times)
logfiles (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2170
Merit: 1822


Top Crypto Casino


View Profile WWW
November 22, 2020, 10:31:16 PM
Last edit: July 19, 2023, 08:50:52 PM by logfiles
 #1

Today I noticed that in certain transactions the Fee per byte and Fee per vbyte are the same
https://blockchair.com/bitcoin/transaction/7f71c17b736aed85c305191dc4f99384085387059e8e7f37153a6e1a8aaf5638


While in other transactions the Fee per byte and Fee per vbyte are different
https://blockchair.com/bitcoin/transaction/0882d50c31d5282b5a8f1a03a80460404e04da3407741e13e316277fbc4ab3de


1. What makes the 2 fee rates the same in one transaction and different in another?
2. Which of the two is used to calculate the actual transaction fee?

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
November 22, 2020, 10:55:20 PM
Merited by ABCbits (1)
 #2

1. What makes the 2 fee rates the same in one transaction and different in another?
They are the same in transactions that do not involve any segwit inputs. They are different in ones that do.

2. Which of the two is used to calculate the actual transaction fee?
Neither. The transaction fee is absolute with the fee rate calculated from that. Wallets should be using Fee per vbyte because it accounts for segwit data correctly.

khaled0111
Legendary
*
Offline Offline

Activity: 2716
Merit: 3060


Top Crypto Casino


View Profile WWW
November 22, 2020, 10:57:29 PM
 #3

The first is a legacy transaction and the second is a segwit transaction.
For legacy transaction, the size is equal to the virtual size.
For segwit transactions, the vsize is equal to: (3*stripped size + raw size)/4

hosseinimr93
Legendary
*
Offline Offline

Activity: 2590
Merit: 5687



View Profile
November 22, 2020, 11:28:21 PM
Last edit: November 23, 2020, 12:12:05 AM by hosseinimr93
 #4

In the first transaction all inputs are legacy addresses and there is no witness data. This makes the fee per vbyte equal to fee per byte.
But in a transaction with segwit input, the fee per byte is lower than the fee per vbyte.
The reason is that, in a segwit transaction, there are some witness data that take less space from the block. So, miners get lower fee from transactions with segwit addresses.


Note that every transaction has a size and a weight and can include some witness data and some non-witness data. 1 byte of witness data is equivalent to 1 weight unit and 1 byte of non-witness data is equivalent to 4 weight units. We can also say that every 1 byte of non-witness data is equivalent to 1vbyte and every 1 byte of witness data is equivalent to 0.25 vbyte.
In a legacy transaction (A transaction in which all inputs are legacy addresses) all data are non-witness.
In a segwit transaction (A transaction in which there is at least 1 segwit input), there is some witness data. (There is some non-witness data too, off course)
So when it comes to vbytes, a segwit transaction takes less space than a legacy transaction. Therefore, miners get lower fee for a segwit transaction and the fee per byte is less than the fee per vbyte.

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
ranochigo
Legendary
*
Offline Offline

Activity: 3038
Merit: 4420


Crypto Swap Exchange


View Profile
November 23, 2020, 02:21:13 AM
Merited by hosseinimr93 (1)
 #5

The reason is that, in a segwit transaction, there are some witness data that take less space from the block. So, miners get lower fee from transactions with segwit addresses.

So when it comes to vbytes, a segwit transaction takes less space than a legacy transaction. Therefore, miners get lower fee for a segwit transaction and the fee per byte is less than the fee per vbyte.
I think it's important to explain the terminology of taking up less space.

To ensure backwards compatibility, segwit takes the signature of the transaction out of the equation. For those who aren't upgraded, they won't be put on a different fork since the same block is still valid albeit without the signature. The transaction size is NOT necessarily smaller, if at all. vByte or weight unit is just a concept to count the amount of space a transaction will take up with a theoractical block limit of 4,000,000 weight units.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
nc50lc
Legendary
*
Offline Offline

Activity: 2604
Merit: 6420


Self-proclaimed Genius


View Profile
November 23, 2020, 02:40:40 AM
 #6

2. Which of the two is used to calculate the actual transaction fee?
Aside from post number 2's reply.
it's also the virtual byte if you mean "fee rate" that most miners will be using for prioritization (except miners w/ non-SegWit nodes).

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
bitmover
Legendary
*
Offline Offline

Activity: 2492
Merit: 6321


bitcoindata.science


View Profile WWW
November 24, 2020, 01:35:18 PM
 #7

Since segwit, Weight Units (or Virtual Size, which is Weight units/4) is what matters when calculating transaction size (or vsize )

The feerate, or fee/vbyte, is what should be considered.

From bitcoin wiki (which is a great source btw):

Quote
Weight units
Weight units are a measurement used to compare the size of different Bitcoin transactions to each other in proportion to the consensus-enforced maximum block size limit. Weight units are also used to measure the size of other block chain data, such as block headers. As of Bitcoin Core 0.13.0 (released August 2016)[1], each weight unit represents 1/4,000,000th of the maximum size of a block.

Virtual size (vsize), also called virtual bytes (vbytes), are an alternative measurement, with one vbyte being equal to four weight units. That means the maximum block size measured in vsize is 1 million vbytes.

Most wallets (and third party services ) mistakenly say sat/byte, but they are really refering to about fee/vbyte.

Next time you make a transaction check if you wallet says "fee/byte" and then check it in http://blockstream.info/ explorer. You will see that the fee you choose is marked as fee/vbyte in there. (I made that test a few times ).

As others said, if you are using Legacy address format, vsize is the same as the size.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!