Ali3NTop 10 Cosmos Validators With Most Number of Participated Proposals
    Updated 2023-02-22
    with terravalidators as (
    select REPLACE(ATTRIBUTE_VALUE, 'valoper', '') as validator_address1,
    left(validator_address1, 38) as Account_address
    from terra.core.fact_msg_attributes
    where ATTRIBUTE_KEY= 'source_validator'
    and tx_succeeded = 'TRUE'),

    maintable as (
    select 'Cosmos' as chain,
    account_address as Validator1,
    initcap(label) as Validator_name,
    count (distinct tx_id) as Votes_Count,
    count (distinct proposal_id) as Proposals_count
    from cosmos.core.fact_governance_votes t1 join cosmos.core.fact_validators t2 on t1.voter = t2.account_address
    where tx_succeeded = 'TRUE'
    group by 1,2,3

    union ALL

    select 'Osmosis' as chain,
    account_address as Validator1,
    initcap(label) as Validator_name,
    count (distinct tx_id) as Votes_Count,
    count (distinct proposal_id) as Proposals_count
    from osmosis.core.fact_governance_votes t1 join osmosis.core.fact_validators t2 on t1.voter = t2.account_address
    where tx_succeeded = 'TRUE'
    group by 1,2,3
    )

    select *
    from maintable
    where chain = 'Cosmos'
    order by Proposals_count desc
    limit 10
    Run a query to Download Data