BlockTrackeractive vs new contracts
    Updated 2025-04-06
    -- forked from active vs new contracts @ https://flipsidecrypto.xyz/studio/queries/6394b0dc-84a9-428a-ba2d-bd0a38c06a8f

    with contract_list as (
    select
    distinct to_address as address
    from swell.core.fact_traces
    where type ilike '%CREATE%'
    and TX_SUCCEEDED
    and input <> '0x'
    and to_address is not null
    and ORIGIN_FUNCTION_SIGNATURE <> '0x'
    )
    ,
    total_new_contract as (
    select
    date_trunc('{{granularity}}', first_tx) as date,
    count(distinct address) as new_contract
    from (
    select
    to_address as address,
    min(block_timestamp) as first_tx
    from swell.core.fact_transactions
    where 1 = 1
    and to_address IN (select address from contract_list)
    group by 1
    )
    group by 1
    )
    , total_active_contract as (
    select
    date_trunc('{{granularity}}', block_timestamp) as date,
    count(distinct to_address) as active_contract
    from swell.core.fact_transactions
    where 1=1
    and to_address IN (select address from contract_list)
    group by 1
    Last run: 22 days ago
    DATE
    ACTIVE_CONTRACT
    NEW_CONTRACT
    RETURNING_CONTRACT
    1
    2025-01-10 00:00:00.00043241
    2
    2025-03-22 00:00:00.00071170
    3
    2025-02-16 00:00:00.00061358
    4
    2025-03-02 00:00:00.00070664
    5
    2025-01-19 00:00:00.00052151
    6
    2025-03-19 00:00:00.00078375
    7
    2025-03-15 00:00:00.00063162
    8
    2025-03-14 00:00:00.00086383
    9
    2025-02-17 00:00:00.00062260
    10
    2025-03-31 00:00:00.000319169150
    11
    2025-02-13 00:00:00.000963462
    12
    2024-12-20 00:00:00.000561937
    13
    2025-02-20 00:00:00.0005656
    14
    2024-12-27 00:00:00.000592237
    15
    2025-02-09 00:00:00.00066462
    16
    2025-03-06 00:00:00.00018710681
    17
    2025-01-30 00:00:00.00059356
    18
    2025-03-11 00:00:00.00077374
    19
    2025-01-01 00:00:00.00044242
    20
    2025-02-15 00:00:00.0006363
    ...
    128
    5KB
    2s