pouria-sharifzadGnosis Active Wallets By day
Updated 2022-07-30
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
›
⌄
with base_wallets as (
SELECT
COUNT(*) as txns,
from_address as wallet,
MAX(DATEADD('day', 90, date_trunc('day', block_timestamp))) as ddate_ul,
date_trunc('day', block_timestamp) as ddate
from gnosis.core.fact_transactions
GROUP BY ddate, wallet
),
dates as (
SELECT
-- first argument is unit of time to add, second is amount to increment, third is starting date
dateadd(day, '-' || row_number() over (order by null), current_date() + 1) as date
from table (generator(rowcount => 275))
),
mixer as (
SELECT
d.date,
b.wallet,
b.ddate,
b.ddate_ul
from dates d
INNER JOIN base_wallets b ON d.date<=ddate_ul AND d.date>=b.ddate
)
SELECT
date,
COUNT(DISTINCT wallet) as active_wallets
from mixer
GROUP BY date ORDER BY date ASC
Run a query to Download Data