Bitcoin
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Bitcoin
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Rate limiting caps how many Bitcoin RPC requests you can send in a given window. TheRPC applies it to keep the shared Bitcoin endpoint fast and fair for everyone — without it, one noisy client polling the tip in a tight loop could degrade latency for all. Limits apply at several levels at once: requests per second, requests per minute, a daily quota, and a ceiling on concurrent connections. The exact numbers depend on your subscription plan and are shown in your dashboard, so check there for your current allowances rather than assuming a fixed figure.
When you exceed a limit, TheRPC returns a JSON-RPC error in the standard envelope with code -32029 and a "Rate limit exceeded" message — result is null, as shown below. Alongside the body, the HTTP response carries rate-limit metadata in headers: X-RateLimit-Limit (your ceiling for the window), X-RateLimit-Remaining (how many calls are left), and X-RateLimit-Reset (a Unix timestamp for when the window resets). Read these to pace yourself before you ever hit the error.
Three strategies keep you comfortably under your limits. First, retry with exponential backoff when you see -32029, doubling the wait between attempts instead of retrying immediately. Second, batch independent calls into a single JSON-RPC array request so several reads count as one round trip. Third, choose sensible polling intervals — this matters most on Bitcoin because there is no WebSocket subscription RPC. You can't subscribe to new blocks; you poll the tip with getblockcount or getbestblockhash and react when it changes, so set that interval to the chain's rhythm rather than spinning as fast as possible.
Bitcoin produces a block roughly every 10 minutes under proof-of-work, so polling the tip every second burns quota to learn nothing new the vast majority of the time. The efficient pattern is to poll getblockcount on a short interval only while you're actively waiting for the next block, cache the last value between polls, and act when the height increments. Outside an active wait, a much longer interval (tens of seconds or more) is fine — you'll still notice a new block well within its 10-minute lifetime.
X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset on each response to track headroom in real time.Read your remaining quota programmatically from the response headers — X-RateLimit-Remaining against X-RateLimit-Limit — and slow down or pause when headroom runs low, as the tracking helper below shows. Caching is the other big lever: a lot of Bitcoin data never changes once it's confirmed. A confirmed block and its transactions are immutable, so cache them indefinitely and never re-fetch the same block hash. Cache slow-moving reads like getblockcount for a short window between polls, and you'll cut request volume sharply without losing freshness.
Plans differ along three axes: the request rate you're allowed, your daily quota, and how many concurrent connections you can hold open. Beyond raw counts, heavier reads carry more weight — getblock at verbosity 2 or 3 and a verbose getrawmempool return far larger payloads than a simple getblockcount, so they consume more of your allowance and some may be gated to higher plans. Compare what each tier includes on the pricing page and pick the one that matches your read mix and volume.
getblockcount for a few seconds.