MostlyData_Gas & Fee data
Updated 2024-11-27
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
›
⌄
-- forked from PF left by position @ https://flipsidecrypto.xyz/studio/queries/b5192a23-92f4-468b-afce-3fa469fee639
-- forked from PF by position @ https://flipsidecrypto.xyz/studio/queries/88bff19e-c35e-416d-9b87-7a4841aae922
with block_info as(
select
block_number
,tx_count
,block_header_json['baseFeePerGas'] as baseFeePerGas
from ethereum.core.fact_blocks
where
block_timestamp >= current_date() - interval '{{n_days}} days'
)
,tx_data as(
select
txs.tx_hash
,txs.position
,txs.cumulative_gas_used
,txs.tx_fee_precise
,txs.gas_used
,bi.baseFeePerGas
,txs.max_priority_fee_per_gas
,txs.max_fee_per_gas
,bi.baseFeePerGas * txs.gas_used * pow(10,-18) as burnt_fee
,txs.max_priority_fee_per_gas * txs.gas_used * pow(10,-9) as max_pf_fee
,txs.tx_fee_precise - bi.baseFeePerGas * txs.gas_used * pow(10,-18) as pf
,case
when txs.max_priority_fee_per_gas * txs.gas_used * pow(10, -9) - (txs.tx_fee_precise - bi.baseFeePerGas * txs.gas_used * pow(10, -18)) < pow(10, -15)
then 0
else txs.max_priority_fee_per_gas * txs.gas_used * pow(10, -9) - (txs.tx_fee_precise - bi.baseFeePerGas * txs.gas_used * pow(10, -18))
end as delta_pf
from ethereum.core.fact_transactions txs
QueryRunArchived: QueryRun has been archived