tronprotocol / java-tron

Java implementation of the Tron whitepaper
GNU Lesser General Public License v3.0
3.72k stars 1.4k forks source link

Running a Tron fullnode and transcations takes lot of time to detect compared to the Tron V1 API which detects them almost immediately #5947

Closed dwabs closed 1 month ago

dwabs commented 1 month ago

We allow customers on our shop to pay directly with stablecoins on the TRON chain. To detect the transactions on the tron chain, we host and run a fullnode as well which we rely upon to know when a transaction has arrived in our wallet.

When a customer registers a new payment, our detection logic saves the current block number at the time on the TRON chain and starts to linearly scan that block UNTIL the latest block to find any transaction on our address.

Now the problem is that each block has approx 400 transactions and we are linearly scanning the blocks where sometimes it takes 10-15 mins to detect a transaction HOWEVER the transaction is already visible on the Tron explorer by this time. Alternatively, even when using the TronGrid proprietary API (v1 API), the transaction appears very quickly.

So my question is how we can streamline the transaction detection process if we are running our own full node?

ferdinand026 commented 1 month ago

@dwabs When parsing blocks, we can filter transactions through transaction type, contract address. Here is a guide. And we can also get transactions by the help of event subscription.

vivian1912 commented 1 month ago

@dwabs Does this answer your question? This issue will be closed as no update for a long time. Please feel free to re-open it if you still see the issue, thanks.