kiacryptoNumber of votes and unique voters
Updated 2023-02-25Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
›
⌄
with votes as (
select
date_trunc('day', block_timestamp) as date,
count(distinct tx_id) as votes_count,
(select count(distinct tx_id) from cosmos.core.fact_msg_attributes where attribute_key = 'proposal_id' and attribute_value= '93') as total_votes
from cosmos.core.fact_msg_attributes
where
attribute_key = 'proposal_id' and
attribute_value= '93'
group by 1
),
voters as (
select
date_trunc('day', t.block_timestamp) as day,
count(distinct tx_from) as unique_voters,
(select count(distinct tx_from) from cosmos.core.fact_transactions t join cosmos.core.fact_msg_attributes m on t.tx_id = m.tx_id where attribute_key = 'proposal_id' and attribute_value= '93') as total_unique_voters
from cosmos.core.fact_transactions t join cosmos.core.fact_msg_attributes m on t.tx_id = m.tx_id
where
attribute_key = 'proposal_id' and
attribute_value= '93'
group by 1
)
select *
from votes join voters on date = day
Run a query to Download Data