Skip to content

Instantly share code, notes, and snippets.

@dergoegge
Created November 22, 2020 15:14
Create a plot from the getmempoolinfo RPC histogram
import matplotlib.pyplot as plt
import json
with open('mempool.json') as f:
data = json.load(f)
widths = []
feerates = []
count = []
for rate in data['fee_histogram']:
if rate == 'total_fees':
continue
feerates.append(rate)
count.append(data['fee_histogram'][rate]['count'])
widths.append(1)
plt.xscale('linear')
plt.bar(feerates, count, widths, align='edge')
plt.xlabel('feerate')
plt.ylabel('count')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment