Extract data from a specific contract address

I use the service provided by infura.io to connect to the Ethereum network
I found some problems when using, please help me to solve
I use JSON-RPC to get the data
The main purpose is to process deposits USDT-ERC20
I found that etherscan provides this interface service, which will greatly optimize and reduce the number of times I communicate with infura
example:
http://api-cn.etherscan.com/api?module=account&action=tokentx&contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7&page=1&offset=10&sort=desc&apikey=9JHC1C7QSPWYDVTD28FGT2V8EWPBHQKPSJ
Test apikey, don’t worry

Return data:
{“status”:“1”,“message”:“OK”,“result”:[{“blockNumber”:“9929960”,“timeStamp”:“1587661134”,“hash”:“0x0729f8731b27a68f09cdb335e27fc7da71572b95de97f4f7f9cb6171d1360255”,“nonce”:“3”,“blockHash”:“0xf3831d3265ce7a0ba8c7ac349be676bc0889080d2e7cc739d0ba481ba207b348”,“from”:“0x06970641428c9372baab83b54d45b20f3eca499e”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0x8fe58683bdaa365b5c22cb3fcf5cc023258a34c6”,“value”:“1539090000”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“55”,“gas”:“200000”,“gasPrice”:“5000000000”,“gasUsed”:“26209”,“cumulativeGasUsed”:“7466863”,“input”:“deprecated”,“confirmations”:“2”},{“blockNumber”:“9929960”,“timeStamp”:“1587661134”,“hash”:“0xfc99493f6c0814975b6c29fa24dd52d8e8f5ff7d0d3ecc24e6431abcd71322ae”,“nonce”:“7”,“blockHash”:“0xf3831d3265ce7a0ba8c7ac349be676bc0889080d2e7cc739d0ba481ba207b348”,“from”:“0x0fe6bb6af07537887a16b24905c2b2ea025db365”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0xb57bf64bf7fd53a6d97fdd8807ec6eb1885e3dd2”,“value”:“60900000”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“11”,“gas”:“60000”,“gasPrice”:“8800000233”,“gasUsed”:“26209”,“cumulativeGasUsed”:“736931”,“input”:“deprecated”,“confirmations”:“2”},{“blockNumber”:“9929959”,“timeStamp”:“1587661124”,“hash”:“0xb76d18f5443d6dd672297cd162ab93c5d60539dd09abe4875caba7646e00bb60”,“nonce”:“751”,“blockHash”:“0xd6a0780b2afcdd29c5d90ff15e8efb19b0ba8051c477fa27e0536a46d9dcf310”,“from”:“0x7ccef9ed17824214d60403171d889bd4ce878b27”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0x4ad8a99e4da6055796964e7c3819c15b9cb01bd8”,“value”:“4032500000”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“82”,“gas”:“84332”,“gasPrice”:“8000000000”,“gasUsed”:“56209”,“cumulativeGasUsed”:“6554120”,“input”:“deprecated”,“confirmations”:“3”},{“blockNumber”:“9929959”,“timeStamp”:“1587661124”,“hash”:“0x40ff2ed0b5630194f9b20be721b904e15ad611a40940a3ad3820daa00aa98460”,“nonce”:“70556”,“blockHash”:“0xd6a0780b2afcdd29c5d90ff15e8efb19b0ba8051c477fa27e0536a46d9dcf310”,“from”:“0x477b8d5ef7c2c42db84deb555419cd817c336b6f”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0x4c6b798d6eb8d4f0ba6c78abee3e1698076fe6b7”,“value”:“1801000000”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“55”,“gas”:“100000”,“gasPrice”:“10000000000”,“gasUsed”:“41209”,“cumulativeGasUsed”:“4000129”,“input”:“deprecated”,“confirmations”:“3”},{“blockNumber”:“9929959”,“timeStamp”:“1587661124”,“hash”:“0x74c4576f8c3387bf117a8f1e3156ef44c4e4c41f55c47667f1cf2091247129ce”,“nonce”:“114”,“blockHash”:“0xd6a0780b2afcdd29c5d90ff15e8efb19b0ba8051c477fa27e0536a46d9dcf310”,“from”:“0xd7f65ba782a4e536728fd3e49334863ff1214026”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0x8f20a07e0541ca2db9152d7e521aee5d639b211d”,“value”:“3012960000”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“46”,“gas”:“120000”,“gasPrice”:“12000000000”,“gasUsed”:“26197”,“cumulativeGasUsed”:“3371341”,“input”:“deprecated”,“confirmations”:“3”},{“blockNumber”:“9929959”,“timeStamp”:“1587661124”,“hash”:“0x828014d421cd20197cee4b46eb6bac52912b5239b2b97c31174661d818538fd1”,“nonce”:“108”,“blockHash”:“0xd6a0780b2afcdd29c5d90ff15e8efb19b0ba8051c477fa27e0536a46d9dcf310”,“from”:“0x212f14c58c905d4e86318ea45259b8938b23598b”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0x15be96ae874f12fa50778bf3e67952234244908c”,“value”:“6200000000”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“21”,“gas”:“60000”,“gasPrice”:“16000000000”,“gasUsed”:“41209”,“cumulativeGasUsed”:“1473277”,“input”:“deprecated”,“confirmations”:“3”},{“blockNumber”:“9929959”,“timeStamp”:“1587661124”,“hash”:“0x922e4efb25da3b063e69b1f245f81fc8da2073c252e6be7481364e9bdac497c4”,“nonce”:“589190”,“blockHash”:“0xd6a0780b2afcdd29c5d90ff15e8efb19b0ba8051c477fa27e0536a46d9dcf310”,“from”:“0x46705dfff24256421a05d056c29e81bdc09723b8”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0x1299f8d51da5cf3dd998ac1a56aa4ed0516ada5a”,“value”:“229000000”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“11”,“gas”:“140000”,“gasPrice”:“51000000000”,“gasUsed”:“56209”,“cumulativeGasUsed”:“535541”,“input”:“deprecated”,“confirmations”:“3”},{“blockNumber”:“9929959”,“timeStamp”:“1587661124”,“hash”:“0xa38db773ffbde6079064fb4da47509c29d66d8f3c7c4b85d0224efe5b015d131”,“nonce”:“713671”,“blockHash”:“0xd6a0780b2afcdd29c5d90ff15e8efb19b0ba8051c477fa27e0536a46d9dcf310”,“from”:“0x6748f50f686bfbca6fe8ad62b22228b87f31ff2b”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0xd489bcd8ac4f57da0afa5081ccb670d50bf45525”,“value”:“9823960208”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“9”,“gas”:“140000”,“gasPrice”:“51000000000”,“gasUsed”:“41221”,“cumulativeGasUsed”:“442127”,“input”:“deprecated”,“confirmations”:“3”},{“blockNumber”:“9929959”,“timeStamp”:“1587661124”,“hash”:“0xf0d8b6ed343dafb4f77cbddafa0fd358553a1f30518b56626c29643d6a21a301”,“nonce”:“565833”,“blockHash”:“0xd6a0780b2afcdd29c5d90ff15e8efb19b0ba8051c477fa27e0536a46d9dcf310”,“from”:“0xe93381fb4c4f14bda253907b18fad305d799241a”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0x8275cb61248e6004a5d4c1dd7c495a3bbb052458”,“value”:“699000000”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“8”,“gas”:“140000”,“gasPrice”:“51000000000”,“gasUsed”:“56209”,“cumulativeGasUsed”:“400906”,“input”:“deprecated”,“confirmations”:“3”},{“blockNumber”:“9929959”,“timeStamp”:“1587661124”,“hash”:“0xfb602c001d3bb68e411a417eb4d597a2c088c30cc3e223191e8caf22483078c5”,“nonce”:“680103”,“blockHash”:“0xd6a0780b2afcdd29c5d90ff15e8efb19b0ba8051c477fa27e0536a46d9dcf310”,“from”:“0x1062a747393198f70f71ec65a582423dba7e5ab3”,“contractAddress”:“0xdac17f958d2ee523a2206206994597c13d831ec7”,“to”:“0x22e709812a9d2b78e29d138daa3b6b5a896c8b11”,“value”:“129000000”,“tokenName”:“Tether USD”,“tokenSymbol”:“USDT”,“tokenDecimal”:“6”,“transactionIndex”:“7”,“gas”:“140000”,“gasPrice”:“51000000000”,“gasUsed”:“56209”,“cumulativeGasUsed”:“344697”,“input”:“deprecated”,“confirmations”:“3”}]}

0xdac17f958d2ee523a2206206994597c13d831ec7 is the USDT-ERC20 contract address
This method requests data to return the latest 10 transaction records of USDT-ERC20

I need an interface similar to this, I want to ask whether infura supports the method like etherscan to get the data I need
I found that using traditional JSON-RPC requests to return transaction records, it has been unable to meet USDT-ERC20
Each block of Ethereum may contain more than 50-100 USDT-ERC20 transaction records

Hey @JACK , thanks for the data and the question. I recommend using a library on top of Infura to track token events such as this, and I just wrote up a post explaining how to use Embark’s Subspace library to track Dai Uniswap trades, which is very similar to your use case. Check out https://blog.infura.io/frontend-dapp-development-2/ and it should be easy to give it a try for USDT. Please let me know if that helps at all!

Thank you for your help
This is a tutorial about the front end, and I am confused on how to optimize this problem on the back end
But it didn’t help me

Hi @JACK we have a product releasing this year that may support this functionality you describe specifically for a backend system, we will keep you posted on that.

In the meantime, some questions to help us understand what you’re trying to do. Are you looking for any transaction event that interacts with the USDT contract or specifically method type being executed? Does the USDT contract emit useful logs that write out the information you’re interested in?

1 Like

HI
Thank you for your reply
I saw in your reply that infura released a product this year to support this demand, can you give us more links or tips?

I am looking for all the transaction records in the specified contract address. This is very useful. This will reduce the pressure on our background request infura interface. USDT-ERC20 has occupied more than 60% of the transaction volume of the Ethereum network. Request infura to inquire about transactions containing USDT-ERC20, which will cause serious timeouts and is inefficient

We will have more information about that product soon, but nothing to share currently.

Transactions here is a broad term, all method invocations in the contract would require a transaction, is there a specific contract method you’re looking to monitor? Many times logs/events output the information around these transactions and are accessible via eth_getLogs or a logs type subscription in our WSS connection.

What language are you writing your backend system in so we can provide some language specific help?