See Virtual TestNets in action! ⚡ Replace slow public testnets in dapp development. Join our Office Hours


How to Set Up Real-Time Smart Contract Alerts With Tenderly

Tenderly Alerts allow you to track events on the Ethereum blockchain and receive real-time notifications when they occur via email, Slack, Discord, or third-party incident monitoring systems.

Bogdan Habic
Bogdan Habic
May 18, 2023 · 5 min read

In this post

smart contract alerts

Keep your finger on the pulse of anything happening around your smart contracts, wallets, and transactions with real-time Ethereum blockchain alerts powered by Tenderly.

With 12 contextual triggers, Tenderly Alerts provide a seamless way to track on-chain events and receive notifications when they occur via email, Slack, or third-party incident monitoring systems.

All notifications are sent in real time, allowing you to stay informed about desired or undesired events related to activities on the network.

What are Tenderly Alerts?

Tenderly Alerts provide a robust monitoring and alerting platform for dapps, smart contracts, and wallets.

Alerts are an essential component of the web3 tech stack. They can be used in many ways, from monitoring the health and performance of your dapp to tracking user interactions. For more advanced use cases, you can even use Alerts to trigger automated processes on centralized systems.

To mark this possible, Tenderly runs its own full archive nodes that rely on a custom EVM implementation. This enables Tenderly to extract extensive data from the blockchain that no one else has.

We make this data easily accessible to you, saving you time by removing the overhead of running your own infrastructure or building your own data pipelines.

The most common practical applications for Tenderly Alerts include:

  • Monitor specific on-chain activities and track interactions on your smart contracts and crypto wallets, such as failed transactions or token transfers.
  • Know when something suspicious is happening related to your smart contracts or crypto wallets. Sent in real-time, Alerts can help you take immediate action in case of a security breach or fraudulent activity to prevent financial losses.
  • Detect errors, security issues, or failing transactions faster. Alerts enable you to take action right away and fix the issues before your users start hitting you with support tickets.
  • Build automated processes that can run custom code when an on-chain event happens. Webhooks and Web3 Actions as Alert destinations were built specifically for this purpose.

Tenderly Alerts concepts and components

Before diving into practical examples of Tenderly Alerts, let's first explore the basic structure of an Alert and its complement.

Tenderly Alerts are made up of three core components: Triggers, Targets, and Destinations.

The Alert Trigger is essentially an on-chain event that you want Tenderly to listen for. There are 12 pre-defined trigger types to choose from. When the event occurs, the data about the event will be sent to your desired destination.

ethereum transaction notifications and smart contract event alerts

The Alert Target is the address you're interested in monitoring. You can monitor a single address, all addresses on a specific network, or particular addresses that you added to your Tenderly Project.

Lastly, the Alert Destination is the place where you want to receive notifications about on-chain events.

Tenderly makes it convenient for you to receive alerts where it matters most to you and your team, such as:

  • Messaging apps: Email, Slack, Telegram, Discord
  • Incident monitoring systems: PagerDuty, Sentry
  • Tenderly systems for more advanced use cases: Webhooks, Web3 Actions. (More on Webhooks and Web3 Actions later on in this post.)

12 pre-defined contextual Alert Triggers

Alert Triggers are specific on-chain events that you are interested in keeping an eye on. With 12 trigger types at your disposal, Tenderly can help you stay in the know about anything from successful transactions to specific functions called in your smart contract, events emitted, or balance changes.

Let's delve deeper into each of the triggers to better understand how they work and what you can do with them.

  • Successful Transaction: Notifies you when a successful transaction happens.
  • Failed Transaction: Send a notification when a transition fails, allowing you to keep track of all the unsuccessful transitions and detect issues faster.
  • Function Call: Fires when a specific function is called from a smart contract.
  • Event Emitted: Triggers when a specific event is emitted from a contract.
  • Event Parameter: Alerts you if an event parameter has a particular value.
  • ERC20 Token Transfer: Triggers when an ERC20 transfer event is emitted from a contract, allowing you to track when you or someone moves tokens.
  • Allowlisted Caller: Notifies you when an address that is not on this list calls your smart contract.
  • Blocklisted Caller: Notifies you whenever an address from this list calls your contracts.
  • ETH Balance: Triggers when the ETH balance of an address falls below a certain threshold.
  • Transaction Value: Notifies you when the transaction value matches certain conditions.
  • State Change: Fires when a state variable in a contract changes.
  • View Function: Alerts you when the view function's return value matches certain criteria, passes a threshold, or changes by a certain percentage.
For an in-depth explanation of all triggers and how to configure each one, read through this documentation page.

Understanding Webhooks and Web3 Actions as Alert Destinations

Webhooks and Web3 Actions are special destinations that make it easy to build a more automated monitoring system for your dapps or smart contracts. These two destinations are separate Tenderly systems that have been integrated into Alerts.

The Webhook destination allows you to send alert data to your custom webhook endpoint. Alert data is sent in JSON format. You can use this data as a trigger for other actions in your centralized system. For example, you could process the alert data and send it to the end user in the form of a mobile app notification.

Learn how to use Webhooks as an Alert Destination from this tutorial.

With Web3 Actions as the alert destination, you can execute custom code when an on-chain event happens. Web3 Actions can run any Javascript or TypeScript code in the form of a serverless function.

From your Web3 Actions code, you can also access Tenderly’s production node Web3 Gateway to make a highly customizable and advanced monitoring system or automatically send transactions.

Want to learn more about how Web3 Actions work and what you can do with them? Check out the Web3 Actions documentation for more details, helpful tips, and tutorials.

Quick starter guide: How to set up a smart contract alerts with Tenderly

Now, let's learn to configure and enable a Tenderly Alert in a few easy steps. For this example, we'll set up an Alert to monitor all failed transactions on a specific smart contract. Every time a transaction fails, Tenderly will send the alert data to our custom webhook endpoint.

Creating an Alert involves the following steps:

  1. Choose an Alert Trigger (an event you want to monitor). For this example, this will be the Failed Transaction trigger.
  2. Define the Target (smart contract address). Choose “Address” from the available target options to tell Tenderly that you want to monitor a specific address.
  3. Set the Alert Parameters by choosing the specific smart contract you want to monitor. Depending on the trigger type, you might have to configure other parameters as well.
  4. Choose the Destination where you want to receive notifications every time a transaction fails on the smart contract.

Here’s a quick video that shows you how to set up a Failed Transaction trigger with the custom webhook endpoint as the Destination.


Create your first Tenderly Alert

With 12 contextual triggers, Tenderly Alerts allow you to monitor various on-chain events and receive real-time notifications via email, Slack, or popular incident monitoring systems.

Whether you're monitoring your dapp's health, tracking user interactions, or want to trigger automated processes in your centralized systems based on on-chain events, Tenderly Alerts have you covered.

Create a free account on Tenderly and enable your first Alert.

Use Tenderly Node Extensions to build custom RPC endpoints that fit your dapp without changing its existing logic. Optimize dapp performance, improve user experience, and get greater control and flexibility both on-chain and during development.

Try Tenderly Node Extensions