with new_wallets as (
select
min(block_timestamp) as first_timestamp,
tx_sender
from terra.core.fact_transactions
group by tx_sender
),
festive_wallets as (
select
distinct tx_sender as address
from new_wallets
where first_timestamp >= '2022-12-01'
),
old_wallets as (
select
distinct tx_sender as address
from new_wallets
where first_timestamp < '2022-12-01'
),
old_tx as (
select
transactions.block_timestamp::date as date,
count(transactions.tx_id) as tx_count
from terra.core.fact_transactions as transactions
inner join old_wallets on transactions.tx_sender = old_wallets.address
where transactions.block_timestamp >= '2022-12-01'
group by date
),
new_tx as (
select
transactions.block_timestamp::date as date,
count(transactions.tx_id) as tx_count