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:

from_addressto_addressamountevent

X

Y

1250

X transfers 1250 tokens to Y

In credit debit, it will be represented two rows.

address counterparty_address amountevent

X

Y

-1250

X decrease 1250 tokens to Y

Y

X

1250

Y increase 1250 tokens from

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

Column NameDescriptionExample (Credit) Example (Debit)

address

Address of the account that was credited or debited value amount of token

0x72e77c9c17ca1c99bd9eb2f1011c752431625533

0xd387a6e4e84a6c86bd90c158c6028a58cc8ac459

counterparty_address

The address of counter party of this credit or debit transfer.

0xd387a6e4e84a6c86bd90c158c6028a58cc8ac459

0x72e77c9c17ca1c99bd9eb2f1011c752431625533

token_address

Token address of the asset transferred. Note: Native ETH does not have a contract address, but for convention, it is labelled as: 0x0000000000000000000000000000000000000000

0x0000000000000000000000000000000000000000

0x0000000000000000000000000000000000000000

token_name

Name of the asset transferred.

ETH

ETH

token_symbol

Token symbol of the asset transferred.

ETH

ETH

raw_amount

Amount of tokens moved (unnormalized). For ERC721 and ERC1155 tokens, there are no decimals division involved.

-9E+15

9E+15

amount

Amount of token moved, normalized.

-0.009

0.009

usd_amount

The amount of tokens moved, in $USD.

-7.731

7.731

usd_exchange_rate

Token symbol of this token.

859

859

transaction_hash

Transaction hash that this transfer belongs to.

0x1c2eb8b98e9917b30e402d519c1545116e7432699dffced4041c980cd8b6a4d6

0x1c2eb8b98e9917b30e402d519c1545116e7432699dffced4041c980cd8b6a4d6

block_timestamp

The timestamp of the block that the corresponding transaction of this transfer belongs to. This is also the timestamp when this transfer occurred.

2018-02-04T16:10:48

2018-02-04T16:10:48

block_number

The block number that the corresponding transaction of this transfer belongs to.

5030097

5030097

block_hash

The block hash that the corresponding transaction of this transfer belongs to.

0xea0ad2b10c2815f54a925c13161a252848ff9814cc49b16060c4a0782630bd38

0xea0ad2b10c2815f54a925c13161a252848ff9814cc49b16060c4a0782630bd38

token_type

The type of asset transferred. Currently supports ETH, ERC20, ERC721 and ERC1155 tokens.

ETH

ETH

unique_id

Unique id generated to each transfer. Includes transaction hash, log index and credit and debit transaction type.

trace-call_0x1c2eb8b98e9917b30e402d519c1545116e7432699dffced4041c980cd8b6a4d6_6_credit

trace-call_0x1c2eb8b98e9917b30e402d519c1545116e7432699dffced4041c980cd8b6a4d6_6_debit

Last updated