1

I like to calculate the transaction fee which takes place for making the transaction to blockchain platform.

How can i calculate it??

I had gone through google and got to know that it's based on the number of blocks but still i am unable to understand it how it will be calculated.

So, is there any formula or process to calculate it ??

Thanks in advance for your revert...

1 Answer 1

1

There's 2 parameters that affect the value of a transaction fee: the transaction's size and how long you're willing to wait for it to confirm.

Smaller transactions pay a smaller fee than larger transactions since miners can include more of them. At a higher level, you pay for each byte of data you want to include in a block.

The price per byte (denominated in satoshis per byte) that will confirm you in n blocks is estimated by looking at the past data (and maybe at the current transactions waiting to be confirmed).

Once you have that price, you can multiply the size of your transaction by it to get the fee you have to pay.

As for formulas, if you use standard addresses (not P2SH), the formula is:

fee = (n_inputs * 148 + n_outputs * 34 + 10) * price_per_byte

SegWit slightly changes this, where instead of paying per byte, you pay per unit of weight: 1 byte of non witness data = 4 weight, 1 byte of witness data = 1 weight.

4
  • Hey Alcio,thanks for your revert but still i didn't get you actually i am bit new to blockchain API and i have say for e.g 22537 satoshi in my one of the address and i am trying to send it to new address in same wallet so for this case how the fee is calculated ??/ Commented Oct 10, 2017 at 8:43
  • 2
    The amounts and addresses are irrelevant. What matters is the transaction complexity, i.e. how many different previous incoming payments it spends from, and how many outgoing ones it makes Commented Oct 10, 2017 at 8:50
  • Hi, peter thanks for your comment still i am unable to get what you're trying to explain..?? Commented Oct 10, 2017 at 9:02
  • 1
    The fee you pay doesn't depend at all on the amounts involved. Moving $100M can cost less than moving $0.01 in BTC. The only thing that matters is how large (in bytes, not value) the transaction is.
    – alcio
    Commented Oct 10, 2017 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.