Event Hook
SolarPath supports event notifications from all chains, which is stable and efficient.
SolarPath has expanded the subscription model to effectively solve problems such as Websocket disconnection and reconnection. A small amount of coding can receive event notifications sent on the chain, such as: ERC20 / TRC20 balance changes, etc.
Sign in to the SolarPath Dashboard.
Click your APP list card.
Click APP Settings in the upper right corner.
Switch to the Event Hook tab to create event notifications according to your business needs.
Event Hook adopts HTTP notification mode, and you need to provide an HTTP URL address to receive event notifications.
Introduction
Sign in to the SolarPath Dashboard。
Click your APP list card.
Click APP Settings in the upper right corner.
Switch to the Event Hook tab:
Enter the name, notification URL address, and contract address to be monitored (the EVM chain supports both NFT and TOKEN).
The list of events that have been created:
Notice Security/Signature
To ensure the security of the events you receive, you can use your unique EventHook signing key to generate HMAC SHA-256 hashes to verify that they came from SolarPath.
View Signing Key
Click "Signing Key" to view your unique signing key.
Verify received signature
The request header sent by SolarPath contains a string of signature content. It signs the body of the request (JSON) using the HMAC SHA256 hash algorithm.
To verify that the signature came from SolarPath, compare your generated HMAC SHA256 hash with the received signature.
The Header contains: the signature content of x-sp-signature
Example request header
Example signature verification
Testing with Ngrok
Ngrok helps you debug remote requests locally without deploying to public network servers, thereby improving development efficiency.
Sign up for a free Ngrok account.
Install using the Ngrok Guide. for example macOS run:
brew install ngrok
Connect to your Ngrok account by running.
ngrok authtoken YOUR_AUTH_TOKEN
Start your local forwarding channel.
ngrok http 80
Refer to the forwarding address output in step 4 above, such as: https://****-***-***-**-***.ngrok.io
, and then follow the steps below:
Sign in to the SolarPath Dashboard.
Click your APP list card.
Click APP Settings in the upper right corner.
Switch to the Event Hook tab, fill in the Ngrok Forwarding address in "Webhook URL" and create an EventHook.
Start your local service and watch for incoming contract event notifications.
Retry strategy
SolarPath uses your HTTP response status code to determine if a retry is required. For more information about status codes, please refer to: HTTP Response Status Code
Several common retry strategies are as follows:
When the HTTP response status code is not
200
.HTTP response/connection timeout, default
timeout = 15s
According to the above situation, the event notification will be resent, and the attempt interval is as follows:
1
Minute
5
Minutes
15
Minutes
1
Hour
6
Hours
After a total of 5 attempts, there will be no resends.
SolarPath will not parse the returned content, it will only trigger a retry policy based on the HTTP response status code.
Last updated