Pages:
Author

Topic: how does transaction fees work - page 2. (Read 370 times)

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
June 29, 2021, 02:47:12 PM
#4
Before you can calculate the transaction fee, you must first calculate the transaction size because the total fee paid increases for transactions with more bytes.

There are two different transaction size formulas used by clients today, the first is the old "bytes" calculator which pre-segwit wallets (or wallets that just don't want to implement segwit) use, whose size is calculated like this:

number of inputs * 146 + number of outputs * 33 + 10 (source)

The other size formula gives you the size in vbytes (virtual bytes), and this is the measurement unit now used by the bitcoin network, and also wallets that support segwit, instead of "bytes" (more on that later):

number of inputs * 68.5 + number of outputs * 31 + 10 (same source)

Now you might be wondering, what are vbytes? They are related to another tx size unit called Weight. vbytes is just Weight/4. To calculate weight, you count the size of the transaction in normal bytes but you multiply sizes of some parts of the transaction by 4:


(source: https://learnmeabitcoin.com/technical/transaction-weight)

And as I mentioned earlier you divide the final result by 4 to go from Weight to vbytes.

Why all these complications for finding the transaction size? Well, developers wanted to make transaction sizes smaller so people would pay less overall in fees. The network fee rate (e.g. 10 sats/byte) did not change with this, just the transaction sizes.

So you will generally see two different units for measuring fee rates: satoshis per byte and satoshis per vbyte. Using 10 sats/byte and 10 sats/vbyte is functionally equivalent as far as the rate is concerned, but because of the way the transaction sizes are calculated by wallets supporting segwit vs wallets that don't support segwit, using fees in sats/bytes will cause you to pay more in total fees than if you paid in sats/vbytes. This is a concern because the majority of wallets are paying in sats/vbyte and with a lot of transactions priced like that, you submitting a transaction with a fee in sats/bytes will cause you to overpay, paying more than what other wallets using the same sats/vbyte rate are paying.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
June 29, 2021, 02:04:58 PM
#3
Who or what determines the transaction costs of a coin.
You do it. If you want your transaction to be quickly confirmed, you'll have to set a high fee, because you'll give a greater incentive to the miner. You can determine it in sat/bytes. The more inputs and outputs it has, the heavier it is and thus, the more sats you'll have to pay.

Can the developer set this himself?
The developers cannot set the fee of your transactions. However, they can set a default limit (in the source code) you can't recede. For example, you cannot pay 0 sats for a transaction, because most of the nodes will reject including anything lower than 1 sat/byte into their mempool, if I remember correctly. Note that it doesn't mean they're invalid transactions; they can be normally included into a block.
legendary
Activity: 4270
Merit: 4534
June 29, 2021, 01:31:02 PM
#2
when making a transaction
EG
1Alice4bc (0.001) -> 1bob3gh (0.0008)
                          -> 1alic4bc (0.000102) remainder change back to alice

the total going out is less that what alice started with.
this 'forgetful' difference(0.000098) becomes the transaction fee.

there may be many many mechanisms/formulaes that wallets chose to decide how much to 'forget' in the audit of the input and output balances.

some do a calculation of the previous x blocks amount of total bytes/total total fee's collected to set an average price per byte the network is currently allowing.

some look at how many transaction bytes are in their mempool to estimate the demand
some may do more complex stuff.

bitcoin has no hard rule. (which is a flaw) whereby the mining pools can set their own decision of what transactions to accept, ignore into their block

making any fee 'estimation' a guess at most. leading people to end up 'just paying more' (not giving as much change back to themselves)

newbie
Activity: 7
Merit: 5
June 29, 2021, 01:20:30 PM
#1
Hello all,

I am new to this platform,
I have been involved in crypto for several years. But now I would like to get
But now I would like to delve into developing crypto.

I was wondering now how it works with the transaction costs.
Who or what determines the transaction costs of a coin.

Can the developer set this himself?

Kind regards
Pages:
Jump to: