How is the mining fee calculated?

Mining fees have historically been determined by the amount of traffic on the network. These fees can change depending on how much volume the network is experiencing and the exchange rate. As they change so do the recommended fees set by our app. Our app determines the recommended mining fee by looking at multiple factors to reduce the cost to the user.

The app’s recommended fee is dynamic, based on the network’s recommended fee, and factoring the amount of bitcoin the user wants to send.

Since bitcoin transaction fees are a based on the size of the transaction in bytes of data, the primary fee calculation that needs to be made is to determine the fee per byte, usually expressed as satoshis per byte.

We start by querying several public bitcoin nodes and retrieving their estimated fee/byte for getting a confirmation. The nodes return estimated fee amounts based on the number of blocks for a confirmation. We record the amounts for confirmation in 1 through 7 blocks. Fees are higher for confirmation in 1 block vs 7 blocks with ranging fees in between.

Airbitz defaults  to a “Standard” fee setting which targets a confirmation between 2 to 5 blocks. The wallet chooses between the 2 through 5 block fee estimate based on the amount of bitcoin the user is trying to send. Higher amounts will send fees closer to the 2 block estimate, smaller amounts will send fees closer to the 5 block estimate. This is an attempt at lowering fees for smaller value transactions. As of this writing (2017-03-14) the current network fee estimates were as follows:

1 block -> 240 sat / byte
2 block -> 220 sat / byte
3 block -> 200 sat / byte
4 block -> 180 sat / byte
5 block -> 163 sat / byte
6 block -> 163 sat / byte
7 block -> 148 sat / byte


To determine the fee estimate for the Standard setting, we start by taking the amount the user wants to spend in satoshis and multiply it by .001%. The value is then restricted between the parameters of the estimated fee for 2 blocks and 5 blocks.

For example, if a user wanted to send 0.25 BTC = 25,000,000 satoshi * .001% = 250

250 is greater than the 2 block fee estimate of 220 sat/byte so 220 sat/byte is used.

If a user wanted to send 0.17 BTC = 17,000,000 satoshi * .001% = 170

170 is in between the 2 block estimate of 220 sat/byte and the 5 block estimate of 162 sat/byte so 170 sat/byte is used

If the user sets a “High” fee settings, Airbitz will use the 1 block fee estimate. If the user sets a “Low” fee settings, Airbitz will use the 7 block fee estimate.

The final fee is calculated by multiplying the size of the transaction in bytes by the fee estimate. Most transactions are approximately 230 bytes so given a fee estimate of 170 sat/byte, the final fee would be 39100 sat = 0.391 mBits = .000391 BTC or approximately $0.50 at an exchange rate of $1250/BTC. Note that many transactions may end up being much larger than 230 bytes. See this FAQ for details

Posted in: Airbitz Wallet (Technical)