0xHaM-dBLAST - Hourly New User Changes
    Updated 2024-08-01
    -- forked from Aptos - Daily New User Changes [Last 30Days] @ https://flipsidecrypto.xyz/edit/queries/324fc5c0-58e9-4ecc-98bf-b9204a4cef5a

    -- forked from Aptos - Weekly New User Changes @ https://flipsidecrypto.xyz/edit/queries/deafce86-8ce3-4682-9e33-0ceffd593280

    -- forked from Terra - Weekly New User Changes @ https://flipsidecrypto.xyz/edit/queries/0088c4b6-cf30-47ac-917d-a95b8210f0eb

    with new_user as (
    SELECT
    FROM_ADDRESS as user,
    min(block_timestamp) as first_transactions_timestamp
    FROM blast.core.fact_transactions
    GROUP BY 1
    )
    select
    date_trunc('d', first_transactions_timestamp) as "Date",
    count(distinct user) as "New User Count",
    sum("New User Count") over (order by "Date") as "New User Growth Trends",
    count(distinct user) - lag(count(distinct user)) over (order by "Date") as "Hourly Change",
    case
    when "Hourly Change" > 0 then 'Increase'
    when "Hourly Change" < 0 then 'Decrease'
    else 'Unchanged'
    end as "Status"
    from new_user
    WHERE "Date" < current_date()
    group by "Date"
    having "Date" is not null
    order by "Date", "Status"