Created
January 23, 2020 02:27
-
-
Save YazzyYaz/2ce1967db4b9714e0e1e16f8f08d78c3 to your computer and use it in GitHub Desktop.
Total Gas Fees Every Day
This file contains hidden or 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
| WITH transactions_by_block AS ( | |
| SELECT t.block_number, t.block_timestamp, 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 | |
| ), | |
| fees_by_block AS (SELECT t.block_number, t.block_timestamp, SUM((t.receipt_gas_used/1000000000) * (t.gas_price / 1000000000)) as total_fees from transactions_by_block t | |
| group by t.block_timestamp, t.block_number) | |
| SELECT TIMESTAMP_TRUNC(f.block_timestamp, DAY) as block_day, | |
| SUM(f.total_fees) as total_fees, | |
| FROM fees_by_block f | |
| GROUP BY TIMESTAMP_TRUNC(f.block_timestamp, DAY) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment