Query editor
with-- Using transaction table-- t_in as (-- SELECT-- to-- , cast(value as double)/1e18 as val-- FROM ethereum.transactions-- WHERE block_time >= now() - interval '7' month-- ),-- t_out as (-- SELECT-- "from" as address-- , cast(value as double)/1e18 as valo-- , ((cast(gas_limit as double)+ cast(gas_price as double))*cast(gas_used as double))/1e18 as tx_fee-- FROM ethereum.transactions-- --LEFT JOIN ethereum.transactions t on t.hash = s.tx_hash and t.block_time = s.block_time-- WHERE block_time >= now() - interval '7' month-- ),-- balan as (-- SELECT-- to as address-- , sum( val - COALESCE((valo + tx_fee), 0)) as balance-- FROM t_in t-- LEFT JOIN t_out s on t.to = s.address-- GROUP BY 1-- )-- SELECT-- *-- FROM balan-- WHERE balance > 1000-- limit 1000tin as (SELECTto as address, cast(value as double)/1e18 as amountFROM ethereum.traceswhere to = 0x1b3cB81E51011b549d78bf720b0d924ac763A7C2),tout as (SELECTs."from" as address, cast(s.value as double)/1e18 as amount, ((cast(t.gas_limit as double)+ cast(t.gas_price as double))*cast(t.gas_used as double))/1e18 as tx_feeFROM ethereum.traces sLEFT JOIN ethereum.transactions t on s.tx_hash = t.hash and s.block_time = t.block_timeWHERE call_type NOT IN ('delegate_call', 'callcode', 'staticcall') OR NULLAND s."from" = 0x1b3cB81E51011b549d78bf720b0d924ac763A7C2),bal as (SELECTn.address, sum(n.amount - COALESCE(t.amount+t.tx_fee, 0)) as balanceFROM tin nRIGHT JOIN tout t on n.address = t.addressGROUP BY 1)select*from bal