nitsDistribution of addresses
    Updated 2022-08-10
    with addr as
    (SELECT address as ad, address_name as name from crosschain.address_labels
    where address_name ilike '%tornado%eth%' and project_name = 'tornado cash'
    ),
    senders as
    (SELECT tx_hash as tx, origin_from_address as sender from ethereum.core.fact_event_logs
    where contract_address = '0xd90e2f925da726b50c4ed8d0fb90ad053324f31b' and event_name = 'EncryptedNote'
    GROUP by 1,2)

    SELECT distribution, count(DISTINCT sender) as total_participants, sum(total_amt_sent) as total_val from
    (select *, case when total_amt_sent < pow(10,2) then 'a-less than 100$'
    when total_amt_sent>= pow(10,2) and total_amt_sent<pow(10,4) then 'b-100 to 10k'
    when total_amt_sent>= pow(10,4) and total_amt_sent<pow(10,5) then 'c-10k to 100k'
    when total_amt_sent>= pow(10,5) and total_amt_sent<pow(10,6) then 'd-100k to 1M'
    when total_amt_sent>= pow(10,6) and total_amt_sent<pow(10,7) then 'e-1M to 10M'
    when total_amt_sent>= pow(10,7) then '10M+' end as distribution from
    (SELECT sender, sum(amount_usd) as total_amt_sent, count(DISTINCT tx_hash) as total_txs
    from
    (SELECT block_timestamp, tx_hash, amount, amount_usd from ethereum.core.ez_eth_transfers
    where tx_hash in
    (SELECT tx_hash from ethereum.core.fact_event_logs
    where contract_address = '0xd90e2f925da726b50c4ed8d0fb90ad053324f31b' and event_name = 'EncryptedNote' )
    GROUP by 1,2,3,4 )
    inner join senders
    on tx=tx_hash
    GROUP by 1
    order by 2 desc))
    GROUP by 1
    order by 2 desc
    limit 10
    Run a query to Download Data