I'm new to coding. Trying to fetch hashes and amounts of USDT transactions on TRC20 and ERC20 systems, without binding to single wallet.
Have been trying to use TRX and ETH native API's and third party API as well, such as QuickNode - which gave me better experience, but still can't get a proper result:(
Using QuickNode API managed to fetch some blocks, and TRX transactions, but have no idea how to get their amounts and properly filter them by contract - in another words, by token, such as USDT.
Expecting to be able to fetch hashes and amounts of latest USDT transactions on TRC20 or ERC20 ecosystems without binding fetch just to a single wallet
Head of DevRel at QuickNode here
Go-forward basis (aka forwardfill)
Instead of having to repeatedly query the blockchain or an index (polling), you can use a service to feed you the data you're looking for. Our QuickAlerts product is one such service.
In our Expression Library, we have an example expression for ERC-20/TRC-20 transfers. The Expression Library explains exactly how the expression works. All you need to do is:
To make it easy, we have a video guide on how to use the QuickAlerts interface.
Getting historical data (AKA backfill)
Finding a company that provides an indexed API will always be easiest here, though there aren't many that offer the ability to query by ERC-20 token or a large set of chains. If you're set on this, find a company that supports the chains you're looking for, and reach out asking if they can expose this new method.
The manual way may be where you land here since with someone like QuickNode, you can get access to all the chains you need. Just keep in mind it's going to take quite a few RPC calls and processing as you'll be iterating over many blocks.
I've written some code for you below showing how it can be done on Ethereum Mainnet. You'll want to make sure that you:
startingBlock
definition infetchAllTransfers
. Adjust this value based on the block the USDT contract was deployed on each chain you're working with.