Web3 Builders
Rate Limiting and Abuse Prevention for Crypto APIs
How to protect crypto app APIs from abuse with rate limits, input validation, bot defences, cost controls and privacy-friendly logging, without blocking real users.

Crypto apps attract automated traffic. Bots scrape prices, farm rewards, spam order endpoints, hunt for vulnerabilities and try to exhaust your RPC budget. Without protection, a small team can wake up to a huge infrastructure bill, a database full of junk or a service that real users cannot reach.
Abuse prevention does not need to be complicated, but it needs to be designed in from the start.
Know what attackers want
Different endpoints attract different abuse:
| Endpoint type | Typical abuse |
|---|---|
| Public data APIs | Scraping, excessive polling |
| Order or signup endpoints | Spam submissions, reservation hoarding |
| Reward or faucet endpoints | Farming with many accounts |
| Endpoints that call RPC providers | Running up costs or hitting provider limits |
| Search and filtering | Expensive queries that slow the database |
| Contact forms | Spam and phishing links |
Protect each type according to its risk.
Rate limit by sensible keys
Rate limits restrict how many requests a client can make in a time window. Common keys include:
- IP address or a hashed version of it
- Wallet address for authenticated actions
- API key for partners
- Session identifier
IP-based limits are simple but imperfect, since users behind shared networks can look like one client and attackers can rotate IPs. Combine keys where possible, and set limits generous enough for normal use.
Choose limit styles
- Fixed windows allow a set number of requests per minute or hour
- Sliding windows smooth the edges between windows
- Token buckets allow short bursts while capping sustained rates
- Concurrency limits cap simultaneous expensive operations
For most small apps, fixed or sliding windows stored in a database or edge key-value store are enough.
Protect expensive operations
Endpoints that trigger RPC calls, heavy queries or external services deserve extra protection:
- Cache results that many users request, such as prices or public stats
- Throttle how often a single record can trigger a refresh
- Queue background work rather than doing it on every request
- Cap the amount of work per request, such as block ranges scanned
For example, a payment status endpoint can skip rechecking the chain if the same order was checked a few seconds ago.

Validate everything
Strict input validation prevents both abuse and bugs:
- Enforce maximum lengths for text fields
- Accept only expected formats for addresses, URLs and numbers
- Reject oversized request bodies early
- Allow only safe image types for uploads, and never execute uploaded files
- Escape user content before displaying it
Validation also blocks attempts to store malicious scripts or phishing links in fields that other users will see.
Prevent reservation hoarding
If your app reserves scarce items during checkout, attackers can reserve many items without paying. Limit active reservations per client, keep reservation windows short and release expired reservations automatically.
Use honeypots and challenges carefully
Hidden form fields that humans never fill catch simple bots. Challenges such as captchas stop more advanced bots but add friction. Use challenges only where abuse is proven, and prefer invisible or privacy-respecting options.
Log with privacy in mind
You need logs to detect abuse, but you do not need to store raw personal data forever. Hash IP addresses with a secret salt, keep logs for limited periods and avoid linking wallet addresses to identities unnecessarily.
Monitor and adjust
Watch for spikes in requests, error rates and costs. Tune limits based on real usage. When blocking legitimate users by mistake, provide a clear error message that explains how to retry.
A working example
Proud Globe limits order creation per hashed IP, holds tiles for a fixed window, validates every field and throttles on-chain checks per order. If you are building a crypto API with similar needs, the claim flow shows how those protections feel from a buyer's side.
Educational content only. Nothing here is financial, legal or tax advice. Crypto assets carry risk, so check the details for your own situation.