winnie-fs2024-01-18 09:12 AM
    Updated 2024-01-18
    with

    -- ETH

    A as( select block_timestamp, eth_from_address as whale, eth_to_address as bridge from ethereum.core.ez_eth_transfers union all
    select block_timestamp, eth_to_address as whale, eth_from_address as bridge from ethereum.core.ez_eth_transfers union all
    select block_timestamp, from_address as whale, to_address as bridge from ethereum.core.ez_token_transfers union all
    select block_timestamp, to_address as whale, from_address as bridge from ethereum.core.ez_token_transfers
    ),

    B as( select whale, min(block_timestamp) as first_time
    from A
    where bridge in ( '0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419',
    '0xf6080d9fbeebcd44d89affbfd42f098cbff92816',
    '0x283751a21eafbfcd52297820d27c1f1963d9b5b4',
    '0x0437465dfb5b79726e35f08559b0cbea55bb585c',
    '0xbb3400f107804dfb482565ff1ec8d8ae66747605',
    '0xbf67f59d2988a46fbff7ed79a621778a3cd3985b',
    '0xcf58536d6fab5e59b654228a5a4ed89b13a876c2')
    group by 1),

    C as( select date_trunc('month',first_time) as day, count(*) as new_user
    from B
    group by 1),

    D as( select *, sum(new_user) over (order by day) as total_user
    from C)

    select day,
    new_user as "New users",
    total_user as "Total users",
    total_user - new_user as "Retained users"
    from D
    order by day desc
    Last run: about 1 year ago
    DAY
    New users
    Total users
    Retained users
    1
    2024-02-01 00:00:00.000318312537341250551
    2
    2024-01-01 00:00:00.000672912505511243822
    3
    2023-12-01 00:00:00.000765812438221236164
    4
    2023-11-01 00:00:00.0004882012361641187344
    5
    2023-10-01 00:00:00.00011289811873441074446
    6
    2023-09-01 00:00:00.0002484571074446825989
    7
    2023-08-01 00:00:00.000181679825989644310
    8
    2023-07-01 00:00:00.000107632644310536678
    9
    2023-06-01 00:00:00.00080558536678456120
    10
    2023-05-01 00:00:00.00064063456120392057
    11
    2023-04-01 00:00:00.000137952392057254105
    12
    2023-03-01 00:00:00.000124822254105129283
    13
    2023-02-01 00:00:00.00011674129283117609
    14
    2023-01-01 00:00:00.00012437117609105172
    15
    2022-12-01 00:00:00.0002915610517276016
    16
    2022-11-01 00:00:00.000270197601648997
    17
    2022-10-01 00:00:00.000153984899733599
    18
    2022-09-01 00:00:00.00028253359930774
    19
    2022-08-01 00:00:00.00046583077426116
    20
    2022-07-01 00:00:00.00046562611621460
    24
    1KB
    43s