Skip to main content
Effect.ts includes a built-in RateLimiter that provides token-bucket and fixed-window algorithms. This guide shows how to use it directly and through voltaire-effect’s RateLimiterService.

Effect’s Built-in RateLimiter

Create rate limiters directly using RateLimiter.make:

Algorithms

Compose Multiple Limits

Chain rate limiters for tiered limits (common with RPC providers):

Weighted Costs

Some operations cost more than others (e.g., eth_getLogs vs eth_blockNumber):

voltaire-effect RateLimiterService

The voltaire-effect package wraps Effect’s RateLimiter with Ethereum-specific features:

Global + Per-Method Limits

Configure different limits for different RPC methods:

Fail-Fast vs Delay

Control behavior when limits are exceeded:
Handle failures:

Real-World: RPC Provider Limits

Common provider rate limits: Configure for your provider:

API Reference

RateLimiter.make

RateLimiter.withCost

DefaultRateLimiter

See Also