Skip to content
Xavier Damman edited this page Feb 8, 2024 · 2 revisions

Welcome to the indexer wiki!

Useful queries

Keeping track of useful SQL queries to get some data out of the indexer.

Note: table name is t_transfers_:chainId_:tokenAddress.

Active accounts

Number of distinct accounts that made transactions (outside of minting and topping up)

SELECT count(distinct from_addr) as unique_accounts, count(*) as transactions, SUM(value::integer/1000000)  as total_transactions
FROM t_transfers_137_0x5491a3d35f148a44f0af4d718b9636a6e55ebc2d
WHERE from_addr != '0x0000000000000000000000000000000000000000'
  AND to_addr != '0x0000000000000000000000000000000000000000'
  AND from_addr != '0x5736A617711d11f92A9f6C32f9f8d01F88b832BA' -- @topup

Number of people who topped up

SELECT count(distinct to_addr) as unique_toppers, count(*) as transactions, SUM(value::integer/1000000)  as total_transactions
FROM t_transfers_137_0x5491a3d35f148a44f0af4d718b9636a6e55ebc2d
WHERE from_addr = '0x5736A617711d11f92A9f6C32f9f8d01F88b832BA' -- @topup

Customers of an account

SELECT count(distinct from_addr) as unique_customers, count(*) as transactions, SUM(value::integer/1000000)  as total_transactions
FROM t_transfers_137_0x5491a3d35f148a44f0af4d718b9636a6e55ebc2d
WHERE to_addr = '0x34C4360bd268a9d615Bc3382f35792e03C026Ca7' -- @cryptobar
SELECT count(distinct from_addr) as unique_donors, count(*) as transactions, SUM(value::integer/1000000)  as total_transactions
FROM t_transfers_137_0x5491a3d35f148a44f0af4d718b9636a6e55ebc2d
WHERE to_addr = '0x6C2Df884CA32903bB6354Dcc9FF1d37Fc3F9066e' -- @pizza
Clone this wiki locally