4

I keep getting the rate_limit_exceeded error when I try to process a transaction on the testnet.

I looked at the guide on how to fix it but as someone relatively new to programming, I'm still unsure how to get the streaming to work. I tried calling the http streaming header in the terminal (after importing the packages mentioned in the project skeleton tutorial) and still received the same response. Does anyone have any suggestions/solutions?

0

4 Answers 4

5

You are making too many Horizon requests, consider rewriting code that polls Horizon. Setup a queue or use caching for Horizon data.

Horizon rate-limiting behavior is described here.

In order to provide service stability, Horizon limits the number of requests a client can perform within a one hour window. By default this is set to 3600 requests per hour—an average of one request per second.

At the time of writing, rate limit for public Horizon services is set to 17200 requests per hour, or effectively ~ 4.7 requests per second.

0
2

You can be more specific with the data you are requesting. Make sure you set the cursor parameter correctly so you are not flooded with more data than you need.

For example, if you only want payment data for a specific account, then you should call the Payments for Account endpoint with streaming enabled.

This can be done directly using the JavaScript SDK or the Golang SDK, or any other SDK. There is a direct example of this using the JavaScript SDK.


If you want a higher rate-limit then you can consider running your own instance of stellar-core and horizon where you can configure the rate limit that works for you. This can be done easily with the docker quickstart image provided.


Here's some more information on the Rate Limit Exceeded error.

0

Most obvious solution is setting up your own horizon server and increasing/disabling the limit.

0

Bare in mind that if you are trying to reduce the number of calls you can perform up to 100 operations per transaction.

Also note that you can sign a transaction with multiple keys - if you are in control of the relevant keys, you can do a huge number of things in one transaction.

That said, there was an update to the rate limiting algorithm in the second half of 2018 that I found to be less forgiving than the previous one. At the end of the day, if you are running that many transactions, the intention is that you spin up your own node (upon which you can define your own limits).

See the stellar docker quickstart and the official documentation on running a node

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.