Second delivery surface for member campaigns, and deliberately the opposite shape to the Network Ad Space rail: that one is Tier 3 heavy, this one only has prices configured for US, CA, GB, AU, NZ and UM, so its traffic is Tier 1 by construction. The AdRevLinks database is not reachable from this server, so rather than opening a database port to the internet there is a narrow authenticated endpoint on that box which does the insert locally. Five actions, no general query surface: a leaked key can only create or remove popup campaigns. The secret lives outside that server's webroot and is compared in constant time; Apache there strips Authorization, so it travels as X-Bridge-Key. adrevlnks.js mirrors nas.js, with two rules carried over from this morning's billing bug: - DELIVERY IS READ, NEVER DERIVED. status returns the rotator's own per-country counters. Nothing is computed from a figure a stop could overwrite, which is exactly what charged 16 members for undelivered impressions on the NAS side. - EVERY WRITE IS IDEMPOTENT. Each campaign carries ref "iap:<id>", so a retry after a timeout returns the existing campaign instead of booking a second one. Capped on purpose. That server serves roughly 5,500 popup impressions a DAY in total, shared by every active campaign, and its rotator favours whichever has delivered least. So syndicating everything unchecked would starve what is already running, Marty's own ads included. Hence a credit floor and a per-campaign view cap. Cost is not the reason: he owns the platform and treats the placements as free. Finite shared inventory is the reason. Hooked into create, pause/resume and the scheduled end sweep so both networks stay in step. Inert unless ADREVLNKS_BRIDGE_URL and _KEY are set, and a bridge hiccup can never block a campaign going live. qa/adrevlnks-bridge.mjs (15 assertions) drives the REAL endpoint: under-floor campaigns skipped, full credit value booked, Tier 1 targeting, retry returns the same campaign, delivery read back, pause/resume mirrored, then deleted and confirmed gone. Creates only paused campaigns so no live traffic is spent, and leaves nothing behind. nas-served 8, fraud-allow 12, sponsor-note 5, chatbot-parse 35, qa/run.sh member 0 bugs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
InstantAdPay — site
Membership advertising with immutable on-chain settlement. Zero-dependency Node server (RM Circle pattern): static pages + JSON API + SSE ledger.
Architecture
server.js— http server: pages,/api/*,/join/<id>sponsor links, SSE feedchain.js— contract reader + persistent event indexer (free public RPCs)auth.js— SIWE wallet sign-in (EIP-4361), sessions in the volumeaccounts.js— site-side records only (free members, last-touch sponsor attribution, handles). The CHAIN is the source of truth for money/credits.public/— landing, live ledger, member area; no client libraries
Chain flip (rehearsal → mainnet)
Everything chain-specific lives in data/config.json (volume):
{contract, chainId, chainName, explorer, rpcs, deployBlock}.
Defaults point at the Amoy rehearsal deployment. Launch = deploy the
mainnet contract, wipe accounts.json/sessions.json/chain-index.json,
PATCH /api/admin/chain with the mainnet values, set rehearsal:false via
/api/admin/site. Same code, different config.
Run
PORT=3100 node server.js # DATA_DIR defaults to ./data
Admin API auth: Authorization: Bearer $ADMIN_PASSWORD.
Spec: ../CONTRACT-SPEC.md (v1.0.3-frozen). Contracts: ../contracts/.
Chatbot knowledge is part of every change
chatbot.js answers members two ways: CANNED regex answers and systemPrompt() for the AI. Any
change that a member could ask about (a new pane, a rule, a price, a limit, a fix they noticed) is not
done until both are updated in the same commit, and KNOWLEDGE_DATE in chatbot.js is bumped. The QA
runner (bash qa/run.sh public) fails when a release note on the live site is newer than that date.