Files
viraladsource/README.md
T
Marty Bostick edaf98c8f6 ViralAdSource app (Marty approved 2026-11-16): free text ads that spread by reshares, each ad with its own family tree
Watershed look from the approved mockup (hero, topo pattern, icons). Network sign-in through the hub, hub membership, activity ping.
Reshare links per member per ad with branch/step tracking; family-tree dashboard (branch, step, reshares, views, clicks, sign-ups, Boosts).
Verified views earn ad credits for the branch's resharer (L3). L2 sign-up pipeline (hub-new, confirmed email, not self device/IP,
throwaway block, daily cap, fraud score) with keeper-signed reward vouchers and a pending-rewards ledger; payouts OFF (REWARD_PAYOUTS).
L1 Boosts through VASShop with signed orders naming the sponsor line and the resharer. Trust pack, chatbot, promo kit, PolHunter embed.
All numbers are PROPOSALS until Marty sets them. qa/e2e.mjs 59/59 on a local anvil chain, chatbot test 108/108.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 09:19:34 -06:00

59 lines
5.4 KiB
Markdown

# ViralAdSource app (viraladsource.com rebuild)
"Every ad has a source. Watch yours travel." Approved by Marty 2026-11-16 (mockup: Design canvas 2XuFAog3KEiuXbfEvVvTZk).
Plain Node http server, no framework (the ViralAdBlitz / VBB / Downline Banners pattern). Contract: `../contracts` (VASShop).
Every number marked **PROPOSAL** (Boost $5, resharer 20%, pot 10%, sponsor levels 5 x 5%, sign-up reward $0.25 with a daily cap of 10,
10 credits per 100 verified views, tier bonus every 25th sign-up $2.50 locked 14 days, Boost = 7 days on top) is Claude's proposal.
Marty has not set them. Payouts of sign-up rewards are OFF (`REWARD_PAYOUTS`).
## What it does
- **Free text ad** (headline 60, two lines of 90, an https link, or the member's OWN LinkSpin spin link picked from "Use one of my spin
links"; ownership confirmed through LinkSpin's signed partner endpoint `/api/partner/<LS_PARTNER>/links`, op `spins`). One ad per
network member. Membership from the network hub (hubpeople.js), sign-in through the hub (networksso.js, `HUB_SSO=on`) or a wallet signature.
- **Reshares** (tree.js): every ad has a source link `/s/<code>` (step 0). A member who reshares gets ONE unique link per ad; its parent is
the reshare link they arrived through (the `vas.via` tag, last touch, 30 days), so `step` counts how far from the source it travelled and
`branch` is the step-1 link it descends from. `/a/<id>` and `/<username>` open an ad at its source.
- **Family tree** (`GET /api/my` -> `tree`): branch, step, reshares under it, verified views, verified clicks, sign-ups, Boosts, with
totals and the furthest step. Clicks through a reshare link carry the branch: `/go/<ad>?s=<code>`; on LinkSpin links the relay adds
`s2=<resharer>` and `s3=<code>` so LinkSpin Reports split clicks and sign-ups per branch.
- **Verified views** (wire.js, the VBB / ViralAdBlitz rules): the server decides what a page showed; after `VISIT_SECONDS` visible the
browser redeems its ticket; one view per visitor per ad per 24 h; never the owner's own; never a resharer's own link; `VISITS_PER_IP_DAY`.
- **L3 ad credits**: verified views through a reshare link (step 1+) count for that resharer; every `CREDITS_VIEWS` (100) earn
`CREDITS_PER` (10) credits. Credits are spent on the member's own ad in the "Featured with credits" places (1 credit per verified view
there). Never paid out. "Ad credits buy advertising, not income."
- **L2 sign-up rewards** (signup.js): `/join` through a reshare link -> confirm link (MAIL_URL relay; unset on staging = no mail, the admin
page shows the link) -> real-time checks: share (a resharer, never the owner's own link), confirmed email, throwaway domain, **hub-new**
(the hub has never seen the email; `HUB_JOIN=1` writes the join with sponsor = the resharer and requires `created: true`; staging = dry
read, nobody created), not the resharer's own device (rejected) or connection (held), daily cap, fraud score (held at `FRAUD_HOLD`).
Passed -> a row in the pending-rewards ledger with a keeper-signed EIP-712 `Reward(to, usdCents, unlockAt, nonce, deadline)` voucher.
Tier bonuses (`REWARD_TIERS`) carry an `unlockAt`. `REWARD_PAYOUTS=1` relays `claimReward` from `RELAY_KEY`'s wallet (gas only); the
contract pays from the pot. Admin can release / reject / recheck.
- **L1 Boost** (shop.js): `POST /api/my/order` builds a keeper-signed `Order(buyer, sku, qty, ref, line[], resharer, nonce, deadline)`:
line = the buyer's hub sponsor line (wallets, up to 20), resharer = the owner of the reshare link the buyer came through (never the
buyer). The contract pays the resharer cut, the sponsor levels (pass-up over people who never bought), the pot slice and the company in
the same transaction. The watcher records Purchase and RewardPaid events; a Boost puts the ad on top of the reshare board for 7 days per unit.
- **Trust pack** (proof.js): `/ledger` (Boost splits + sign-up rewards, no emails), `/contract` (live from the chain, or the proposals
before deploy), toasts (new ads, reshares, Boosts), Telegram photo card per Boost (off unless `TG_*` are set), Terms / Earnings
Disclaimer / Privacy (TrustClickz, 615 Green Valley Drive, Moody, AL 35004), the network footer (netsites.js).
- **Chatbot** (chatbot.js + the shared chatcore / kb / netkb), **promo kit** (`/promote`, `/api/promo-kit`, 24 creatives
`public/art/kit/vas-{free,tree,boost}-<shape>.png`), **PolHunter embed** on the front page (hunters' visits never count).
- **Old links** (the YourFreeWorld site): `/?<old>`, `/index.php?<old>`, `/splashpg.php?r=`, `/lcp.php?r=` -> the member's ad via
oldrefs.json (`POST /api/admin/oldrefs`, payload D:/tmp/vas-reconcile/oldrefs-admin-payload.json, load at the domain switch); other `*.php` -> `/`.
- **Data**: docstore.js (MySQL via `DOCSTORE_URL`): document `vas.json` + row tables `vas_ads`, `vas_shares`, `vas_visits`, `vas_clicks`,
`vas_signups`, `vas_rewards`.
- **Staging switch**: `STAGING=1` shows the staging bar and enables the admin-only `POST /api/admin/test-member` (marks a wallet as a
test network member). It is refused whenever SITE_HOST is viraladsource.com.
## Run and test
```
npm install
node tools/pages.mjs # regenerate public/*.html (one source of copy + legal facts)
node tools/art.mjs # icon, OG image, proof cards, kit creatives (Playwright)
node qa/e2e.mjs # 59 checks: real VASShop on a local anvil chain + stand-in hub (needs ../contracts built)
node qa/chatbot.test.mjs # the site assistant
```
Env: `.env.example`.