Afonso_Diazcategorized by number of users
    Updated 2024-09-19
    with

    transactions as (
    select
    contract_address,
    tx_hash,
    block_timestamp,
    tx_fee,
    from_address as user
    from
    kaia.core.fact_event_logs
    join
    kaia.core.fact_transactions using (tx_hash, block_timestamp)
    where
    tx_succeeded = 1
    ),

    contracts as (
    select
    contract_address,
    count(distinct block_timestamp::date) as active_days,
    count(distinct tx_hash) as transactions,
    count(distinct user) as users
    from transactions
    group by 1
    order by transactions desc
    )

    select
    case
    when users < 50 then 'a. < 50 Users'
    when users <= 250 then 'b. 51 - 250 Users'
    when users <= 500 then 'c. 251 - 500 Users'
    when users <= 1000 then 'd. 500 - 1000 Users'
    when users <= 10000 then 'e. 1001 - 10,000 Users'
    when users <= 100000 then 'f. 10,000 - 100,000 Users'
    QueryRunArchived: QueryRun has been archived