Query editor
-- ML-Enhanced Tornado Cash Analysis-- ℭ𝔦𝔭𝔥𝔢𝔯-- still highly experimental - errors are known on normalizationwith constants as (select0xa160cdab225685da1d56aa342ad8841c3b53f291 as target_contract, 0xe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c34931 as target_topic, timestamp '2025-02-22 07:00:00' as start_time, timestamp '2025-06-02 07:01:10' as end_time, decimal '1000000000000000000.0' as wei_divisor),daily_counts as (selectethereum.logs.block_date,count(distinct ethereum.logs.tx_hash) as daily_withdrawal_countfrom ethereum.logsinner join ethereum.transactions on ethereum.logs.tx_hash = ethereum.transactions.hashwhereethereum.logs.contract_address = (select target_contract from constants)and ethereum.logs.topic0 = (select target_topic from constants)and ethereum.transactions.success = trueand ethereum.logs.block_time between (select start_time from constants) and (select end_time from constants)and ethereum.transactions.block_time between (select start_time from constants) and (select end_time from constants)group by ethereum.logs.block_date),recipient_counts as (selectvarbinary_substring(ethereum.logs.data, 13, 20) as recipient_address,count(distinct ethereum.logs.tx_hash) as recipient_frequencyfrom ethereum.logsinner join ethereum.transactions on ethereum.logs.tx_hash = ethereum.transactions.hashwhereethereum.logs.contract_address = (select target_contract from constants)and ethereum.logs.topic0 = (select target_topic from constants)and ethereum.transactions.success = trueand ethereum.logs.block_time between (select start_time from constants) and (select end_time from constants)and ethereum.transactions.block_time between (select start_time from constants) and (select end_time from constants)group by varbinary_substring(ethereum.logs.data, 13, 20)),base_data as (selectto_unixtime(ethereum.logs.block_time) as unix_ts, ethereum.logs.block_time as block_ts, ethereum.logs.block_date as date, ethereum.logs.tx_hash as tx_hash, varbinary_substring(ethereum.logs.data, 13, 20) as _recipient, ethereum.logs.tx_from as _relayer, recipient_counts.recipient_frequency as tc_recipient_freq, daily_counts.daily_withdrawal_count, varbinary_to_uint256(varbinary_substring(ethereum.logs.data, 65, 32)) / 1000000000.0 as tc_fee_eth, varbinary_to_uint256(varbinary_substring(ethereum.logs.data, 65, 32)) as tc_fee_wei, ethereum.transactions."from" as tx_from, ethereum.transactions."to" as tx_to, ethereum.transactions.type as tx_type, ethereum.transactions.nonce as nonce, round(ethereum.transactions.gas_used * 100.0 / ethereum.transactions.gas_limit, 1) as round_mana_ratio, round(ethereum.transactions.gas_used * 100.0 / ethereum.transactions.gas_limit, 3) as mana_ratio, ethereum.transactions.gas_limit as mana, ethereum.transactions.gas_price as mana_price