messariNEAR Top Dapps by Addresses from New Addresses
    Updated 2023-07-03
    with contracts as (
    select
    distinct t.tx_receiver as address,
    case
    when l.project_name is not null then l.project_name
    else t.tx_receiver
    end as contract_group
    from
    near.core.fact_transactions t
    left join
    near.core.dim_address_labels l
    on t.tx_receiver = l.address
    ),
    new_users as (
    select
    min(date(block_timestamp)) as first_date,
    tx_signer as address
    from
    near.core.fact_transactions
    group by
    2
    ),
    top_dapps as (
    select
    c.contract_group as dapp,
    count(distinct t.tx_signer) as address
    from
    near.core.fact_transactions t
    join
    new_users
    on t.tx_signer = new_users.address
    and date(t.block_timestamp) = new_users.first_date
    left join
    contracts c
    on t.tx_receiver = c.address
    where date(t.block_timestamp) between '{{Start_date}}' and '{{End_date}}'
    Run a query to Download Data