Contract Subscriptions
Receive webhooks for any transaction log or receipt on any contract.
A log is an event emitted from a successfully executed transaction. Example: a burned NFT emits a Transfer OWNER -> 0x000...
log.
A receipt contains onchain details for any transaction. This may be useful for tracking onchain failures (reverted executions).
Your app may trigger an action when an onchain event occurs, such as:
- ETH or an ERC20 currency is transferred to or from a wallet.
- An token is minted from your NFT collection.
- An token in your NFT collection is burned or transferred.
- Metadata for an oracle contract is updated.
- Navigate to the thirdweb engine dashboard and select your engine.
- Select Contract Subscriptions.
- Select Add Contract Subscription.
- Provide a webhook URL.
API reference: POST /contract-subscriptions/add
- Navigate to the thirdweb engine dashboard and select your engine.
- Select Contract Subscriptions.
- Select ... > Remove next to an existing subscription.
API reference: POST /contract-subscriptions/remove
Engine will call your webhook URL with event logs and transaction details for your specified contract(s).
See Webhooks for more information on managing webhooks and verifying webhook signatures.
Add multiple Contract Subscriptions with different webhooks. Engine will process onchain data once to avoid duplicating work.
Not at this time. This feature is on the future roadmap.
Not at this time. This feature is on the future roadmap.
Querying RPC nodes for onchain data is slow, unreliable, and costly at scale. RPCs have limits on the number of blocks that can be queried once. Even if your contract has low activity, your app must all blocks in your desired range to get accurate results.
Contract Subscriptions allow your app to query the onchain data you care about from database, which is faster, more reliable, and less costly.
Event listeners built into web3 libraries are appropriate to listen for real-time results without any persistence or resilience. If your backend request times out or your backend has an outage, event data is missed.
A Contract Subscription continuously poll the blockchain for logs and receipts since the last processed block and stores the results to database. Your app can rely on data to be stored eventually, even when unexpected issues with your backend, Engine, the RPC, or the blockchain occur.