Created
January 1, 2019 07:13
-
-
Save orcaman/dd05ddce5634ba4b0ba4781e51c64126 to your computer and use it in GitHub Desktop.
How Many Bitcoins Were Sent Per Month Per Year
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#standardSQL | |
SELECT | |
EXTRACT(year | |
FROM | |
o.day) AS year, | |
EXTRACT(month | |
FROM | |
o.day) AS month, | |
SUM(o.output_satoshis) * 0.00000001 AS btc | |
FROM ( | |
SELECT | |
TIMESTAMP_MILLIS((timestamp - MOD(timestamp,86400000))) AS day, | |
output.output_pubkey_base58 AS output_key, | |
output.output_satoshis | |
FROM | |
`bigquery-public-data.bitcoin_blockchain.transactions`, | |
UNNEST(outputs) AS output | |
GROUP BY | |
day, | |
output_key, | |
output_satoshis ) AS o | |
GROUP BY | |
1, | |
2 | |
ORDER BY | |
1, | |
2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment