datavortexclassic-amaranth
    Updated 2024-11-29
    WITH staking_actions AS (
    SELECT
    action,
    node_id
    FROM
    flow.gov.ez_staking_actions
    WHERE
    tx_succeeded = TRUE
    AND action IN (
    'NewNodeCreated',
    'TokensCommitted',
    'TokensStaked',
    'NodeRemovedAndRefunded',
    -- 'NodeTokensRequestedToUnstake',
    'DelegatorTokensStaked',
    'DelegatorTokensCommitted',
    'DelegatorTokensUnstaking'
    )
    )
    SELECT
    COUNT(DISTINCT node_id) AS total_nodes
    FROM
    staking_actions;