Skip to content

Instantly share code, notes, and snippets.

@YazzyYaz
Created January 23, 2020 02:06
Show Gist options
  • Select an option

  • Save YazzyYaz/59f4dc2bef9633ded2d2e667b742a1be to your computer and use it in GitHub Desktop.

Select an option

Save YazzyYaz/59f4dc2bef9633ded2d2e667b742a1be to your computer and use it in GitHub Desktop.
Gas Fees By Specific Date
WITH block_book AS (
SELECT b.number,
FROM `bigquery-public-data.crypto_ethereum_classic.blocks` b
WHERE DATE(timestamp) = "2020-01-05"
),
transactions_by_block AS (
SELECT t.block_number, t.hash, t.gas, t.gas_price, t.receipt_gas_used, t.receipt_cumulative_gas_used
FROM `bigquery-public-data.crypto_ethereum_classic.transactions` t
)
SELECT t.block_number, SUM((t.receipt_gas_used/1000000000) * (t.gas_price / 1000000000)) as total_fees from transactions_by_block t JOIN block_book b on t.block_number = b.number
group by t.block_number
order by t.block_number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment