Query editor
WITH RECURSIVETransactionHierarchy ("from","to",depth,total_value,transaction_count) AS (SELECTet1."from",et1."to",1 AS depth,SUM(CAST(et1.value AS DOUBLE)) AS total_value,COUNT(et1.evt_tx_hash) AS transaction_countFROMerc20_ethereum.evt_transfer AS et1WHERE-- et1.contract_address = {{contract_address}}-- ANDet1.to = {{address}}OR et1."from" = {{address}} -- 查询起始地址GROUP BYet1."from",et1.toHAVINGCOUNT(et1.evt_tx_hash) > 0UNION ALL-- 递归查找相关交易SELECTet2."from",et2."to",th.depth + 1 AS depth,SUM(CAST(et2.value AS DOUBLE)) AS total_value,COUNT(et2.evt_tx_hash) AS transaction_countFROMerc20_ethereum.evt_transfer AS et2INNER JOIN TransactionHierarchy th ON et2."to" = th."from"OR et2."from" = th."to"WHERE-- et2.contract_address = {{contract_address}}-- ANDth.depth < {{hop}}GROUP BYet2."from",et2."to",th.depthHAVINGCOUNT(et2.evt_tx_hash) > 0),RankedTransactions ("from","to",depth,total_value,transaction_count,rn) AS (SELECT"from","to",