Post
Topic
Board Development & Technical Discussion
Re: How can I lower transaction fee?
by
ManaMan
on 21/02/2018, 22:50:05 UTC
I mean, as programmer, need to know the source about fee and make control of fee's default value for normal user.

When transaction is being creating the transaction you grab available inputs or one input you want to use. By chosing an input you are left with exact amount you must spend so you can spent all that balance on one output or more of them, in most use cases you will have like 2 outputs one will be desired destination and other output is just the amount sent to your "change" address : https://bitcoin.org/en/glossary/change-address

Fee is all of the rest balance of inputs that are not included as outputs. At end you sign a transaction.

Anyway here is an example. I have input A1=20btc and input A2=3btc and I want to create one output B. So A1+A2 = 23 btc in total, I create that output to B address is 22.5btc, you can see that in this example I have left out 0.5BTC and thus these 0.5BTC will automatically be added as fee.

Of course fee is based upon how many outputs and inputs you have - more of them, higher fee you will pay due to limit in block size. Fee also vary based on the network load at particular moment.

Basically when they use automated fee they are most likely using some API or they are looking at recent blocks and transactions in them and unconfirmed transactions to create appealing fee. You can create your own fee of course.