cybergenlab[Network Overview] 24h metrics overview
    Updated 2024-11-16
    -- Ethereum key usage metrics overview

    --Get Ethereum block base fee
    with block_base_fee as (
    select
    date_trunc('day', block_timestamp) as time,
    avg(get(block_header_json, 'baseFeePerGas')/pow(10, 9)) as base_fee
    from ethereum.core.fact_blocks
    group by 1
    )

    --Get type and status of transactions
    , transaction_details as (
    select
    time,
    sum(successes) / (sum(successes) + sum(failures)) as success_rate,
    sum(legacy) as legacy_tx,
    sum(EIP_2930) as EIP_2930_tx,
    sum(EIP_1559) as EIP_1559_tx,
    sum(EIP_4844) as EIP_4844_tx
    from(
    select
    date_trunc('day', block_timestamp) as time,
    case when status = 'SUCCESS' then 1 else 0 end as successes,
    case when status = 'FAIL' then 1 else 0 end as failures,
    case when tx_type = 0 then 1 else 0 end as legacy,
    case when tx_type = 1 then 1 else 0 end as EIP_2930,
    case when tx_type = 2 then 1 else 0 end as EIP_1559,
    case when tx_type = 3 then 1 else 0 end as EIP_4844,
    from ethereum.core.fact_transactions
    )
    group by 1
    )

    --Get Ethereum usage metrics
    select
    QueryRunArchived: QueryRun has been archived