Skip to content

Run exnode as a public serverless endpoint - #11

Merged
samjay8 merged 4 commits into
mainfrom
feat/hosted-node
Oct 25, 2026
Merged

samjay8 merged 4 commits into
mainfrom
feat/hosted-node

Conversation

@samjay8

@samjay8 samjay8 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Lets exnode run as a public, serverless endpoint, so the browser verifier can prove any mainnet transaction without the visitor running a node.

  • api/exnode.go + vercel.json: the same server as exnode serve, as a Vercel function configured from the usual EXNODE_* variables. Defaults suit a public endpoint: CORS for any origin, a rate limit of 1 request/s with bursts of 10, the checkpoint cache in the temp dir, and builds capped at 50 seconds, inside the platform's 60-second limit. The node stays untrusted, so a deployment holds no secrets.
  • --client-ip-header / EXNODE_CLIENT_IP_HEADER: behind a proxy every request comes from the proxy's address, so the per-client limit became one shared limit. The limiter can now key on a header the proxy overwrites on every request, such as Vercel's X-Real-Ip. The docs warn against client-controlled headers.
  • s-maxage on bundles: CDNs cache function responses only with it. Bundles of archived ledgers never change, so each is built once.
  • internal/network: the network table moves out of cmd/exnode, so the CLI and the function share it.

Checked

  • go vet, go test ./..., and golangci-lint (0 issues). New tests cover the header-keyed limiter (two clients behind one proxy address), the s-maxage header, and the function's defaults.
  • Against mainnet today: bundles for a Soroban call and a payment in ledger 65,130,600 built in about 2 s (77 KB each). Both verified with externalize verify, signed by 30 validators from all 10 tier-1 organizations.

Passphrases and SDF archive mirrors were private to package main, so
anything else that builds a node had to copy them. internal/network owns
them now and the CLI looks them up there.
Behind a proxy every request arrives from the proxy's address, so the
per-client limit became one limit shared by everybody. --client-ip-header
(EXNODE_CLIENT_IP_HEADER) names a header to key on instead. It must be one
the proxy overwrites on every request; the doc comment and README say so,
since a client-controlled header would let anyone reset their own limit.
max-age covers browsers only; CDNs such as Vercel's edge cache a function
response when it carries s-maxage. A bundle built from an archived ledger
never changes, so shared caches may keep it for a year too.
api/exnode.go serves the same routes as exnode serve, built once per warm
instance from the EXNODE_* environment, and vercel.json routes every path
to it. Defaults suit a public endpoint: CORS for any origin, a rate limit
keyed on X-Real-Ip, the checkpoint cache in the temp dir, and builds capped
at 50 seconds. The node stays untrusted, so a deployment holds no secrets.
@samjay8
samjay8 merged commit d35da23 into main Oct 25, 2026
8 checks passed
@samjay8
samjay8 deleted the feat/hosted-node branch October 25, 2026 22:54
samjay8 added a commit to Externalize-Labs/externalize that referenced this pull request Oct 25, 2026
https://externalize-node.vercel.app is exnode running as a Vercel function
(Externalize-Labs/externalize-node#11, #12). Like any node it is untrusted:
the page verifies what it returns. ?node=URL still points elsewhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant