Learn about Real-Time Filters, what you can use them for, how they work, and how to set them up.
Background
The Tsunami API provides a powerful tool to keep up-to-date with the latest blockchain events and calls through Real-Time Filters.
Real-Time Filters enable real-time monitoring of the blockchain. With this feature, you can establish conditions for events or calls on the blockchain and receive immediate notifications via webhook when these conditions are met.
The support for calls is coming soon.
Once the conditions are satisfied, the Tsunami API generates a notification in the form of a JSON payload, similar to the data provided by its fundamental data endpoints (such as Events or Calls endpoints). You can specify the webhook during the creation of your Real-Time Filter to receive the notifications.
Real-Time Filters monitor the blockchain on a block-by-block basis, ensuring that you receive all relevant data in real-time. If a block contains multiple entries that meet the criteria defined in your Real-Time Filter, you will receive all of them in a single payload.
By default, Real-Time Filter will deliver you the raw data, but you can also set up an ABI Decoder to get your data decoded!
Use Cases
Real-Time Filters enable real-time monitoring of the blockchain and enable prompt action on any events or calls happening to the contract on the network.
You can use it for multiple cases:
- Monitor whale moves. Set up an address you want to monitor and get notified instantly when they make a significant move.
- For the security of your funds. Set up your address on monitoring to monitor the flow of funds and detect any unauthorized balance changes.
- For the security of your contract. Set up your smart contract to monitor and ensure that only authorized events or calls are triggered.
- To monitor blockchain anomalies. Set up your smart contract to monitor and track the real-time statistics of your contract performance, user behavior, interactions, etc.
Set up Real-Time Filter
You can set up Real-Time Filters via our API or Harbour.
Read more about how to Set up Real-Time Filter via API.
Here's a walkthrough on how to set up a Real-Time Filter in our Harbour:
Set up Real-Time Filter in Harbour
Setting up a Real-Time Filter (RT Filter) is a straightforward process that can be completed in a few steps:
- Open your Harbour account
- Navigate to RT Filters
- Click the “+Create new RT Filter” button
- Fill out the form (read more about the Real-Time Filter conditions)
- Save your Real-Time Filter
How to quickly set up your RT Filter
To set up your RT Filter it is enough to specify which contract or Origin you want to monitor and provide a webhook URL where you want to receive your notifications.
After completing these steps, the Real-Time Filter should be enabled, and you should start receiving notifications when the conditions you set are met.
Status of Real-Time Filter
RT Filters may be disabled or suspended if your account is not verified. In this case, check your email inbox for a verification letter from PARSIQ and verify your account. After that, you should be able to enable the RT Filter.
You can enable/disable the button located right behind 3 dots in the RT Filters menu, or you can also enable/disable it in the view of RT Filter.
About RT Filter Conditions
- Give a unique
Name
to your RT Filter. - Choose an
Authentication Method
for your Webhook. You can either use Basic authentication with a username and password, or Bearer authentication with a token. If you have not set up any Authentication system on your end, then pick “None” in this field. - Provide the
URL
of yourWebhook
. You can use the exampleWebhook
at webhook.site to test the connection. - Choose the
blockchain
you want to monitor. We support the RTF on all mainnets Ethereum, BSC, or Polygon, and testnets are coming soon. - Enter the
Origin
address if you want to monitor a specific address. Theorigin
is normally the address that originates the event. - Set the
Contract
to the contract you want to monitor. This can be your own contract or a third-party contract like Uniswap (i.e. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984). - If you want to receive decoded data with your notifications, select the
ABI
that matches the contract in the previous step. An ABI (Application Binary Interface) provides information about the contract's events and functions. Read more about the ABI decoder. - Choose the event you want to monitor by entering the hex value of the event in
topic_0
. If you want to receive notifications for all events, leave thetopic_0
field blank. However, you should be sure that you know the exact hex value of the event you want to monitor, which can be found, for example, in the contract's ABI. - For more flexibility, you can also provide
topic_1
,topic_2
, andtopic_3
. These are only indexed parameters of the events, so you need to be sure you know what parameters the events have (can find those in the ABI of the contract you monitor).
How to work with topics
For example, take the most popular ERC-20 Transfer event (which you can think of as topic_0) would have 2 parameters, topic_1 being “from” address and topic_2 being “to” address. You can provide an ABI, we would be able to help automatically see which parameters stand for what. If you are not sure which parameters to enter - leave them blank.
After filling out the form, your RT filter will be set up and ready to use. You will receive notifications in the form of JSON payloads delivered to your specified Webhook whenever the conditions of your RT filter are met.