With newWallet as (select
MIN(DATE(block_timestamp)) as first_date,
signers[0] as signers
from solana.core.fact_transactions
group by 2),
newUsers as (select
first_date,
count(distinct signers) as new_users
from newWallet
group by 1 )
select
DATE(block_timestamp) as dayz,
count (distinct t.signers[0]) as Users,
new_users,
users - coalesce(new_users, 0) as existing_users
from solana.core.fact_transactions t
left join newUsers ON first_date = t.block_timestamp::date
group by 1 , 3
having dayz >= '2022-01-01'