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:
df
Well, we can now set up the graph and display it.
ax = df.reset_index().plot.scatter(x="index", y="Satoshi per byte")
ax.set_ylim(0)
ax.set_xlim(0)
Would you like to analyze the bitcoin blockchain using Python?