HosseinTop 10 Near Holders
    Updated 2023-02-06
    with t as (
    select
    block_timestamp::date as day,
    case tx_receiver
    when 'x.paras.near' then 'NFT'
    when 'nft.paras.near' then 'NFT'
    when 'marketplace.paras.near' then 'NFT'
    when 'token.paras.near' then 'Token'
    when 'staking.paras.near' then 'Staking'
    else null end as event_name,
    count (distinct tx_hash) as txns_count,
    count (distinct tx_signer) as users_count,
    txns_count / users_count as txns_per_user,
    sum (transaction_fee / 1e24) as total_fee,
    avg (transaction_fee / 1e24) as average_fee,
    median (transaction_fee / 1e24) as median_fee
    from near.core.fact_transactions
    where tx_status = 'Success'
    group by 1, 2
    having event_name is not null
    )

    select
    event_name,
    avg(txns_count) as average_txns_count,
    avg(users_count) as average_users_count,
    avg(total_fee) as average_fee
    from t
    where day > current_date - interval '2 weeks'
    group by 1
    Run a query to Download Data