Skip to content

Instantly share code, notes, and snippets.

@dergoegge
Created November 22, 2020 15:14
Show Gist options
  • Save dergoegge/ec73e0de2d858d2e75bf31a6a7b3e6b2 to your computer and use it in GitHub Desktop.
Save dergoegge/ec73e0de2d858d2e75bf31a6a7b3e6b2 to your computer and use it in GitHub Desktop.
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