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. Sign in to the SolarPath Dashboard.

  2. Click your APP list card.

  3. Click APP Settings in the upper right corner.

  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:

  • 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

// request header
POST /yourApp.com/webhook HTTP/1.1 
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;

Testing with Ngrok

Ngrok helps you debug remote requests locally without deploying to public network servers, thereby improving development efficiency.

  1. Sign up for a free Ngrok account.

  2. Install using the Ngrok Guide. for example macOS run: brew install ngrok

  3. Connect to your Ngrok account by running. ngrok authtoken YOUR_AUTH_TOKEN

  4. 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:

  1. Sign in to the SolarPath Dashboard.

  2. Click your APP list card.

  3. Click APP Settings in the upper right corner.

  4. Switch to the Event Hook tab, fill in the Ngrok Forwarding address in "Webhook URL" and create an EventHook.

  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. When the HTTP response status code is not 200.

  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.

Last updated