Links

erc20_transfers

Get the history of ERC20 transfer events for any address without scanning the entire chain.
Through erc20_transfers, you can fetch all the transfer events. If you only fill in the contract address, the API will return all transfer events associated with specified contract.
Supported on Ethereum, BNB Chain, Optimism, and Arbitrum.

Parameters

Object - An object with the following fields (required):
  • contractAddress(hex string, optional) - the ERC20 contact address to filter for.
  • fromBlockNumber(integer number, optional) - the starting time range you want to fetch events over.
  • toBlockNumber(integer number, optional) - the ending time range you want to fetch events over.
  • fromAddress(hex string, optional) - the sending address in the transaction.
  • toAddress(hex string, optional) - the receiving address in the transaction.
  • pageSize(integer number, optional, default 100) - max number of results to return per call.
  • pageIndex(integer number, optional, default 1) - page index.

Returns

Object - An object with the following fields:
  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • result(object) - an object with the following fields:
    • nextPageIndex(integer number) - next page (if exists, else blank).
    • data(array of object, defined below) - response data, sorted in ascending order by block number.
  • Object schema:
    • blockNumber(integer number) - the block that the transaction was included in.
    • txHash(hex string) - the hash code for the transaction.
    • blockHash(hex string) - the hash code for the block.
    • logIndex(integer number) - the index number for the log.
    • from(hex string) - from address of transfer.
    • to(hex string) - to address of transfer.
    • value(string) - transfer value.
    • contractAddress(hex string) - contract address.

Example

Request

curl
TypeScript
curl https://api.blockvision.org/v1/<api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "erc20_transfers",
"params": {
"fromBlockNumber": 0,
"toBlockNumber": 0,
"fromAddress":"0x562680a4dC50ed2f14d75BF31f494cfE0b8D10a1",
"toAddress": "",
"contractAddress":"0xdAC17F958D2ee523a2206206994597C13D831ec7",
"pageSize": 3,
"pageIndex": 1
}
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.ETH_MAINNET)
// Access the BlockVision FT API
bv.getERC20Transfers({}).then(console.log)

Result

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"data": [
{
"value": "1",
"contractAddress": "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB",
"blockNumber": 13950507,
"txHash": "0x72ced44bd171d76550d2cbe322da4284cc13c7a0229f1c14ce33514ecfe941ce",
"blockHash": "0x9c25640b85fa3ff82f8f943ae15ebe233f5014f2f96c4e2f7ce4915e579e1fff",
"logIndex": 401,
"from": "0xB0fb2ceba0486f616758670DaE5Fb10b2b92DDf2",
"to": "0x269616D549D7e8Eaa82DFb17028d0B212D11232A"
},
{
"value": "1",
"contractAddress": "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB",
"blockNumber": 13950233,
"txHash": "0x6f321326a27f67c72f9e5ac1108b7ec268645575ad1356660d39755af5e30da9",
"blockHash": "0xd66e250c7d162c67b57d1599e030785c676280b97dd5d3424b602cf02d772a9b",
"logIndex": 49,
"from": "0xDC5556Ff5F67B71BF4b9Ca04cE953a54663913E6",
"to": "0x4e97fa0644605F10D0B8a12Ed4A9aFA43b5685c2"
},
{
"value": "1",
"contractAddress": "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB",
"blockNumber": 13950070,
"txHash": "0x21bff592ba45f606e3817261b5996f86840d931d5e34921e031dac20535b7d8c",
"blockHash": "0xea0e65b7e9c8f3fb6a328bf77b5be0dc1f39efc3c7f3f453ca9ffb2c5db4af4d",
"logIndex": 360,
"from": "0xd12E276F76A55af8558e149b5EfEb6aa3a64eE84",
"to": "0x98ca30f9caA3c7e28Fb6840F92F07e0e5892EFFf"
}
],
"nextPageIndex": 2,
}
}