Native Transfers
A special opt-in configuration for indexing native token transfers such as "ETH", in the form of "ERC20"-like transfer events.
You can expect the event to be defined as if you were indexing an ERC20 Transfer event.
Supported stream providers:
- Simple - Simple opt-in (for csv, and postgres)
- Complex - Complex indexing configuration with stream providers
Simple
The "simple" opt-in is done via including the top level yaml native_transfers: true
. This has a few special properties
and is designed to kickstart simple persistence based indexing of native transfers.
By default, this means:
- All networks defined in
networks
will be enabled for native transfer indexing - All enabled
storage
options will be used - Native transfers will be indexed in
live
mode, from the latest block onwards.
The event will be persisted to storage under the event name NativeTransfer
.
name: rIndexer
description: My native transfers rindexer project
repository: https://github.com/joshstevens19/rindexer
project_type: no-code
networks:
- name: ethereum
chain_id: 1
# The rpc provider must support the `trace_block` rpc method
rpc: https://mainnet.gateway.tenderly.co
storage:
postgres:
enabled: true
native_transfers: true
contracts: []
Complex
The complex configuration is designed for more powerful configuration. Specifically if your use case is one of the following:
- You want historical
native transfer
indexing - You want to use one of the
stream
orchat
providers - You want to conditionally filter or alias the event name
- You want to only opt-in to specific networks for
native transfer
events
If you provide any networks
in the native_transfers
config it is equivalent to setting native_tranfers: true
and
you will be opted in to native transfer indexing for that network.
networks
The network name to listen for events on, this should match the network name in the networks section of the YAML.
name: rIndexer
description: My native transfers rindexer project
repository: https://github.com/joshstevens19/rindexer
project_type: no-code
networks:
- name: ethereum
chain_id: 1
rpc: https://mainnet.gateway.tenderly.co
native_transfers:
networks:
- network: ethereum
contracts: []
start_block
The block to start indexing from, you can use the deployed block if you wish to get everything.
name: rIndexer
description: My native transfers rindexer project
repository: https://github.com/joshstevens19/rindexer
project_type: no-code
networks:
- name: ethereum
chain_id: 1
rpc: https://mainnet.gateway.tenderly.co
native_transfers:
networks:
- network: ethereum
start_block: 0
contracts: []
end_block
name: rIndexer
description: My native transfers rindexer project
repository: https://github.com/joshstevens19/rindexer
project_type: no-code
networks:
- name: ethereum
chain_id: 1
rpc: https://mainnet.gateway.tenderly.co
native_transfers:
networks:
- network: ethereum
start_block: 18600000
end_block: 18718056
contracts: []
Multiple Networks
You can have multiple networks, this is useful if you must track native balances across a variety of networks.
name: rIndexer
description: My native transfers rindexer project
repository: https://github.com/joshstevens19/rindexer
project_type: no-code
networks:
- name: ethereum
chain_id: 1
rpc: https://mainnet.gateway.tenderly.co
- name: base
chain_id: 8453
rpc: https://base.gateway.tenderly.co
storage:
postgres:
enabled: true
native_transfers:
networks:
- network: ethereum
start_block: 18600000
end_block: 18718056
- network: base
start_block: 18118056
end_block: 18918056
reorg_safe_distance
Reorgs can happen on the chain, this is when a block is removed from the chain and replaced with another block.
This can cause issues with the indexer indexed state if you turn reorg_safe_distance
on it will keep a safe distance from the live
latest block to avoid any reorg issues.
Note if you are doing live indexing you will need to handle more advanced reorgs, support for advanced reorgs is in the backlog for rindexer.
name: rIndexer
description: My native transfers rindexer project
repository: https://github.com/joshstevens19/rindexer
project_type: no-code
networks:
- name: ethereum
chain_id: 1
rpc: https://mainnet.gateway.tenderly.co
- name: base
chain_id: 8453
rpc: https://base.gateway.tenderly.co
native_transfers:
networks:
- network: ethereum
- network: base
reorg_safe_distance: true
contracts: []
generate_csv
If you wish to generate a CSV file of the indexed data you can turn this on. This will be ignored if you do not have the CSV storage enabled. By default if this is not supplied and the CSV storage is enabled it will generate a CSV file.
name: rIndexer
description: My native transfers rindexer project
repository: https://github.com/joshstevens19/rindexer
project_type: no-code
networks:
- name: ethereum
chain_id: 1
rpc: https://mainnet.gateway.tenderly.co
native_transfers:
networks:
- network: ethereum
generate_csv: true
contracts: []
streams
The stream options for native_transfers
is equivalent to contract event indexing with one exception.
All streams provided will have the NativeTransfer
event enabled by default, so it does not need to be explicitly defined
unless special logic (e.g. aliasing event names) is desired.
Simple stream definition
That is because rindexer knows the single NativeTransfer
event should be included by default.
name: indexer
description: rindexer native transfers demo
project_type: no-code
networks:
- name: ethereum
chain_id: 1
rpc: https://mainnet.gateway.tenderly.co
native_transfers:
networks:
- network: ethereum
reorg_safe_distance: true
streams:
sns:
aws_config:
region: us-east-1
access_key: ${AWS_ACCESS_KEY_ID}
secret_key: ${AWS_SECRET_ACCESS_KEY}
topics:
- topic_arn: arn:aws:sns:us-east-1:000000000000:ethereum-transfers
networks:
- ethereum
contracts: []
Explicit events
definition
In this case, we want to explicitly configure the stream processing for the event.
name: indexer
description: rindexer native transfers demo
project_type: no-code
networks:
- name: ethereum
chain_id: 1
rpc: https://mainnet.gateway.tenderly.co
native_transfers:
networks:
- network: ethereum
reorg_safe_distance: true
streams:
sns:
aws_config:
region: us-east-1
access_key: ${AWS_ACCESS_KEY_ID}
secret_key: ${AWS_SECRET_ACCESS_KEY}
topics:
- topic_arn: arn:aws:sns:us-east-1:000000000000:ethereum-transfers
networks:
- ethereum
events:
- event_name: NativeTransfer
alias: ETHTransfer
contracts: []
chat
You can configure chat to send messages You can read more about it here.