Follow us on Twitter:
Home / Tutorials / Bitcoin / How to predict the transaction fees

How to predict the transaction fees

What is transaction fees for Bitcoin?

Transaction fees are paid to the miners to include the transactions in a block. Then the recipients can be comfortable to proceed with the business with you. The fees are seen as incentive for the miners to include the transactions in a block. If they are too low, your transactions will be ignored by the miners, and get stuck for many hours, many days, even get dropped by the bitcoin network. Many newbies, even experienced bitcoiners have no idea how to set the appropriate amount of fees, and leave the fees as suggested by the wallets, or maximize the amount of fees, as 0.0002 BTC, or 0.0003 BTC. For most of the times the high amount of paid transaction fees are wasted. But at the time of network stress test or spamming, if you have more inputs at a transaction, you will be headache. Now I will sort out how to estimate the appropriate amount of transaction fees to get the transactions confirmed in the next block.

Estimate the transaction size before sending

This will be applied to most cases “pay to address” transactions.

Each input will add 180 (plus or minus 1) bytes to the transaction. Each output will add 34 bytes to the transaction. And there’s a fixed extra 10 bytes which are always present.

The “plus or minus 1” comes from the fact that each input needs a signature to be claimed. The signature contains two 32 byte values, but if either of the values has a first byte of 0x80 or more, it has a 0x00 byte prepended to it. So I’m assuming one of the two is high and the other is low. Therefor I minus one byte per input.

So if your transaction has in inputs and out outputs, the transaction size in bytes will be:

in x 180 + out x 34 + 10 plus or minus in

For this transaction, it has one input and two outputs. Its transaction size should be 258 bytes based on this formula.

1 x 180 + 2 x 34 + 10 + – 1

But the actually size is 226 bytes which we can see from the network. The formula is just for estimating required fee purpose. Until the transactions are sent, we will know the exact size. But the estimation is good enough for us to calculate the needed fees.

I will provide two tools to predict the fees.

1. Predicting bitcoin transaction fees using bitcoinfees.21.co

We could use bitcoinfees.21.co to predict the above transaction fees.

bitcoinfees.21.co

The optimized fees to get the transactions included in the next block should be 10320 satoshi (0.00010320 BTC)(258 X 40 satoshis/byte ) at the time of my writing.

Explanation about the above chart

The fastest and cheapest transaction fee was 40 satoshis/byte, shown in green at the chart. For the live fee rate, you should go to bitcoinfees.21.co at the time you want to send bitcoin.

The predictions are based on blockchain data from the last 3 hours, and the current unconfirmed transactions stored at the mempool. It is using Monte Carlo simulation to predict likely future mempool and miner behavior. From the simulations, it can be seen how fast transactions with different fees are likely to be included in the upcoming blocks. The predicted delay shown here is chosen to represent a 90% confidence interval.

If you don’t rush to get the transactions included in the next block or want to save tx fees, you could choose lower fees. You could choose the fees shown in brown. The transactions will be delayed from confirmation about one block time (10 minutes) at a 90% chance.

2. Predicting bitcoin transaction fees using statoshi.info

We could use statoshi.info to predict the above transaction fees.

estimate transaction fees using statoshi.info

The fastest and cheapest fees to get the transaction included in the next 2 block should be 8340 satoshis/ (0.00008340 BTC)(258 X 32.326 satoshis/byte ).

The two fees based on the two tools are a bit different due to a slightly different calculation methods and time range. They are all based on estimation and wouldn’t have much impact on the confirmation time.

How to use the above chart

The fees shown as green line (block2 32326 satoshis/KB) is the fastedst and cheapest fees. Block2 means the shown fees are recommened to get the transactions included in the next two blocks with higher chance by the miners. The default time range is for 6 hours. You could see the exact figure at the middle of the page for realtime fee rate. Or you could hover at the colored line at the right coner of the chart. A pop out window will show the different fees corresponding with diffent lines to get the transactions confirmed in the upcoming blocks.

About lhcn57

Check Also

replace-by-fee

How to Apply RBF (Replace By Fee) to Save the Bitcoin Transaction Fees

Bitcoiners may not know how to include appropriate amount of miner fees, frequently send the …

3 comments

  1. Hey, thanks to you I finally understand how the transaction fees are calculated! :)
    I might try to incorporate their APIs in my buy-bitcoin page!

    BR, Phil

Leave a Reply