Query editor
/* ===================================================STAGE 1b (part 1): DEPOSIT ADDRESSESSave as dune.boc.result_deposit_addresses.Classifies each Stage 1a deposit candidate (sent to a country's exchanges5+ times, received nothing back but gas) by what it does with its money:- deposit_address: forwards 95%+ of its outgoing value to thatcountry's exchanges and has at most 10 distinctfunders. Exchange infrastructure; its funders arethe customers (part 2).- forwarding_service: forwards 95%+ to the exchanges but has more than 10funders (payment processors, other exchanges'unlabelled wallets, contracts). Not a user, nofunders linked.- user: sends less than 95% of its outgoing value to theexchanges, so it is not a deposit address but auser who only deposits. Has 5+ transfers to theexchanges, so it joins the sample as a direct link(Stage 1e).Gas-fee rows (native transfers to block fee recipients) are left out ofoutgoing value, except where the fee recipient is a labelled exchangeaddress (exchanges that run validators). A candidate whose outgoing valuecannot be measured is classed 'unmeasured' (check how many; treated asplumbing, not a user). Same transfer rule as Stage1a: native ETH and priced tokens above zero.=================================================== */WITH candidates AS (SELECT wallet AS address, country, n_deposit, deposit_usdFROM dune.boc.result_wallet_country_linksWHERE link_class = 'deposit_candidate'),candidate_addresses AS (SELECT DISTINCT address FROM candidates),all_cex AS (SELECT DISTINCT address FROM cex.addresses WHERE blockchain = 'ethereum'),fee_recipients AS (-- block fee recipients, except labelled exchange addresses: some-- exchanges run validators that pay into their own hot wallets, and-- deposits into those wallets must still count as forwardingSELECT DISTINCT b.miner AS addressFROM ethereum.blocks bWHERE b.date >= DATE '2021-01-01' AND b.date < DATE '2026-01-01'AND NOT EXISTS (SELECT 1 FROM all_cex a WHERE a.address = b.miner)),xfers AS (SELECT "from" AS src, "to" AS dst, amount_usdFROM tokens_ethereum.transfersWHERE block_month >= DATE '2021-01-01'AND block_month < DATE '2026-01-01'AND amount > 0AND (token_standard = 'native' OR amount_usd IS NOT NULL)),