Get up and running with HAL in under 10 minutes
1. Sign up for HAL
First, create a free account on HAL. You can get started by signing up here.
2. Create a Blueprint
Blueprints describe how to filter down raw blockchain data into individual events that you care about.
Go to the Streams Page > Stream Blueprints and click on Create Stream Blueprint
Let's set up a Stream to get filtered data for all DAI-USDC Token purchases on Uniswap V2.
First, we select Contract Events as source type.
0xAE461cA67B15dc8dc81CE7615e0320dA1A9aB8D5 for the contract address and click Continue.
Now we need to set up some filters. In this case we want to track whenever a token was purchased, so Click Add Event > Select
Swap > Click Save > Click Continue.
Lastly give it a name and Save.
3. Deploy Blueprint to get a Stream
Streams run against blocks in real-time, they filter it down and produce Events.
It's time to deploy our new blueprint that we just created.
Go to the Streams Page > Stream Blueprints and click on Deploy, then Deploy again.
Great! Our Stream is running and will produce events whenever the configured event happens on the blockchain.
4. Generate an API Key
The best way to get the most out of Streams is to consume it via API.
In order to do that we first need to generate an API key.
Go to the Settings > API Keys and click on Generate API Key
Input some name for your API key > Click Generate > Copy the key. Make sure to store this key in a safe place.
5. Consume Stream Events via API
With the blueprint deployed and the API key generated we are now ready to consume our streams events via API.
Make sure to replace
YOUR_API_KEY with your values.
curl --request GET \ --url https://api.hal.xyz/v1/streams/YOUR_STREAM_ID/events \ --header 'Accept: application/json' \ --header 'X-Api-Key: YOUR_API_KEY'
For more info, please refer to our API Reference
Updated 6 months ago