kellenEthereum Retention Cohorts
Updated 2022-12-21
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 t0 AS (
SELECT DATE_TRUNC('month', block_timestamp) AS month
, from_address AS address
, 'Ethereum' AS chain
FROM ethereum.core.fact_transactions
WHERE block_timestamp >= '2021-01-01'
GROUP BY 1, 2, 3
), t1 AS (
SELECT address
, chain
, MIN(month) AS first_month
FROM t0
GROUP BY 1, 2
), t2 AS (
SELECT t0.chain
, t1.first_month
, COUNT(1) AS base_addresses
FROM t0
JOIN t1 ON t1.address = t0.address
AND t1.chain = t0.chain
AND t1.first_month = t0.month
GROUP BY 1, 2
), t3 AS (
SELECT t2.first_month
, t2.base_addresses
, t0.month
, t0.chain
, COUNT(1) AS n_active_addresses
FROM t0
JOIN t1 ON t1.address = t0.address
AND t1.chain = t0.chain
JOIN t2 ON t2.chain = t0.chain
AND t2.first_month = t1.first_month
GROUP BY 1, 2, 3, 4
)
Run a query to Download Data