API Reference

Custom Contract Webhook

Track any smart contract with its events, and monitor any transaction events when on-chain interaction occurs.

ChainMainnet
Ethereum

Introduction

ZAN's Custom Contract Webhooks allow you to track any smart contract with its events, and monitor any transaction events when on-chain interaction occurs. This provides you with unlimited data access and quick insight into the self-defined activity you require. Developers can understand any contract-based event, and focus on some activities based on the ABI of the smart contract so that Web3 developers can get a quick insight into the blockchain data they need.

Example Response

While we cannot provide an exact example for each potential notification, here is one potential response that highlights the nested structure of each notification generated from on-chain events.

{
    "id": "b1039dc23f5c470a8c78dc901d3d6c23",
    "webhookId": "8cb7a0dd-4181-4484-81fe-5d4315b19a04",
    "type": "CONTRACT",
    "createdAt": "2023-09-02T01:10:39Z",
    "event": {
        "network": "eth-mainnet",
        "activity": [
            {
                "category": "custom_contract",
                "contractAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "transactionHash": "0xa63d915009f5d8de69aadbcae7287ebb268875cb91f390f44e16fa2528e74e0b",
                "blockHash": "0x361282a1a7ce3d54bd9ca10880bf805f0d3e866d8b601b07c51fa533f5e9c3c8",
                "blockNumber": 18045476,
                "log": {
                    "blockNumber": 18045476,
                    "blockHash": "0x361282a1a7ce3d54bd9ca10880bf805f0d3e866d8b601b07c51fa533f5e9c3c8",
                    "transactionHash": "0xa63d915009f5d8de69aadbcae7287ebb268875cb91f390f44e16fa2528e74e0b",
                    "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                    "data": "0x00000000000000000000000000000000000000000000000000470de4df820000",
                    "logIndex": "0xea",
                    "remove": false,
                    "topics": [
                        "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
                        "0x0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad"
                    ],
                    "timestamp": 1693617035
                }
            }
        ]
    }

Field Definitions

Below you can find descriptions for each field of the response.

FieldDescriptionValue
idID of the event.b1039dc23f5c470a8c78dc901d3d6c23
webhookIdUnique ID of the webhook destination.8cb7a0dd-4181-4484-81fe-5d4315b19a04
typeWebhook event type.CONTRACT
createdAtTimestamp when the event notification was created.2023-09-02T01:10:39Z
eventActivity object.N/A
networkThe default network for the webhook.eth-mainnet
activityList of transfer events whose from or to address matches the address configured in the Custom Contract Activity webhook.N/A
categoryThe data standard.custom_contract
contractAddressThe contract address.0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
transactionHashTransaction hash.0xa63d915009f5d8de69aadbcae7287ebb268875cb91f390f44e16fa2528e74e0b
blockHashThe hash of the block that contains the transaction.0x361282a1a7ce3d54bd9ca10880bf805f0d3e866d8b601b07c51fa533f5e9c3c8
blockNumberThe number of the block that contains the transaction.18045476
logReturned log of the custom contract Activity event.N/A
blockNumberThe number of the block including this transaction.18045476
blockHashA hash of the block including this transaction.0x361282a1a7ce3d54bd9ca10880bf805f0d3e866d8b601b07c51fa533f5e9c3c8
transactionHashTransaction hash.0xa63d915009f5d8de69aadbcae7287ebb268875cb91f390f44e16fa2528e74e0b
addressOriginal address of the log.0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
dataNon-indexed arguments of the log.0x00000000000000000000000000000000000000000000000000470de4df820000
logIndexID of the event.0xea
removedTransaction is in a chain re-org tag.false
topicsAn array of zero to four 32 bytes of indexed log arguments.["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", "0x0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad"]
timestampBlock time.1693617035

How to Set Up Custom Contract Webhooks

  1. Navigate to the Webhook tab in your ZAN Dashboard.
  2. Click the Create New button.
  3. Set a name of the webhook. Then Contract template in the dropdown.
  4. Select your Chain in the dropdown. Then choose your Network.
  5. Paste your contract address into the Contract Address field. Then upload ABI or get ABI of the contract.
  6. Paste your unique webhook URL into the WEBHOOK URL field.
  7. Select all contract events that you need to get notifications in Event dropdown.
  8. Test your webhook by clicking the TEST button.
  9. After the test is successful, click Confirm. Your webhook appears in the list.
  10. Check your endpoint to see the responses.

📘

Note:

For more detailed steps on how to set up custom contract webhooks, please refer to Create a New Webhook.