jgvfTop 100 Programs in Period by Unique Signers (Excl. System Programs) copy
    Updated 2023-08-09
    with programs as (

    select

    tx_id,
    program_id,
    ifnull(label, 'unlabeled') as label,
    ifnull(type, 'unlabeled') as type,
    signers[0] as fee_payer,
    f.value as signer
    -- fee

    from solana.core.fact_events events
    inner join lateral flatten (input => signers) f
    --left join (SELECT tx_id as t, fee / pow(10, 9) as fee FROM solana.core.fact_transactions) ON t= tx_id
    left join (SELECT CASE WHEN label = 'tensorswap' THEN 'nft' WHEN label = 'shark finance' then null else label_type end as type, label, address FROM solana.core.dim_labels labels)
    labels on events.program_id = labels.address
    where succeeded = {{tx_succeeded}}
    and (not labels.label = 'solana' or labels.label is null)
    and block_timestamp ::date > current_date() - interval '{{days}} days'
    ),

    aggregated as (

    select

    label,
    type,
    count(distinct tx_id) as txs,
    count(distinct signer) as signers,
    count(distinct fee_payer) as fee_payers--,
    -- program_id

    from programs
    WHERE type = 'dapp'
    group by label, type--,program_id
    Run a query to Download Data