par_rnAll Solana tx VS. Staking tx on Solana over time
    Updated 2022-12-24
    WITH
    all_tx as (
    SELECT
    block_timestamp::date as date,
    sum(1) as tx_count
    from solana.core.fact_events
    where block_timestamp>='2022-09-01'
    and event_type is not null
    group by 1
    ),
    staked_tx as (
    SELECT
    block_timestamp::date as date,
    sum(1) as tx_count
    from solana.core.fact_events
    where block_timestamp>='2022-09-01'
    and (event_type='delegate' or event_type='deactivate' or instruction:programId='Stake11111111111111111111111111111111111111')
    and event_type is not null
    group by 1
    )
    SELECT
    x.date,
    x.tx_count as total_tx,
    sum(total_tx) over (order by x.date) as cum_tx,
    y.tx_count as staked_tx,
    sum(staked_tx) over (order by x.date) as cum_staked_tx,
    (staked_tx/total_tx)*100 as pcg_staking_tx,
    100-pcg_staking_tx as pcg_non_staking_tx
    from all_tx x, staked_tx y where x.date = y.date
    order by 1 asc
    Run a query to Download Data