Prerequisites
To complete this tutorial, you need:- Node.js v22+ installed
- Deployed contract on Arc - Complete the Deploy contracts tutorial first
- API credentials - Your API key and Entity Secret from the Developer Console
This tutorial assumes you have a contract already deployed on Arc Testnet with
the Circle SDKs installed. If you don’t, complete the Deploy
contracts tutorial first.
Step 1: Set up a webhook endpoint
Event monitors send real-time updates to your webhook endpoint when events happen.- webhook.site
- ngrok
- Visit webhook.site
- Copy your unique webhook URL (for example,
https://webhook.site/your-uuid)
Step 2: Register your webhook in Console
Register your webhook URL in the Developer Console:- Go to Developer Console
- Navigate to Webhooks (left sidebar)
- Click Add a webhook
- Enter your webhook URL (from Step 1) and create the webhook
Register your webhook before creating event monitors. This allows Circle to
send notifications to your endpoint.
Step 3: Import an existing contract (optional)
If you already have a deployed contract and want to monitor its events, import it to the Developer Console. If you deployed a contract using Circle Contracts (for example, in the Deploy contracts tutorial), skip this step. Your contract is already available in the Console.If the contract is already imported, you’ll see an error:
contract already exists. This means the contract is already available in the Console and you
can proceed to create an event monitor.Step 4: Create an event monitor
Event monitors track specific contract events. They send updates to your webhook endpoint. This example monitorsTransfer events:
The
idempotencyKey prevents duplicate event monitors. If you run the script
again with the same key, you’ll get an error that the monitor already exists.Step 5: Receive webhook notifications
When events occur, Circle sends updates to your endpoint. Here is what aTransfer event looks like:
notificationType: Always"contracts.eventLog"for event monitor webhooksnotification.eventSignature: The event that was emittednotification.contractAddress: Address of the contract that emitted the eventnotification.blockchain: The blockchain network (for example,ARC-TESTNET)notification.txHash: Transaction hash where the event occurrednotification.userOpHash: User operation hash (for smart contract accounts)notification.blockHash: Hash of the block containing the transactionnotification.blockHeight: Block number where the event occurrednotification.eventSignatureHash: Keccak256 hash of the event signaturenotification.topics: Indexed event parameters (for example,fromandtoaddresses)notification.data: Non-indexed event parameters (for example, token amount)notification.firstConfirmDate: Timestamp when the event was first confirmedtimestamp: Timestamp when the webhook was sentversion: Webhook payload version
Step 6: Retrieve event logs
You can also query event logs with the API. This is useful for past events or if you prefer polling.Webhooks vs Polling: Webhooks send real-time updates (push). Polling needs
periodic API calls (pull). Use webhooks for production and polling for testing
or past queries.
Replace
CONTRACT_ADDRESS with your contract address. You can get this
address when you deploy the contract, or by listing your contracts with
listContracts().You can view, update, and delete event monitors with the Circle Contracts API.
See the API
Reference
for details on managing your monitors.
Summary
After completing this tutorial, you’ve successfully:- Set up webhook endpoints using webhook.site or
ngrok - Registered webhooks in the Developer Console
- Created event monitors for specific contract events
- Received real-time webhook updates for contract events
- Retrieved past event logs with the Circle SDK