2

I want to track transactions on the Tron blockchain network. More precisely, I want to follow the transactions made through my own address, but I could not find any way. I tried the following way but it says "subscribe" method is an undefined method. I found some content about Websocket I got Websocket API via QuickNode but it didn't work either. Is there a way I can track transactions on the Tron network? But I don't want to do this by constantly making HTTP requests. I want to be notified when there is a transaction.

I tried the code below and the Websocket method, but no results.

this.web3 = new TronWeb({
  fullHost: this.network.host,
  solidityNode: this.network.host,
  eventServer: this.network.event,
});

this.web3.eventServer.subscribe('transactions', (error, event) => {
  if (error) {
     console.error('Error subscribing to transaction event:', error);
  } else {
     console.log('New transaction:', event);
  }
});
user51
  • 8,843
  • 21
  • 79
  • 158

1 Answers1

1

First, the disclaimer, I work with QuickNode.

So you can track transactions coming in and out of your wallet using QuickAlerts from QuickNode.

You have to create an alert using the following expression:

(tx_to == 'your_wallet_address') || (tx_from == 'your_wallet_address')

The tx_to will track transactions coming to your wallet, and the tx_from will track transactions coming from your wallet.

You can set up your desired WebHook location as the destination to receive the transaction information.

To use QuickAlerts with JavaScript, you can use the API of QuickAlerts; here are a few resources: