WITH raw_txs AS (
SELECT
Date_trunc(month, block_timestamp) AS Month,
buyer_address
FROM
ethereum.nft.ez_nft_sales
WHERE
block_timestamp :: date >= CURRENT_DATE - INTERVAL '9 month'
AND platform_name = 'magic eden'
),
user_tx_counts AS (
SELECT
Month,
buyer_address AS user_address,
COUNT(1) AS tx_count
FROM
raw_txs
GROUP BY
Month, buyer_address
),
monthly_casual_users AS (
SELECT
month,
COUNT(DISTINCT user_address) AS casual_users
FROM
user_tx_counts
GROUP BY
month
)
SELECT
month,