jackguynear_contract_4
    Updated 2023-03-24
    with top10 as (
    select
    TX_RECEIVER as contract,
    count(DISTINCT TX_SIGNER) as users,
    count(DISTINCT TX_HASH) as transactions
    from near.core.fact_transactions
    WHERE block_timestamp > '2023-01-01'
    AND TX_RECEIVER in (
    SELECT
    tx_receiver
    FROM (
    SELECT
    tx_receiver,
    min(block_timestamp) as first_day
    FROM near.core.fact_transactions
    GROUP BY 1
    )
    WHERE first_day > '2022-12-01'
    )
    --AND not id is NULL
    group by 1
    ORDER by 2 DESC
    LIMIT 10
    )

    SELECT
    *,
    sum(new_users) over (ORDER BY first_day) as total_users

    FROM (
    SELECT
    first_day,
    count(DISTINCT users) as new_users

    FROM (
    SELECT
    Run a query to Download Data