theericstonemultichain summary stats eco
    Updated 2024-05-16
    -- forked from multichain summary stats @ https://flipsidecrypto.xyz/edit/queries/0a336f01-1e6a-4833-bc39-3e0197c1c8f2

    with avax as (
    select 'AVAX' as symbol,
    block_timestamp::date as date,
    count(1) as n_txns,
    count(distinct from_address) as n_active,
    sum(value) as tx_volume
    from avalanche.core.fact_transactions
    where block_timestamp > current_date - {{daysago}}
    group by 1,2
    ),
    btc as (
    select 'BTC' as symbol,
    block_timestamp::date as date,
    count(distinct tx_id) as n_txns,
    count(distinct pubkey_script_address) as n_active,
    sum(value) as tx_volume
    from bitcoin.core.fact_outputs
    where block_timestamp > current_date - {{daysago}}
    group by 1,2
    ),
    eth as (
    select 'ETH' as symbol,
    block_timestamp::date as date,
    count(1) as n_txns,
    count(distinct from_address) as n_active,
    sum(value) as tx_volume
    from ethereum.core.fact_transactions
    where block_timestamp > current_date - {{daysago}}
    group by 1,2
    ),
    near as (
    select 'NEAR' as symbol,
    block_timestamp::date as date,
    count(1) as n_txns,
    QueryRunArchived: QueryRun has been archived