Public Rate Limits
OnFinality adds rate limiting to its public API endpoints. By default, the rate limit allows:
HTTP: 3000 response units/minute per IP address
Websocket: 150 response units/second per IP address
We have different rate limits set for private API endpoints (e.g. ones with API tokens attached) - See more here https://onfinality.io/pricing
How do we measure this?
For web sockets, we use the Token Bucket approach. Each web socket connection has a “bucket” of tokens, representing allowed web socket responses.
For our standard rate limit of 150 response units per second:
150 tokens are added to the bucket per second
The bucket can hold a maximum of 150 tokens. If a token arrives at the bucket when it is full it will be discarded
That means that each web socket connection can sustain a steady stream of 150 response units per second.
Other networks, such as Moonbeam, have a higher burst setting than the per second limit. For example, in a setup of 50 response units per second with 100 burst:
A new connection opens with 100 tokens in their bucket
50 tokens are added to the bucket per second
The bucket can hold a maximum of 100 tokens. If a token arrives at the bucket when it is full it will be discarded
That means that each Moonbeam web socket connection can sustain a steady stream of 50 response units per second, and short bursts of 100 requests.
Read more on Wikipedia: https://en.wikipedia.org/wiki/Token_bucket
Rate Limit Responses
When a web sockets connection receives a response but has no available tokens OnFinality will return the following error:
Protocol | Response Code | Error Message | Example |
---|---|---|---|
HTTP |
| API rate limit exceeded |
CODE
|
WebSocket |
| Too Many Requests, Please apply for an OnFinality API key to receive a higher rate limit |
|
We recommend pausing requests over the web sockets connection for several seconds after receiving one of the above error messages to allow the token bucket to fill before trying again.
Access Higher Rate Limits
Rate limits only apply to the Public API and endpoints that have a free API key.
If an app requires a higher rate limit they can upgrade to a paid plan for their OnFinality Workspace and attach their API key to their request. Upgrade now at https://app.onfinality.io
Public Rate Limit Exceptions
The following public API endpoints have rate limits different to the default. These may change at any moment and without warning.
Public API | Rate Limit | Burst | Duration |
---|---|---|---|
Abritrum | 10 | 10 | / minute |
Acala | 50 | 100 | / second |
Astar | 100 | 100 | / second |
Aleph Zero | 50 | 50 | / second |
Bifrost Kusama | 50 | 50 | / second |
Polkadot | 2 | 5 | / second |
Kusama | 2 | 5 | / second |
Westend | 5 | 5 | / second |
Statemint | 5 | 5 | / second |
Collectives | 5 | 5 | / second |
DFK Chain | 10 | 10 | / minute |
Moonbeam | 1 | 2 | / second |
Moonriver | 2 | 5 | / second |
Moonbase Alpha | 2 | 5 | / second |
BNB Smart Chain | 10 | 10 | / minute |
Clover | 10 | 10 | / minute |
Ethereum | 10 | 10 | / minute |
Evmos | 10 | 10 | / minute |
Fantom | 10 | 10 | / minute |
Fuse Network | 10 | 10 | / minute |
Gnosis | 10 | 10 | / minute |
Goerli | 10 | 10 | / minute |
Harmony | 10 | 10 | / minute |
Kava | 10 | 10 | / minute |
Klaytn | 10 | 10 | / minute |
OKT Chain | 10 | 10 | / minute |
Optimism | 10 | 10 | / minute |
Osmosis | 10 | 10 | / minute |
Polygon | 10 | 10 | / minute |
Technical Solution
For networks who would like to replicate the rate limit on their own public API endpoint