Created
July 23, 2019 02:13
-
-
Save tromer/96f9a1bd8ce3d507358fe38eae77deb5 to your computer and use it in GitHub Desktop.
Count the number of fully-shielded Zcash transactions per month
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
/* Count the number of fully-shielded Zcash transactions per month */ | |
SELECT FORMAT_DATE("%E4Y-%m", Date(block_timestamp)) as month, count(distinct `hash`) as fully_shielded_tx FROM | |
( | |
SELECT /* fully shielded transactions with 0 fee */ | |
`hash`, | |
block_timestamp, | |
fee | |
FROM | |
`bigquery-public-data.crypto_zcash.transactions` | |
WHERE | |
is_coinbase = FALSE | |
AND input_count = 0 | |
AND output_count = 0 | |
UNION DISTINCT | |
SELECT /* fully shielded transactions with nonzero fee */ | |
`hash`, | |
block_timestamp, | |
fee | |
FROM | |
`bigquery-public-data.crypto_zcash.transactions`, | |
UNNEST(inputs) AS i | |
WHERE | |
is_coinbase = FALSE | |
AND input_count = 1 | |
AND output_count = 0 | |
AND i.type = "shielded" | |
AND i.value = fee | |
) | |
GROUP BY 1 ORDER BY 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment