By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

Stay Ahead of the Curve: Leveraging Event Hooks in Calimero Private Shard

Favour Kelvin
July 3, 2023
4 minutes

In today's fast-paced and interconnected world, businesses and developers require timely event notifications to drive their systems and ensure efficient operations. Recognizing this crucial need, Calimero introduces a powerful feature called Event Hooks. With Event Hooks, users can receive real-time event notifications and trigger custom actions based on specific events occurring within their contracts or blockchain network. In this blog post, we will delve into the significance of Event Hooks and how you can set them up in your shard to streamline your operations.

Event Hooks and sharding

With Calimero private shards, running a transaction generates a receipt which serves as proof of completion. This receipt includes essential information such as the transaction outcome (success or failure), block height, gas consumption, and logs. These logs include events, error messages, etc. In other words, when a contract emits an event, it creates a log entry in the transaction receipt.

Events are a way for smart contracts to communicate by sending messages that other contracts or applications can read.  This allows users to stay informed about significant occurrences or state changes within the contract.

Webhooks and how do they work?

To receive timely notifications when specific events occur within your shard, Calimero provides the capability to add a webhook in the Calimero console. A webhook serves as the recipient for desired event notifications. When the designated events occur, the Event Hooks service filters and sends the events to the appropriate webhooks. This service maintains a comprehensive datastore of defined webhooks and associated filters, ensuring the smooth and efficient flow of relevant information. With the use of Event Hooks in your private shard, you gain a multitude of advantages. Some of the key benefits include:

1. Real-time Event Notifications: With Event Hooks, you can receive real-time event notifications, allowing you to stay updated on the events within your shard.

2. Customized Event Filtering: Event Hooks enable you to customize your event tracking experience by applying filters. This ensures that you receive notifications only for events relevant to your specific needs.

3. Seamless Integration with External Services: With Event Hooks, you can provide a unique URL which can seamlessly integrate event notifications into your existing workflows and automate actions based on specific events.

4. Enhanced Decision-making: Timely access to event notifications equips you with valuable information for making informed decisions. By staying informed about important events, you can take timely actions, capitalize on opportunities, and mitigate potential risks.

Set up a new webhook

Now let's see how to set up Event Hooks for your private shard from the Calimero Console:

Step 1. Enable Event Hooks

  • Open the Calimero Console dashboard and navigate to the Event Hooks option on the side menu
  • Click on Enable feature

Step 2. Add a webhook

  •  Once Event Hooks is enabled, click on the Add webhook button
  • Provide a unique URL that can receive event notifications (this URL will be registered in the console)

Optionally, you can add an authorization token to secure the webhook.

Step 3. Filter events

  • Select the events you want to receive notifications for or enter your own regex

Step 4. Finish webhook setup:

  • After defining the events, save the webhook configuration by clicking on the Save button

Once saved, you can access the details of your webhook, such as the URL, authorization token, and event filters

By following these steps, you have successfully set up Event Hooks for your private shard in the Calimero console.

Explore the Potential of Event Hooks in your private Shard

Once webhooks have been configured and the Events Hooks are set up, you can start receiving event notifications on your specified URLs based on your defined events. These notifications provide valuable data, such as block height, block hash, block timestamp, predecessor ID, receiver ID, status, action type, etc. With this information at your disposal, you can develop workflows to process your data and make informed decisions based on it.

Conclusion: maximize efficiency

The Event Hooks feature in Calimero Console offers unparalleled transaction visibility and empowers users to elevate their business operations through custom event tracking.

Don't wait any longer—enable Event Hooks, set up your webhooks, and unleash the full potential of custom event tracking in Calimero Console today!

Favour Kelvin
July 3, 2023
5 min read