Query editor
-- created with github.com/ohld/ton-analyst-- TON wallets by lifetime transaction count: how many, and how much network fees they paid.-- "Wallet" = account with a wallet_* interface in ton.accounts (excludes jetton wallets, pools, NFT items).-- "Tx" = a transaction executed on that account (same number a block explorer shows), all time.-- "Fee" = ton.transactions.total_fees (storage + gas + action fees) charged to that account.-- fees_with_fwd_ton additionally adds the forward fee the sender pays to the-- destination shard: action_total_fwd_fees - action_total_action_fees.WITH wallets AS (SELECT addressFROM ton.accountsWHERE cardinality(FILTER(interfaces, i -> regexp_like(i, '^wallet_'))) > 0),per_wallet AS (SELECTt.account AS address,COUNT(*) AS tx_count,SUM(t.total_fees) AS fees_nano,SUM(COALESCE(t.action_total_fwd_fees, 0) - COALESCE(t.action_total_action_fees, 0)) AS fwd_nanoFROM ton.transactions tJOIN wallets w ON w.address = t.accountGROUP BY 1)SELECTCASEWHEN tx_count > 5 THEN 'more than 5 tx'WHEN tx_count = 5 THEN 'exactly 5 tx'ELSE 'less than 5 tx'END AS cohort,COUNT(*) AS wallets,SUM(tx_count) AS transactions,SUM(fees_nano) / 1e9 AS fees_ton,SUM(fees_nano + fwd_nano) / 1e9 AS fees_with_fwd_ton,SUM(fees_nano) / 1e9 / COUNT(*) AS avg_fees_ton_per_walletFROM per_walletGROUP BY 1ORDER BY 2 DESC