Create a new Stream using the Admin Panel
Select the project where you'll be creating the Stream
Go to https://admin.moralis.io/settings and copy your API key from there, you will need it to access the Streams page.
Go to https://admin.moralis.io/streams and paste your API key.
Click on the Create a New Stream button and the following page will open. You can either select some of our predefined templates or create your stream from scratch by entering the contract or wallet address.
Create a stream by choosing one of these options:
Use one of the examples to create a demo stream with real-time data streaming into the right-hand terminal.
Use a template and enter a
Contract address
,Wallet address
,Token address
, orToken Id
depending on the template to create a demo stream.Input a
Contract address
,Wallet address
,Token address
inAdd Address to Stream
, and then configure your stream.
A. Use examples to create a demo stream
Lets choose the Tether
Example. Simply, click the Example and the demo stream will be created. You will see the webhook responses streaming in the right hand terminal.
B. Use Templates to create a stream
Let's track transactions of a wallet.
Click the
Whenever a wallet recieves or sends assets
template. You will be prompted to provide a Wallet address.Enter the wallet address you want to track. Or take a example wallet address like
0xe692869347b9b18Ef2DEED19ae1bBACE303B52B0
from Etherscan.
When a transaction occurs on the wallet it will appear on the right-hand terminal.
To get the webhook sent to your backend you have to configure your stream by adding
Webhook URL
,Description
, andTag
.Then click toggle to
Prod
. You will now get webhooks sent to your URL you provided.
C. Configure your own stream
Add
Contract address
orWallet address
Configure your stream to recieve webhooks to your backend by adding
Webhook URL
,Description
, andTag
. Then click toggle toProd
.
Select the Networks you want to track.
Select the events you want to track by selecting from options
Contract Interaction
,Native Transactions
,Internal Transactions
underStream Options
. To read more on each options take a look at Streams options in our documentation.
Select different topics to track by inputting an ABI. For example copy Tether ABI from Etherscan and paste the ABI into the ABI field.
Now you can select the Topics you would want to only listen to. In this example lets choose to listen to the Transfer Topic (used to transfer the tokens from the owner of the token to some other address)
Click on *Update. Now you should start receiving data to your webhook URL as soon as some transactions are done on the address.
🚨 Mandatory Test Webhook 🚨
Whenever you create or update a stream, you will receive a test webhook.
You have to return status code 200 for the stream to start.
The test body will look like this:
{
"abi": {},
"block": {
"hash": "",
"number": "",
"timestamp": ""
},
"txs": [],
"txsInternal": [],
"logs": [],
"chainId": "",
"tag": "",
"streamId": : "",
"confirmed": true,
"retries": 0,
"erc20Approvals": [],
"erc20Transfers": [],
"nftApprovals": [],
"nftTransfers": []
}
We are Live! 🎉
Now, whenever the address you monitor is involved in an incoming or outgoing transaction, you will receive a webhook with the transaction details.
Two Webhooks for Each Event
You will receive two webhooks for each event.
The first webhook will come as soon as the transaction is included in a block and has confirmed:false. This means the block in which the event occurred still runs the risk of getting dropped because of blockchain reorganization. You are not charged for unconfirmed webhooks, only for the confirmed ones.
The second webhook will come once the block in which the event happened has minimal chance of being dropped (the chance is never zero as it is all probabilistic). This second webhook will have confirmed:true.
Edge Cases
In rare cases, the webhook with confirmed:true may come before the one with confirmed:false; please ensure to handle this scenario on your end.