Comment on page

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.
  1. 1.
    Sign in to the SolarPath Dashboard.
  2. 2.
    Click your APP list card.
  3. 3.
    Click APP Settings in the upper right corner.
  4. 4.
    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.


  • 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:
Create EventHook
  • 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:
EventHook List

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.
Click on the three dots

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
// request header
content-type: application/json;
x-sp-signature: signature-content-hash
  • Example signature verification
import * as crypto from "crypto";
function validationSignature(
body: string, // JSON from request body
signature: string, // "x-sp-signature" from header
signingKey: string // taken from dashboard for specific app eventhook
): boolean {
const hmac = crypto.createHmac("sha256", signingKey); // Create a HMAC SHA256 hash
hmac.update(body, "utf8"); // Update the token hash with the request body using utf8
const result = hmac.digest("base64");
return signature === result;
// from request header
String signature4header = request.getHeader("x-sp-signature");
// JSON from request body
String body = "";
// taken from dashboard for specific app eventhook
String signingKey = "";
// signature
Mac sha256Hmac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKeySpec = new SecretKeySpec(signingKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
byte[] bytes = sha256Hmac.doFinal(body.getBytes(StandardCharsets.UTF_8));
String result = Base64.encodeBase64String(bytes);
// validation
return StringUtils.equals(signature4header, result);// false or true
func validationSignature(
body string, // JSON from request body
signature string, // "x-sp-signature" from header
signingKey string // taken from dashboard for specific app eventhook
) bool {
h := hmac.New(sha256.New, []byte(signingKey))
digest := base64.StdEncoding.EncodeToString(h.Sum(nil))
return digest == signature
import hmac
import hashlib
def validation_signature(
body: str, # JSON from request body
signature: str, # "x-sp-signature" from header
signing_key: str # taken from dashboard for specific app eventhook
) -> bool:
digest =
bytes(signing_key, "utf-8"),
msg=bytes(body, "utf-8"),
base64sha256 = str(base64.b64encode(digest), 'utf-8')
return signature == base64sha256

Testing with Ngrok

Ngrok helps you debug remote requests locally without deploying to public network servers, thereby improving development efficiency.
  1. 1.
    Sign up for a free Ngrok account.
  2. 2.
    Install using the Ngrok Guide. for example macOS run: brew install ngrok
  3. 3.
    Connect to your Ngrok account by running. ngrok authtoken YOUR_AUTH_TOKEN
  4. 4.
    Start your local forwarding channel. ngrok http 80
Refer to the forwarding address output in step 4 above, such as: https://****-***-***-**-***, and then follow the steps below:
  1. 1.
    Sign in to the SolarPath Dashboard.
  2. 2.
    Click your APP list card.
  3. 3.
    Click APP Settings in the upper right corner.
  4. 4.
    Switch to the Event Hook tab, fill in the Ngrok Forwarding address in "Webhook URL" and create an EventHook.
  5. 5.
    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:
  1. 1.
    When the HTTP response status code is not 200.
  2. 2.
    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:
  • 1Minute
  • 5Minutes
  • 15Minutes
  • 1Hour
  • 6Hours
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.