datavortexTotal Stakes By Top Validators
Updated 2024-12-01
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
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
WITH epoch_boundaries AS (
-- First Epoch
SELECT
DATE '2024-11-06' AS epoch_start,
DATE '2024-11-13' AS epoch_end
UNION
ALL -- Second Epoch
SELECT
DATE '2024-11-13',
DATE '2024-11-20'
UNION
ALL -- Third Epoch
SELECT
DATE '2024-11-20',
DATE '2024-11-27'
UNION
ALL -- 4th Epoch
SELECT
DATE '2024-11-27',
DATE '2024-12-04'
),
epoch_data AS (
SELECT
a.node_id,
SUM(CASE WHEN a.action = 'TokensCommitted' THEN a.amount ELSE 0 END) AS total_validator_committed,
COUNT(DISTINCT CASE WHEN a.action IN ('TokensCommitted', 'DelegatorTokensCommitted', 'TokensStaked') THEN a.node_id ELSE NULL END) AS validator_nodes,
SUM(CASE WHEN a.action = 'DelegatorTokensCommitted' THEN a.amount ELSE 0 END) AS total_delegator_committed,
COUNT(DISTINCT CASE WHEN a.action IN ('TokensStaked', 'DelegatorTokensCommitted', 'TokensCommitted') THEN a.delegator ELSE NULL END) AS total_delegators,
COUNT(DISTINCT a.tx_id) AS distinct_transactions,
SUM(a.amount) AS total_staked_amount
FROM
flow.gov.ez_staking_actions a
JOIN epoch_boundaries eb
ON a.block_timestamp >= eb.epoch_start
AND a.block_timestamp < eb.epoch_end
GROUP BY
QueryRunArchived: QueryRun has been archived