Repository navigation
RPC: Alchemy first for mainnet and Sepolia, through the server proxy - #426
Merged
Merged
Conversation
Mainnet production read only through public RPCs (publicnode, BlastAPI, Tenderly), which rate-limit, lag and miss receipts. The /api/rpc proxy now serves mainnet through Alchemy, and both chains try the proxy first, with the public RPCs as fallback. The key stays server-side (ALCHEMY_API_KEY, the new dex223-web app, origin-allowlisted to app and test-app). Without a key the proxy answers 503, past its per-IP limit 429; both move the fallback on.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
app.dex223.io read mainnet only through free public RPCs (publicnode, BlastAPI, Tenderly, then the wallet default). They rate-limit, lag and miss receipts (
receiptAwareFallbackexists because publicnode's Sepolia node drops some), which is a weak base for a production DEX. On Sepolia the keyed providers sat behind publicnode, and the Infura id from the old source answers "Payment Required".Change
lib/server/rpcProxy.ts: newmainnetupstream, Alchemy (eth-mainnet.g.alchemy.com) with the server-onlyALCHEMY_API_KEY.config/wagmi/config.ts:http(rpcProxyUrl("mainnet"))first for mainnet andhttp(rpcProxyUrl("sepolia"))first for Sepolia; public RPCs follow as fallback, in the same order as before.The key comes from a new Alchemy app
dex223-web(Ethereum mainnet + Sepolia, origin allowlist app.dex223.io and test-app.dex223.io; the proxy sends the production Origin). Already set in Vercel for production, preview and development; stored in 1Password "Dex223 - Production" / "Alchemy dex223-web API key". Verified at Alchemy: our origin answers, a foreign origin and a missing origin are refused (403).Verification
apps/web/tests/apiProxies.test.cjs: 13 passing. ESLint clean on the changed files./api/rpc/mainnetand/api/rpc/sepoliaon the staged deployment before promoting.Load and limits
Every browser read now goes through a Vercel function. The proxy allows 600 calls per minute per IP per instance and batches of up to 20; past that it answers 429 and the browser falls back to the public RPCs. Watch Alchemy usage and Vercel function invocations for the first days.
Open
dex223-backendAlchemy app (1Password "Alchemy dex223-backend API key"); those are production server switches.