How to Create Arbitrum Webhooks
Alchemy now supports webhooks for Arbitrum, an optimistic rollup-based layer-2 scaling solution for Ethereum. Arbitrum webhooks make the receiving important web3 notifications easy to set up and initiate.
In this article, we show you how to create and launch a webhook on Arbitrum, explore the events that can be tracked using Arbitrum webhooks, and share several use-cases.
What is a webhook?
A webhook is a term used to provide real-time information for applications. Webhooks are also called web callbacks or web callbacks or HTTP push API.
With webhooks, you’ll be able to receive data fast and frequently, and are often used by users to receive notifications on certain events. Webhooks have the ability for real-time data for providers and consumers.
The only drawback of using webhooks is setting it up for the first time. Webhooks work by using a URL to send notifications once an event occurs. Fortunately, Alchemy enables Arbitrum developers to create webhooks quickly and easily.
What Arbitrum events can be tracked with webhooks?
There are three main types of notifications developers can create using Alchemy Notify for Arbitrum webhooks: mined transaction, dropped transaction, and address activity notifications.
1. Mined Transactions
Mined transactions are used to notify that the transactions sent through your API get successfully mined. This is useful if you want to notify customers once their transactions process such as receiving tokens, completing mints, or sending tokens.
2. Dropped Transactions
Dropped transactions are used to notify your application users when a transaction sent through your API key fail or are dropped from the mempool. Transacation anxiety occurs when users are unaware of the current state of their transaction.
By using Arbitrum webhooks, dApp developers can notify users that their transaction was dropped, and allow them to retry their transaction.
3. Address Activity
Address Activity is used to track tokens that are ETH, ERC20, and ERC721. These are all transfer events that are used for as many Ethereum addresses as you’d like. Using this webhook would enable real-time changes whenever a certain address sends or receives a token.
Types of Address Transfers
- Token transfers - display logs for any ERC20, ERC721, and ERC1155 transfers.
- External transfers - these transfers are used for top-level transactions that occur with a from address being the user-created, or external address. External addresses have private keys and are accessed by users.
- Internal transfers - transfers that occur from the fromAddress, which is an internal smart contract address (i.e. a smart contract calling another smart contract, or a smart contract calling another external address.)
- Gas prices - get current gas prices and get notified when the gas prices go above or below a threshold.
Arbitrum Webhook Examples
There are many use case examples for using Arbitrum webhooks. Below is a list containing a few:
- Arbitrum wallet notifications for transaction status updates
- NFT airdrop updates when you receive a new Arbitrum NFT
- A Discord bot that enables notifications whenever an Arbitrum whale moves tokens
- A Twitter bot that tweets every time an Arbitrum NFT is from a specific collection
Arbitrum webhooks give developers the necessary tools to keep users informed of their transaction status.
How to Set Up Webhooks on Arbitrum
Alchemy makes it extremely easy to create webhooks to track events, in fact, it's as simple as adding a new URL to your application.
There are two primary ways to activate Alchemy Notify: from the dashboard and programatically.
Below, we show the steps to set up a webhook using Alchemy’s dashboard.
Step 1 - Create a Free Alchemy Account
To create your webhooks, if you haven’t already, be sure to create a free Alchemy account.
Step 2 - Create a Webhook from the Alchemy Dashboard
Make sure you are in the “Ethereum + L2” ecosystem on the upper left of the Alchemy dashboard.
Navigate to the “Notify” tab and click the “Create Webhook” button in the “Address Activity” section.
Step 3 - Choose Arbitrum and Mainnet to Add Notifications
Next, fill in these fields to create the webhook:
- Select “Chain” to be “Arbitrum,”
- Select “Network” to be “Mainnet,”
Then, paste in the webhook URL you copied from your app as well as the address you want to track.
Step 4 - Add Your Arbitrum Webhook URL
Here, you would add in your unique webhook URL, this can be the link where you want to receive requests (your server, Slack, etc.).
Note: that the webhook payload might not always be compatible with 3rd party integrations.
Step 5 - Test Your Arbitrum Webhook
If you want to test if the Alchemy webhook successfully sends requests before confirming the creation, click on “Test Webhook” next to the webhook URL.
Or if you have already created the webhook but want to test again, click on the three dots by your webhook and select “Send Test Notification.”
Step 6 - Hit "Create Webhook"
From here, you should check if your responses are rolling through. If you want to make your webhooks even more secure with Webhook Signature and Security, you could generate an HMAC SHA-256 hash code using your unique webhook signing key. This verifies that the webhooks originate from Alchemy.
To learn more about setting up webhooks programmatically, refer to our Notify API page in the docs.