AlexaySolana programs that paid most fees
    Updated 2022-07-13
    WITH total AS(
    (SELECT
    PROGRAM_ID,
    COUNT(DISTINCT tx_id) as tx_count
    FROM solana.core.fact_events
    WHERE SUCCEEDED = 'FALSE'
    and block_timestamp::date BETWEEN '2022-05-01' and '2022-06-01'
    GROUP BY 1
    )
    UNION ALL
    (SELECT
    PROGRAM_ID,
    COUNT(DISTINCT tx_id) as tx_count
    FROM solana.core.fact_events
    WHERE SUCCEEDED = 'FALSE'
    and block_timestamp::date BETWEEN '2022-06-01' and '2022-07-01'
    GROUP BY 1
    )
    UNION ALL
    (SELECT
    PROGRAM_ID,
    COUNT(DISTINCT tx_id) as tx_count
    FROM solana.core.fact_events
    WHERE SUCCEEDED = 'FALSE'
    and block_timestamp::date BETWEEN '2022-07-01' and '2022-07-13'
    GROUP BY 1
    )
    )
    SELECT
    PROGRAM_ID,
    ((5549.00694 * sum(tx_count) / POW(10, 9))) AS total_fee
    FROM total
    GROUP BY 1
    ORDER by 2 DESC
    Run a query to Download Data