vendettaDaily contract with most interacted
    Updated 2023-02-22
    -- forked from bc93124a-a6f2-48c4-907f-481292380ade

    with tab1 AS
    (SELECT
    tx_signer as address,
    count(distinct tx_hash) as tx_counts,
    min(date(block_timestamp)) as first_tx
    from near.core.fact_transactions
    where block_timestamp >= '2022-01-01'
    group by 1),

    tab2 as (
    select
    block_timestamp:: date as day,
    tx_signer,
    tx_receiver,
    tx_hash as hash
    from near.core.fact_transactions
    join tab1 on address = tx_signer
    where block_timestamp >= '2022-01-01'
    )


    select
    day,
    tx_receiver,
    count(*) as count,
    rank() over (partition by day order by count desc) as rank
    from tab2
    group by 1,2
    qualify rank <= 5



    Run a query to Download Data