Clarifications on TRON-API-KEY usage

Hi Devs,
I need a clarification on the usage of the API-KEY.

From time to time my dApp gets 403 and 503 errors. Looking here:

i understand that for errors 503 the reason is due to the IP frequency limit that can be overcome using a tron-apy-key.
Using tron api key should also fix the 403 error due to rate-limit per day.

Here is explained how to set the tron api key:
https://developers.tron.network/reference/api-key

My dApp is html + javascript developed and in order to use this API-KEY i use this method inside the JS:

window.tronWeb.setHeader({“TRON-PRO-API-KEY”: ‘xxx-yyy-zzz’});

and after setting this i proceed instantiating and calling the contracts i need.

instanceContract = await window.tronWeb.contract(abi_contract, mainContract);

In this way i can perform all my needed requests and get the correct results from the contract but unfortunatelly setting the key that way doesn’t seems to fix the above errors so i’m asking myself if i call the right way or not.

9 Likes

@admin.hackathon @support.hackathon Tagged them for you!

3 Likes

https://developers.tron.network/reference/rate-limits

check this doc on the rate limitation. besides this total request amount limitation, it also limited the request amount per second. which is 15 requests per second. make sure your request is less than 15 per second otherwise it will run into 403 or 503.

Build up your own fullnode is the best choice if your request amount is huge. you can find the fullnode set up guide at : Helpful Links for Developers

ANKR recently just supported TRON network, ANKR is also an option.

3 Likes