Marty signed in and was told "You're joining the line of @bliss". He is member #1. Cause: the last-touch sponsor cookie lives 30 days, and /api/sponsor set invited purely from that cookie. So any member who had ever clicked a teammate's invite link was greeted on the sign-in screen as though logging in would place them under that person. Untrue, and alarming in exactly the wrong place: their sponsor locked at their first purchase and nothing on that screen can move it. Anyone seeing that would reasonably worry their line was about to change. The greeting now shows when someone actually arrived through a link (?ref= in the URL), or when the cookie is present AND this browser has never had an account, which is the genuine "came back later to finish joining" case. A browser that already has an account, or a signed-in session, never sees it. Attribution is deliberately untouched: the cookie still resolves, the sponsor id is still returned, and placement still works exactly as before. Only the greeting changed. fraud.hasAccountOnDevice(req) is the new signal, reusing the device cookie the one-account-per-person checks already set. qa/sponsor-note.mjs (5 assertions) boots its own throwaway server and creates a REAL account so the case is proven rather than assumed: still greeted with ?ref=, still greeted from the cookie on a browser with no account, NOT greeted on the browser that has one, and attribution still resolving. 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.