Is there a way to find and plot every transaction fee ever paid on the blockchain/bitcoin?


I have read about transaction fees:

Though the average Bitcoin transaction may be around $25, for example, the median is closer to what most users will likely need to pay.

At that rate, if you want to send a transaction right away, the fastest transaction fee is currently around 102 satoshis/byte, according to bitcoinfees.earn. For a median transaction size of 224 bytes, this results in a fee of 22,848 satoshis, or $11. If you don’t mind waiting roughly a half hour, the price would be 83 satoshis/byte, or about $9. The price continues to slide down from there if you’re willing to wait even longer.

So this gives very useful info, but if I want to see the distribution of all historical transaction fees on the blockchain, how could I do that?

Also, because the value of bitcoin has changed a great deal over the past several years, it would be sensible to measure the transaction fees in USD equivalent (like the article does).

Is this easy to do (or even possible at all)?

4 Answers 4


Transactions vary a lot in data size, so it's usually more useful to compare the feerates of transactions rather than absolute fees. For example, a transaction that batches fifty payments may pay the same feerate, but a significantly higher fee, while still having a lower fee per payment than a transaction that performs a single payment.

You may find this block feerate composition graph (via Bitcoin Optech Group) interesting to get a sense of how feerates changed historically. While the data is a bit noisy for single blocks beyond a day or two, the 12-block average gives a sense of how fee rates change over the course of a day and the week, while the 144-block average may be interesting for bigger timeframes:

Bitcoin Optech Group's block feerate percentile graph

There is also this graph by Anduck that splits out blocks more precisely, but only for the recent past:

Anduck's 144-block fee per transaction chart


So this gives very useful info, but if I want to see the distribution of all historical transaction fees on the blockchain, how could I do that?

The information doesn't look useful. Distribution of fee rates used by unconfirmed transactions can be checked on many websites like https://mempool.space/ https://mempool.observer/ https://btc.bitaps.com/


Fees per transaction (BTC) in last few years:

fee-per-tx https://bitcoinvisuals.com/chain-fees-tx-btc

There is one open PR to add mempool stats chart in Bitcoin Core GUI as well:


If you want to get fee rate and fee used in all the bitcoin transactions until now, API for any block explorer can be used. There are also few open source explorers like Esplora, NBXplorer, mempool etc.

Also, because the value of bitcoin has changed a great deal over the past several years, it would be sensible to measure the transaction fees in USD equivalent (like the article does)

Depends on the usecase. Bitcoin protocol is not aware of exchange rate for BTC. I would prefer to use sat/vByte for fee rate and BTC for fees.

  • Thanks! It's probably obvious to those that know, but what are the numbers in the first plot? I guess the second set is the count in that bucket of the distribution, but what's the first set? (i.e. the one starting at "1-2" and going to ">300"). Is it the transaction fee in satoshis?
    – stevec
    Mar 21, 2021 at 3:25
  • X-axis: Virtual Size Y-axis: Fee rate in sat/Vbyte. Nodes use limit for mempool size which is 300 MB however Virtual size of transactions in the mempool is different from how much block space they would take up: bitcoin.stackexchange.com/a/96070
    – user103136
    Mar 21, 2021 at 3:32
  • Does that mean in order to calculate the total transaction fee in bitcoin per transaction, the sat/Vbyte should be multiplied by the number of bytes that transaction required? Is the number of bytes required (on a per-transaction basis) available somewhere?
    – stevec
    Mar 21, 2021 at 3:38
  • 1
    Example tx: httpd12ecedeec0f5c01c31c25487216626ef0248cb19e65d4f96c4ea04e4c4b5f05 Virtual Size: 205 vB Fee rate: 15 sat/vB so Total fee for this tx: 205*15 = 3075 sats = 0.00003075 BTC Size of transaction depends on Inputs and Outputs used: bitcoin.stackexchange.com/questions/92689/… Murch will be the best person to answer this IMO: twitter.com/murchandamus/status/1262062602298916865
    – user103136
    Mar 21, 2021 at 3:46
  • Awesome info. Just working my way through this - not as simple as I thought!
    – stevec
    Mar 21, 2021 at 4:42

I think we have exactly the plot you are looking for in our paper Full Bitcoin Blockchain Data Made Easy (Figure 7):

enter image description here

This is a cumulative distribution: for each amount on the horizontal axis, we plot the fraction of transactions that have fees lower than or equal to this value.

As suggested by Joseph, we downloaded the whole blockchain and computed the fees (difference between output and input amounts) of each transaction. The figure also displays the fee distribution for the last million transactions, since putting together all fees actually makes little sense, as discussed in comments above.

Code and data are publicly available. In particular, the 12GB compressed text file blockchain.distilled_amounts.gz contains a line per transaction, with its input and output amounts (see the paper for details).

  • Bravo for sharing your hard work and making it available to other interested parties. Great idea to include 'most recent million'. Of those, looks like the vast majority of the fees are between 0.00001 and 0.01 BTC. I'd be extremely curious to see the plot without log x axis and a non-cumulative distribution. Also curious, what is the file size of the 12gb file when uncompressed (e.g. in RAM)?
    – stevec
    Jun 16, 2021 at 13:06
  • 1
    I uploaded the raw distributions for you at latapy.complexnetworks.fr/fees_d and latapy.complexnetworks.fr/last_fees_d so you may play with them and try all sorts of scales :) The fees in satoshis are in the first field, then comes the number of occurrences of this fee amount. Jun 16, 2021 at 19:11
  • 1
    Regarding your question on the uncompressed data, the 12GB become 42GB. It is plain text format, though, so not optimized. It lists the amount of each input and each output of each of the 623,483,734 transactions we have, which leads to a total of 3,225,135,853 values; with 32 bit integers, you may store this in slightly more than 12GB RAM, if I am correct. Jun 16, 2021 at 19:43
  • Amazing. Did you use vanilla python on a large computer (i.e. >42GB ram), or something like spark, or some other tool (e.g. BigQuery) to analyse the uncompressed file? It would be pretty great to place in something like a public BigQuery dataset.
    – stevec
    Jun 17, 2021 at 5:40
  • 1
    :) Our goal was to show that one may quite easily and efficiently handle the full blockchain data with basic tools (small python scripts and command lines). This actually is the most effective way for various processing tasks. Using more advanced technologies for more advanced tasks is a perspective, and we release the data for this. I would love to see what others do with it. Jun 17, 2021 at 6:37

The transaction fees can be calculated by subtracting each transaction's inputs from its outputs – that difference is the fee. I would guess your best bet is to clone Bitcoin Core, download the entire blockchain, and start parsing the data yourself.

If that sounds like too much, I would start here and then ask another question once you get a full node up and running.

Best of luck!

  • +1 Great to know it's possible! I think DIYing it would be marvellous learning, however, do you know if someone would already have attempted it and stored the resulting data somewhere?
    – stevec
    Mar 21, 2021 at 3:13

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.