cyphernear new and active users
    Updated 2023-04-13
    with
    first_tx as (
    select
    tx_signer,
    min(block_timestamp) as timestamp
    from
    near.core.fact_transactions
    group by
    1
    ),
    daily_new_users as (
    select
    date_trunc('day', timestamp) as date,
    count(*) as n_new_users
    from
    first_tx
    where
    date >= current_date() - {{n_days}}
    and date < current_date()
    group by
    date
    ),
    active_users as (
    select
    date_trunc('day', block_timestamp) as date,
    count(distinct (tx_signer)) as active_users
    from
    near.core.fact_transactions
    where
    date >= current_date() - {{n_days}}
    and date < current_date()
    group by
    1
    )
    select
    *,
    Run a query to Download Data