pine_samiEthereum & NEAR active validators
    Updated 2022-11-15
    WITH ETH_validator AS
    (
    SELECT date_trunc('{{date_range}}', block_timestamp) as date,
    SUM(AMOUNT)/32 as number_of_validators
    FROM ethereum.core.ez_eth_transfers
    WHERE ETH_TO_ADDRESS = '0x00000000219ab540356cbb839cbe05303d7705fa'
    and AMOUNT='32'
    GROUP BY 1
    ),
    NEAR_validators as
    (
    SELECT
    date_trunc('{{date_range}}', a.block_timestamp) as date,
    count (distinct tx_receiver) as validator
    FROM near.core.fact_actions_events_function_call a
    JOIN near.core.fact_transactions b ON a.tx_hash = b.tx_hash
    WHERE method_name = 'deposit_and_stake'
    group by 1
    )
    select 'Ethereum' as chain, date, number_of_validators from ETH_validator
    where date between '2022-11-06'and CURRENT_DATE-1
    UNION ALL
    select 'NEAR' as chain, date, validator from NEAR_validators
    where date between '2022-11-06'and CURRENT_DATE-1


    Run a query to Download Data