Credit Debit

Credit Debit tables contain the amount and direction (credit/debit) of every transfer event of all assets (ETH, ERC20, ERC721 and ERC1155) across all Ethereum wallets. This table will include two rows for every event, with one row representing credit and one row representing debit. Asset-specific tables are also available for query.

Difference with transfers

Unlike token transfers, data here is organized into credit and debit rows (similar to the accounting concept called "double entry book").

Methodology

Using an ERC20 token as an example, a token transfer will be represented as follows:

In credit debit, it will be represented two rows.

Sample Query

Debit and credit of ETH from a particular transaction.

select * from ethereum.assets.credit_debit
where block_number = '5030097'
and transaction_hash = '0x1c2eb8b98e9917b30e402d519c1545116e7432699dffced4041c980cd8b6a4d6'

Getting the cumulative change of USDC holdings in Uniswap v3 USDC-WETH pool in the last 30 days

select
  date(block_timestamp) as date,
  token_name, 
  sum(amount) as delta,
  sum(delta) over (order by date) as net_change
from
  ethereum.assets.credit_debit
  where address = '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640' -- USDC-ETH Uniswap v3 5bp
  and token_address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' -- USDC Token Address
and current_date - date(block_timestamp) < 30
group by date, token_name
order by date desc 

Table Columns

Last updated