Explore Transaction Fees in a specific Block

In this simple tutorial we will see how you can observe the fees paid in a specific block by knowing the location of the block in the blockchain.

We start by importing the blocksci library and instantiating the blockchain.

import blocksci
chain = blocksci.Blockchain("/BlockSci/config_file")

We import the pandas library to store the data in a pandas.DataFrame, and the seaborn library to display the data.

import pandas as pd
import seaborn

Now we select a specific block, in our case block 465100, and store the data regarding the fees of each transaction in a DataFrame.

example_block_height = 465100
df = pd.DataFrame(chain[example_block_height].txes.fee_per_byte(), columns=['Satoshi per byte'])

This should be the result:


Well, we can now set up the graph and display it.

ax = df.reset_index().plot.scatter(x="index", y="Satoshi per byte")

Would you like to analyze the bitcoin blockchain using Python?

Apply to our Beta Tester Program!

You can also join our developer channel!

Leave a Comment

Your email address will not be published. Required fields are marked *