Get real-time updates when an ERC20 token is transferred.
Chain | Mainnet |
---|---|
Ethereum | ✅ |
Introduction
The Token Activity webhook allows you to track ERC20 token contracts. This provides your app with real-time state changes when a token is transferred between addresses.
Example Response
When a token (ERC20) from the token contracts that you are tracking gets transferred, you receive a response from the webhook that looks like this:
{
"id": "22bd25c3707b47f080779769db051f51",
"webhookId": "f0e0cedb-3d41-481d-ad1d-688f5856563b",
"type": "TOKEN",
"createdAt": "2023-09-10T13:36:39Z",
"event": {
"network": "eth-mainnet",
"activity": [
{
"category": "erc20",
"fromAddress": "0xfc20411184af8888b353b5ae7a214e0f2df13256",
"toAddress": "0x24b6b95dd1aea292903fbe88c7e1cb863e18b84a",
"amount": "147797700",
"tokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"log": {
"blockNumber": 18106314,
"blockHash": "0x0e0f53cc93b92048cc52df57f775ccd9a86c74a264a76cc94707342a16e99520",
"transactionHash": "0x4ba02061e536ce80e20c6c42de25dad8b9a775571707a58bffa5862ce310c684",
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"data": "0x0000000000000000000000000000000000000000000000000000000008cf36c4",
"logIndex": "0xec",
"remove": false,
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000fc20411184af8888b353b5ae7a214e0f2df13256",
"0x00000000000000000000000024b6b95dd1aea292903fbe88c7e1cb863e18b84a"
],
"timestamp": 1694352995
}
}
]
}
}
Field Definitions
Below you can find descriptions for each field of the response.
Field | Description | Value |
---|---|---|
id | ID of the event. | 22bd25c3707b47f080779769db051f51 |
webhookId | Unique ID of the webhook destination. | f0e0cedb-3d41-481d-ad1d-688f5856563b |
type | Webhook event type. | TOKEN |
createdAt | Timestamp when the event notification was created. | 2023-09-10T13:36:39Z |
event | Activity object. | N/A |
network | The default network for the webhook. | eth-mainnet |
activity | List of transfer events whose from or to address matches the address configured in the Token Activity webhook. | N/A |
category | The erc-20 data standard. | erc20 |
fromAddress | Transfer from address. | 0xfc20411184af8888b353b5ae7a214e0f2df13256 |
toAddress | Transfer to address. | 0x24b6b95dd1aea292903fbe88c7e1cb863e18b84a |
amount | Transferred value amount. | 147797700 |
tokenAddress | The erc20 contract address. | 0xdac17f958d2ee523a2206206994597c13d831ec7 |
log | Returned log of the Token Activity event. | N/A |
blockNumber | The number of the block including this transaction. | 18106314 |
blockHash | A hash of the block including this transaction. | 0x4887f8bfbba48b7bff0362c34149d76783feae32f29bff3d98c841bc2ba1902f |
transactionHash | Transaction block number. | 0x4ba02061e536ce80e20c6c42de25dad8b9a775571707a58bffa5862ce310c684 |
address | Log origination address. | 0xdac17f958d2ee523a2206206994597c13d831ec7 |
data | Non-indexed arguments of the log. | 0x0000000000000000000000000000000000000000000000000000000008cf36c4... |
logIndex | ID of the event. | 0xec |
removed | Transaction is in a chain re-org tag. | false |
topics | An array of zero to four 32 bytes of indexed log arguments. | ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x000000000000000000000000fc20411184af8888b353b5ae7a214e0f2df13256", "0x00000000000000000000000024b6b95dd1aea292903fbe88c7e1cb863e18b84a"] |
timestamp | Block time. | 1694352995 |
How to Set Up Token Activity Webhooks
- Navigate to the Webhook tab in your ZAN Dashboard.
- Click the Create New button.
- Set a name of the webhook. Then Token template in the dropdown.
- Select your Chain in the dropdown. Then choose your Network.
- Paste your token contract address into the Contract Address field.
- Paste your unique webhook URL into the WEBHOOK URL field.
- Select all address events that you need to get notifications in Event dropdown.
- Test your webhook by clicking the TEST button.
- After the test is successful, click Confirm. Your webhook appears in the list.
- Check your endpoint to see the responses.
Note:
For more detailed steps on how to set up token activity webhooks, please refer to Create a New Webhook.