m4ri4ncocho2024-03-13 01:45 PM
    Updated 2024-03-13
    --CLUSTERING ADDRESSES

    with ini as (
    SELECT distinct
    t.tx_id,
    i.PUBKEY_SCRIPT_ADDRESS as address
    from bitcoin.core.fact_transactions t
    inner join bitcoin.core.fact_inputs i
    on i.tx_id = t.tx_id
    where t.OUTPUT_COUNT < 3
    and t.input_count > 1
    and t.block_timestamp > '2024-03-10'
    and t.block_timestamp < '2024-03-12'
    ),
    --744364 addresses
    --130494 txs

    auxiliar as (
    SELECT distinct
    address,
    tx_id
    from ini
    ),

    cluster_1 as (
    SELECT
    address,
    max(tx_id) as label_1
    from auxiliar
    group by address

    ),
    --select count(distinct label_1) from cluster_1 --114898

    auxiliar_2 as (
    select distinct
    QueryRunArchived: QueryRun has been archived