Transaction Tracker

Step 1: Install Henesis CLI


npm install -g @haechi-labs/henesis-cli

Login with your Henesis account

henesis login

Step 2: Clone the Sample Code

Clone the sample repository

git clone

Move to sample directory

cd sample-tx-tracker

Install dependencies

npm install

Step 3: Configure subscription for transaction status change

Configuration for ClientId, Private Key and Node Endpoint

To subscribe the changes of the transaction status through Henesis, you need the following information:

  • CLIENT_ID : Your client id. You can check it through the henesis account:describe command.

  • PRIVATE_KEY : A private key of your EOA account for test. The EOA account should have enough ETHs to send transactions. (how to check your private key in metamask)

  • NODE_ENDPOINT : The URL of the blockchain node you want to connect. (how to check INFURA key)

The ClientId can be checked using the following CLI command.

henesis account:describe
Name: haechi
Organization: haechi-labs
ClientId: a481485a958f1b82ac210ec4eea27943

Enter the ClientId, Private Key and node endpoint in the .env configuration file.

PRIVATE_KEY=<your private key>

Create the TransactionTracker instance

You can use CLIENT_ID to create a TransactionTracker instance for subscribing the transaction status change.

const { TransactionTracker } = require('@haechi-labs/henesis-sdk-js');
const { CLIENT_ID, PRIVATE_KEY, NODE_ENDPOINT } = process.env;
const tracker = new TransactionTracker(CLIENT_ID, {
platform: 'ethereum',
network: 'ropsten',

See here for a list of supported blockchains.

Subscribe the Transaction Status Change

You can subscribe to the status of transactions through subscription

  • You can check the status of a transaction through the .

  • The message.ack() should be called when data processing is done

const subscription = await tracker.subscribe(
subscriptionId: "your-subscription-id",
ackTimeout: 30 * 1000 // default is 10 * 1000 (ms)
subscription.on("message", async (message) => {
console.log(`now transaction status is: ${}`)
switch( {
case 'pending' :
transactions[] = { status: 'pending'}
case 'receipt' :
transactions[] = {, status: 'receipt' }
case 'confirmation' :
transactions[] = {, status: 'confirmation' }
subscription.on("error", async (error) => {

Tracking the Transaction Status Change

Track a transaction using the trackTransaction function.

  • Set the txHash of transaction whose state change you want to track.

  • Initiate to track transactions by putting txHash into henesis#trackTransaction

  • Set timeout 30 seconds, and confirmation to 6.

// Start tracking transaction
// txHash which is generated by web3 or could be copied by etherscan
tracker.trackTransaction(txHash, {
timeout: 30*1000,
confirmation: 6

Step 4: Check for the Transaction Status Change

Run the API server and check for the transaction status change.

$ node index

When the status of a transaction changes and the message is delivered, you can see the following information in your console:

now transaction status is: receipt { blockHash:
blockNumber: 6706349,
contractAddress: null,
cumulativeGasUsed: 21004,
from: '0x453011a4f948b22762290c1f4de3e2210c311c06',
gasUsed: 21004,
logs: [],
status: true,
to: '0x453011a4f948b22762290c1f4de3e2210c311c06',
transactionIndex: 0 }