Skip to content

Instantly share code, notes, and snippets.

@phiresky phiresky/calc.js
Created Oct 29, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.