Here’s how Infura uses recently acquired blockchain notification tool, HAL, to monitor the Infura Sepolia faucet and a tutorial to get started using blockchain listening.
In February 2023, Infura announced the acquisition of blockchain notification company, HAL, to bring no-code notifications and data streaming to developers.
As we continue to integrate HAL into the Infura platform, we want to demonstrate the power this new feature brings to Infura that will soon be available to all users.
In this post, we’ll cover how Infura uses HAL to monitor the new Sepolia faucet transactions and what this means for developers.
Monitoring Infura’s Sepolia faucet using blockchain notifications
We’ve all been there, faucet after faucet and error after error, they’re all dry. This is extremely frustrating and can really put a hold on the development process. Getting test funds should not be the most challenging part of deploying to the testnet. So then what’s the issue?
The transaction is failing. This could be caused by any number of reasons, but a failed faucet transaction does not have to be a dead end.
Typically, the problem is not remediated because without proper monitoring and alerting the faucet provider is not even aware of a problem. If it’s that easy, why don’t all faucets – or dapps for that matter – monitor transactions?
Before using a blockchain data listening feature like HAL, there were two primary ways to handle this. The first, by manually monitoring transactions and responding accordingly. This is an incredibly time-consuming and resource-intensive task, especially as the usage of the application scales. Or alternatively, by coding a listening and alerting system from scratch, which takes a significant amount of time to architect and maintain the solution.
Infura’s latest acquisition: HAL blockchain notifications
This is where HAL comes in, by providing an easy-to-use tool that allows developers to monitor transactions and respond quickly to problems. HAL provides a user-interface to listen for almost any state change imaginable using the blockchain listening trigger template. Using this new feature, developers can input a conditional trigger and can push a data payload to a webhook for easy ingestion into the project’s database.
This means that in the event an Infura Sepolia faucet transaction fails, due to gas problems or network congestion, the team gets an alert in the database and in Slack so that they can manually replace the transaction and send users the claimed Sepolia ETH super quickly. The Infura Sepolia faucet has a Transaction History table. For every transaction, the faucet displays a column with a transaction outcome result, like “Success”. By using Hal, the development team was able to shortcut the on-chain listening and filtering and easily create automation that updates the website front-end based on transaction status outcomes as reported by Hal’s listening tool.
And that’s just one example of the power of HAL. There are other ways that developers can use Hal to streamline their operations.
Paraswap uses Hal to monitor the balance of tokens in their protocol’s reward smart contracts to ensure that they can always keep them topped up.
Developer teams can also set up programs in their back-end that listen for the delivery of data payloads from Hal in order to execute programmatic automation for their application. Other use cases include monitoring liquidity health factors, yield farm reward fluctuations, DAO governance events, token price changes, or just about any state change you can imagine.
What to get started using HAL? Follow the below tutorial to get started.
How to Set Up Transaction Monitoring in Infura
Setting up transaction monitoring with Infura is easy. Developers follow these steps: (Note once HAL is fully integrated into the platform, these steps will be reduced.)
Part 1: Account setup
- Create an account on HAL's website.
- Create a new stream and select the network you want to monitor.
- Choose the trigger you want to listen for and set the conditions.
- Choose a connection to process the data that’s being ingested.
- Test your trigger!
Part 2: Create a Blueprint
1. Log into Hal.xyz
2. Once inside the application, click on the “Streams” tab
3. Choose “Create a new Blueprint”.
Part 3: Blockchain Listening
1. Select “Transactions” under Stream Source Type.
2. Enter the wallet address for Infura’s Faucet in the “From Address” parameter. Note: for your own uses, you can listen to any combination of value, sender, receiver, or set multiple address lists
3. Test your trigger using the “Test” button and inputting a transaction hash or block number where the conditions of your trigger were met.
4. Name your Streams Blueprint
5. Deploy your Stream Blueprint.
Part 4: Consume Data
Now that your Stream is deployed, it’s automatically listening for your trigger and will expose JSON whenever the conditions are met. You can consume data via REST API, or push it to you directly via Webhook. The Infura Testnet Faucet uses the Webhook feature.
1. Click on the “Connectors” tab on the detail page of your newly deployed stream
2. Click the button “Create Connector”
3. Choose the type of data connection that makes sense for your tech stack. For the Infura Testnet Faucet, we use Webhooks!
4. Choose your endpoint, HTTP Method, name it, and create it!
Use Infura’s new notifications feature to improve your dapp
Using this implementation of HAL, the Infura team was able to easily monitor the outcome of the new Sepolia faucet transactions and receive programmatic updates to our database.
This information makes it really obvious when a transaction fails, which enables us to replace the failed transaction and make sure our devs get their testnet ETH.
You can use HAL to monitor for almost any state change that happens on the supported networks.
Soon, we’ll be launching HAL directly integrated into the Infura platform. Stay tuned to hear more about that!