Skip to content

Instantly share code, notes, and snippets.

@phiresky
Created October 29, 2018 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phiresky/a6755c650b3bbb340c4d641f89f01b42 to your computer and use it in GitHub Desktop.
Save phiresky/a6755c650b3bbb340c4d641f89f01b42 to your computer and use it in GitHub Desktop.
bitcoin fees vs block reward 2017
fees = await fetch("https://api.blockchain.info/charts/transaction-fees-usd?format=json&timespan=2years").then(x => x.json())
year = 2018
filter = x => new Date(1000*x.x) > Date.UTC(year) && new Date(1000*x.x) < Date.UTC(year + 1)
totalFees = fees.values.filter(filter).reduce((a,b) => a+b.y, 0)
rewards = await fetch("https://api.blockchain.info/charts/miners-revenue?format=json&timespan=2years").then(x => x.json())
totalReward = rewards.values.filter(filter).reduce((a,b) => a+b.y, 0)
console.log("part that was caused by fees", totalFees/totalReward)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment