adriaparcerisasThorchain Nodes Table
Updated 2024-06-15
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
new_nodes as (
select
trunc(block_timestamp,'week') as date,
count(distinct node_address) as new_nodes
from thorchain.gov.fact_new_node_events
group by 1
order by 1 desc
),
weekly_bonded_nodes AS (
SELECT
trunc(block_timestamp, 'week') AS date,
to_address
FROM thorchain.defi.fact_bond_actions
WHERE to_address IN (
SELECT DISTINCT node_address
FROM thorchain.gov.fact_new_node_events
)
GROUP BY 1, to_address
),
distinct_bonded_nodes AS (
SELECT
date,
to_address,
DENSE_RANK() OVER (PARTITION BY to_address ORDER BY date) AS rn
FROM weekly_bonded_nodes
QUALIFY rn = 1
),
cumulative_bonded_nodes AS (
SELECT
date,
COUNT(DISTINCT to_address) AS bonded_nodes,
SUM(COUNT(DISTINCT to_address)) OVER (ORDER BY date) AS cumulative_bonded_nodes
FROM distinct_bonded_nodes
GROUP BY date
),
QueryRunArchived: QueryRun has been archived