mo115ETH all time stake - By Withdrawal Address
    Updated 2024-09-17
    with base as (
    SELECT
    COALESCE(WITHDRAWAL_ADDRESS, 'empty') as WITHDRAWAL_ADDRESS
    , SUM(deposit_amount) as eth_staked --NOT always 32E
    from ethereum.beacon_chain.ez_deposits
    WHERE 1=1
    GROUP by WITHDRAWAL_ADDRESS

    UNION ALL
    SELECT
    COALESCE(WITHDRAWAL_ADDRESS, 'empty') as WITHDRAWAL_ADDRESS
    , SUM(CASE
    WHEN WITHDRAWAL_AMOUNT BETWEEN 20 AND 32 THEN -WITHDRAWAL_AMOUNT ---Slashed validators exiting
    WHEN WITHDRAWAL_AMOUNT>32 THEN -32 ----Normal validator exit with possible rewards
    END
    ) as eth_staked
    from ethereum.beacon_chain.ez_withdrawals
    WHERE 1=1
    GROUP BY WITHDRAWAL_ADDRESS
    )

    SELECT
    SUM(eth_staked) as total_eth
    , ROUND(total_eth/32,0) as validators
    from base


    QueryRunArchived: QueryRun has been archived