Skip to content

Instantly share code, notes, and snippets.

@daira
Created July 23, 2019 06:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daira/a0d437c0bd9640a3b0959fdaa8172907 to your computer and use it in GitHub Desktop.
Save daira/a0d437c0bd9640a3b0959fdaa8172907 to your computer and use it in GitHub Desktop.
SELECT alltxs.block_timestamp_month, fulltxs.fully_shielded_count, 100*fulltxs.fully_shielded_count/alltxs.count AS fully_shielded_percent FROM
(SELECT
block_timestamp_month, count(distinct `hash`) AS fully_shielded_count
FROM
`bigquery-public-data.crypto_zcash.transactions` AS zec_txs
WHERE
NOT EXISTS (SELECT 1 FROM UNNEST(zec_txs.inputs) WHERE NOT type = 'shielded')
AND NOT EXISTS (SELECT 1 FROM UNNEST(zec_txs.outputs) WHERE NOT type = 'shielded')
GROUP BY block_timestamp_month) fulltxs
INNER JOIN
(SELECT
block_timestamp_month, count(distinct `hash`) AS count
FROM
`bigquery-public-data.crypto_zcash.transactions` AS zec_txs
GROUP BY block_timestamp_month) alltxs
ON fulltxs.block_timestamp_month = alltxs.block_timestamp_month
ORDER BY alltxs.block_timestamp_month
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment