boomer77churn count
    Updated 2021-12-15
    with transition as (
    select date_trunc('month',block_timestamp) as block_month,
    event, block_id,
    event_attributes:missed_blocks as miss_block,
    event_attributes:address::string as address,
    label,
    case when label is null then address else label end as validator
    from terra.transitions a
    left join terra.labels b ON a.event_attributes:address = b.address
    where event = 'liveness'
    and block_timestamp >= '2021-01-01'
    order by 1 DESC
    ),

    counts as (select block_month, validator, count(event) as offline_count
    from transition
    where miss_block >
    group by 1,2)

    select validator, sum(offline_count) as Total_Offline
    from counts
    where validator != 'unknown'
    group by 1
    order by 2 desc
    Run a query to Download Data