piperBased Rekt Chickens Mint - Number of new wallets
    Updated 2023-08-13
    WITH all_wallets AS (
    SELECT
    DISTINCT(ORIGIN_FROM_ADDRESS) AS wallets
    FROM
    base.core.fact_event_logs
    WHERE
    ORIGIN_TO_ADDRESS = lower('0x07f4ae64f236eacf81b4d798f0c6daf9d29e9cf3')
    ),

    first_tx_date_per_wallet AS (
    SELECT
    MIN(BLOCK_TIMESTAMP) AS first_tx,
    ORIGIN_FROM_ADDRESS
    FROM
    base.core.fact_event_logs
    WHERE
    ORIGIN_FROM_ADDRESS IN (SELECT wallets FROM all_wallets)
    GROUP BY ORIGIN_FROM_ADDRESS
    ),

    number_of_wallets AS (
    SELECT
    count(DISTINCT ORIGIN_FROM_ADDRESS) AS number_of_wallets
    FROM
    base.core.fact_event_logs
    WHERE
    ORIGIN_TO_ADDRESS = lower('0x07f4ae64f236eacf81b4d798f0c6daf9d29e9cf3')
    AND
    CONTRACT_ADDRESS = lower('0xc16706ae5eed1805990d92241add1662724e50f2')
    )

    SELECT
    count(ORIGIN_FROM_ADDRESS) AS number_of_new_wallets,
    ((SELECT number_of_wallets FROM number_of_wallets) - number_of_new_wallets) AS number_of_old_wallets
    FROM
    first_tx_date_per_wallet
    Run a query to Download Data