Yakuzae3
Updated 2023-01-29
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
SELECT blocks.block_timestamp::date as day , 'Optimism' AS blockchain, AVG(prices.price) as price_usd, COUNT(DISTINCT blocks.block_number) AS blocks, (price_usd * sum(ETH_VALUE)) as totall_volume,
COUNT(DISTINCT transactions.tx_hash) AS txn, (txn / 90 / 86400) AS Transactions_per_Second,
COUNT(DISTINCT transactions.from_address) AS unique_users
FROM optimism.core.fact_blocks blocks JOIN optimism.core.fact_transactions transactions ON blocks.block_number = transactions.block_number
JOIN ethereum.core.fact_hourly_token_prices prices ON blocks.block_timestamp::date = prices.hour::date
WHERE blocks.block_timestamp::date >= CURRENT_DATE - 90 AND prices.symbol = 'WETH'
GROUP BY 1 , 2
UNION all
SELECT blocks.block_timestamp::date as day ,'Arbitrum' AS blockchain, AVG(prices.price) as price_usd, COUNT(DISTINCT blocks.block_number) AS blocks, (price_usd * sum(ETH_VALUE)) as totall_volume,
COUNT(DISTINCT transactions.tx_hash) AS txn, (txn / 90 / 86400) AS txs_per_sec,
COUNT(DISTINCT transactions.from_address) AS unique_users
FROM arbitrum.core.fact_blocks blocks JOIN arbitrum.core.fact_transactions transactions ON blocks.block_number = transactions.block_number
JOIN ethereum.core.fact_hourly_token_prices prices ON blocks.block_timestamp::date = prices.hour::date
WHERE blocks.block_timestamp::date >= CURRENT_DATE - 90 AND prices.symbol = 'WETH'
GROUP BY 1 , 2
UNION
SELECT blocks.block_timestamp::date as day ,'Polygon' AS blockchain, AVG(prices.price) as price_usd, COUNT(DISTINCT blocks.block_number) AS blocks, (price_usd * sum(MATIC_VALUE)) as totall_volume,
COUNT(DISTINCT transactions.tx_hash) AS txn, (txn / 90 / 86400) AS txs_per_sec,
COUNT(DISTINCT transactions.from_address) AS unique_users
FROM polygon.core.fact_blocks blocks JOIN polygon.core.fact_transactions transactions ON blocks.block_number = transactions.block_number
JOIN ethereum.core.fact_hourly_token_prices prices ON blocks.block_timestamp::date = prices.hour::date
WHERE blocks.block_timestamp::date >= CURRENT_DATE - 90 AND prices.symbol = 'MATIC'
GROUP BY 1 , 2
UNION
SELECT blocks.block_timestamp::date as day , 'Ethereum' AS blockchain, AVG(prices.price) as price_usd, COUNT(DISTINCT blocks.block_number) AS blocks, (price_usd * sum(ETH_VALUE)) as totall_volume,
COUNT(DISTINCT transactions.tx_hash) AS txn, (txn / 90 / 86400) AS txs_per_sec,
COUNT(DISTINCT transactions.from_address) AS unique_users
FROM ethereum.core.fact_blocks blocks JOIN ethereum.core.fact_transactions transactions ON blocks.block_number = transactions.block_number
JOIN ethereum.core.fact_hourly_token_prices prices ON blocks.block_timestamp::date = prices.hour::date
WHERE blocks.block_timestamp::date >= CURRENT_DATE - 90 AND prices.symbol = 'WETH'
Run a query to Download Data