Sardius-0626Flow Blockchain SQL Practice
Updated 2022-12-05
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 total_wallets AS (
SELECT
min_date,
COUNT(proposer) new_wallets,
SUM(new_wallets) OVER (order by min_date ASC) AS total_wallets_to_date
FROM (
SELECT
proposer,
date_trunc('day', min(block_timestamp)) AS min_date
FROM flow.core.fact_transactions
GROUP BY proposer
)
GROUP BY min_date
),
active_wallets AS ( -- done any transaction in that month itself
SELECT
date_trunc('month', block_timestamp) AS month,
COUNT(distinct proposer) AS active_wallets
FROM flow.core.fact_transactions
GROUP BY month
)
SELECT
min_date,
new_wallets,
active_wallets,
total_wallets_to_date,
100 * (active_wallets / total_wallets_to_date) AS percent_of_active_over_total
FROM total_wallets
LEFT JOIN active_wallets
ON total_wallets.min_date = active_wallets.month
Run a query to Download Data