diff --git a/netsites.js b/netsites.js new file mode 100644 index 0000000..2536f92 --- /dev/null +++ b/netsites.js @@ -0,0 +1,40 @@ +// The network sites list for the footer's "Part of the network" line (Marty 2026-11-14 trust pack). +// One source: the hub's public GET /v1/network-sites (HUB_URL). Cached 10 minutes, refreshed in the background, never waits on a +// slow hub (2.5 s timeout), and falls back to the same built-in list. Never RM Circle, never the games. +// The same file lives in every network site (InstantAdPay, LinkSpin, Downline Banners, VBB, Stack POL). +const FALLBACK = [ + { id: 'iap', name: 'InstantAdPay', url: 'https://instantadpay.com' }, + { id: 'linkspin', name: 'LinkSpin', url: 'https://linkspin.app' }, + { id: 'dlb', name: 'Downline Banners', url: 'https://downlinebanners.com' }, + { id: 'vbb', name: 'Viral Banner Blitz', url: 'https://viralbannerblitz.com' }, + { id: 'stackpol', name: 'Stack POL', url: 'https://stackpol.com' }, + { id: 'earnerscorner', name: 'Earners Corner', url: 'https://earnerscorner.com' } +]; +const TTL = 10 * 60 * 1000; +let cache = { at: 0, list: FALLBACK, from: 'fallback' }; +let inflight = null; + +const hubUrl = () => String(process.env.HUB_URL || 'https://hub.saasy.top').trim().replace(/\/+$/, ''); +function clean(list) { + if (!Array.isArray(list)) return null; + const ok = list.filter(s => s && typeof s.name === 'string' && /^https:\/\/[a-z0-9.-]+(\/[^\s"'<>]*)?$/i.test(String(s.url || ''))) + .slice(0, 30).map(s => ({ id: String(s.id || s.name).toLowerCase().replace(/[^a-z0-9]+/g, '').slice(0, 30), name: String(s.name).slice(0, 60), url: String(s.url).replace(/\/+$/, '') })); + return ok.length ? ok : null; +} +function refresh() { + if (inflight || process.env.NETWORK_SITES_HUB === '0') return inflight; + const ac = new AbortController(); const t = setTimeout(() => ac.abort(), 2500); + inflight = fetch(hubUrl() + '/v1/network-sites', { signal: ac.signal }) + .then(r => (r.ok ? r.json() : null)) + .then(j => { const l = clean(j); if (l) cache = { at: Date.now(), list: l, from: 'hub' }; else cache.at = Date.now(); }) + .catch(() => { cache.at = Date.now() - TTL + 60 * 1000; }) // hub down: try again in a minute, keep the last good list + .finally(() => { clearTimeout(t); inflight = null; }); + return inflight; +} +function list() { if (Date.now() - cache.at > TTL) refresh(); return cache.list; } +// GET /api/network-sites: public, cacheable, the same answer on every page +function handle(req, res) { + res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'public, max-age=300', 'X-Content-Type-Options': 'nosniff' }); + res.end(JSON.stringify(list())); +} +module.exports = { list, handle, refresh, FALLBACK, _state: () => cache }; diff --git a/prize.js b/prize.js index 9889fd1..fff09d6 100644 --- a/prize.js +++ b/prize.js @@ -28,6 +28,8 @@ const ADDR_RE = /^0x[0-9a-fA-F]{40}$/; const BOARDS = ['visitors', 'sources']; const COMPANY = '0x7627fc78876948ac9d95c1c9eb061e7d6d647b70'; let C = null, key = null, D = null, busy = false, timer = null; +let onConfirmed = null; // proof.js: one Telegram line per confirmed prize transfer (2026-11-14); this module still posts nothing itself +function setHook(fn) { onConfirmed = typeof fn === 'function' ? fn : null; } const st = { prepared: 0, paid: 0, lastError: null }; const FILE = () => path.join(C.dataDir, 'prizes.json'); @@ -166,7 +168,7 @@ function watchReceipts(week) { const plan = D.weeks[week]; if (!plan) { watching.delete(week); return; } for (const t of plan.transfers) { if (t.status !== 'sent' || !t.tx) continue; - try { const r = await shop.receipt(t.tx); if (r.found) { t.status = r.status === '0x1' ? 'confirmed' : 'reverted'; t.block = parseInt(r.blockNumber, 16); save(); } } catch (e) {} + try { const r = await shop.receipt(t.tx); if (r.found) { t.status = r.status === '0x1' ? 'confirmed' : 'reverted'; t.block = parseInt(r.blockNumber, 16); save(); if (t.status === 'confirmed' && onConfirmed) { try { onConfirmed(plan, t); } catch (e) {} } } } catch (e) {} } const open = plan.transfers.some(t => t.status === 'sent'); if (!open && (plan.status === 'sent' || plan.status === 'paying')) { plan.status = plan.transfers.every(t => t.status === 'confirmed') ? 'paid' : 'partial'; plan.payment.doneAt = Date.now(); save(); } @@ -184,4 +186,4 @@ function history(n) { function plans() { return Object.values(D.weeks).sort((a, b) => b.week.localeCompare(a.week)); } function view() { return Object.assign({ keyOn: !!key, keyAddress: key ? key.address.toLowerCase() : null, prizeWallet: C.prizePot.wallet, weeks: Object.keys(D.weeks).length }, st); } -module.exports = { init, pot, prepare, pay, quotePlan, history, plans, view, prevWeek, auto }; +module.exports = { setHook, init, pot, prepare, pay, quotePlan, history, plans, view, prevWeek, auto }; diff --git a/proof.js b/proof.js new file mode 100644 index 0000000..f3ce3f4 --- /dev/null +++ b/proof.js @@ -0,0 +1,184 @@ +// Trust pack (Marty 2026-11-14: "all these sites need to show their live ledger and the contract for proof and trust, and toast +// notifications ... post a Telegram with some kind of image and stats, and payment notifications"). The Downline Banners pattern. +// - ledger(): every VBBShop purchase (from the Purchase events shop.js credited) with its split, and every weekly prize transfer, +// newest first, each with its transaction. Public, read by /ledger and the toasts. +// - contract(): the live contract facts for /contract (owner, prize wallet, company, keeper, paused, what it holds), read from the +// chain and cached 5 minutes; the split constants are the contract's own (30 / 10 / 60). +// - Telegram: one photo card per purchase (a prebuilt VBB proof image, rotated, + who bought what, the split paid in that same +// transaction, this week's numbers and the verify link) and one line per confirmed prize payout, in the group's payments topic +// (TG_CHAT / TG_PAY_TOPIC, the CTB Rewards bot TG_TOKEN, same as Downline Banners and the games). Sent once per transaction +// across app copies (docstore.claim). Never posts anything older than 2 hours (a re-index after downtime must not flood the +// topic). Off unless TG_TOKEN and TG_CHAT are set. TG_API (tests only) points at a stand-in. +'use strict'; +const store = require('./store'); +const docstore = require('./docstore'); + +const SPLIT = { sponsorBps: 3000, prizeBps: 1000, denom: 10000 }; // VBBShop SPONSOR_BPS / PRIZE_BPS (constants in the contract) +const ZERO = '0x0000000000000000000000000000000000000000'; +const ADDR_RE = /^0x[0-9a-fA-F]{40}$/; +// Paid(uint256 indexed id, address indexed to, uint256 amount, uint8 role) / PaymentFailed(same): read from the purchase receipt +const { Interface } = require('ethers'); +const EV = new Interface(['event Paid(uint256 indexed id, address indexed to, uint256 amount, uint8 role)', 'event PaymentFailed(uint256 indexed id, address indexed to, uint256 amount, uint8 role)']); +const T_PAID = EV.getEvent('Paid').topicHash, T_FAIL = EV.getEvent('PaymentFailed').topicHash; +const ROLE = ['sponsor', 'prize', 'company']; +const CARDS = ['/art/proof/vbb-proof-pink.png', '/art/proof/vbb-proof-blue.png', '/art/proof/vbb-proof-yellow.png']; // rotated per post +const st = { posted: 0, prizeLines: 0, skipped: 0, failed: 0, lastError: null }; +let C = null, shop = null, prize = null, names = null; +const sent = new Set(); // this copy's own guard (docstore.claim covers app copies; without MySQL it always says yes) +const once = k => { if (sent.has(k)) return false; sent.add(k); if (sent.size > 5000) sent.clear(); return true; }; + +function init(cfg, deps) { C = cfg; shop = deps.shop; prize = deps.prize; names = deps.nameOf || null; } +const on = () => !!(process.env.TG_TOKEN && process.env.TG_CHAT); +const lc = a => String(a || '').toLowerCase(); +const short = a => a ? a.slice(0, 6) + '...' + a.slice(-4) : ''; +function nameLocal(addr) { const m = store.member(lc(addr)); return m && m.username ? m.username : null; } +async function nameOf(addr) { + const a = lc(addr); const local = nameLocal(a); if (local) return local; + if (names) { try { const n = await names(a); if (n) return n; } catch (e) {} } + return null; +} +const who = (addr, name) => name ? '@' + name : short(lc(addr)); +const pol = wei => { const v = Number(BigInt(wei || 0) / 10n ** 12n) / 1e6; return v >= 100 ? v.toFixed(2) : v.toFixed(4); }; +const usd = cents => '$' + (Number(cents || 0) / 100).toFixed(2); +const esc = s => String(s == null ? '' : s).replace(/[&<>]/g, c => ({ '&': '&', '<': '<', '>': '>' }[c])); + +// what a purchase bought, in words (SKUs from config: packs and the banner look) +function what(x) { + if (x.credits > 0) return x.credits + ' post credits'; + if (Number(x.sku) === Number(C.lookSku)) return 'the banner look'; + return 'package #' + x.sku; +} +// the split of one purchase. From the receipt's Paid / PaymentFailed events when read, else from the contract's fixed math +// (sponsorPaid from the Purchase event, prize = 10% of the price paid, company = the rest). +function split(x) { + if (Array.isArray(x.pays) && x.pays.length) return x.pays; + let paid = 0n, sp = 0n; try { paid = BigInt(x.weiPaid || 0); sp = BigInt(x.sponsorPaid || 0); } catch (e) {} + const prizeWei = paid * BigInt(SPLIT.prizeBps) / BigInt(SPLIT.denom); + const out = []; + if (x.sponsor && x.sponsor !== ZERO && sp > 0n) out.push({ role: 'sponsor', to: lc(x.sponsor), wei: sp.toString() }); + out.push({ role: 'prize', to: lc(C.prizePot.wallet), wei: prizeWei.toString() }); + out.push({ role: 'company', to: null, wei: (paid - sp - prizeWei).toString() }); + return out; +} +// the Paid / PaymentFailed events of one purchase, from its receipt (null if the RPC does not answer) +async function readPays(tx, orderId) { + const r = await shop.rpc('eth_getTransactionReceipt', [tx]); if (!r || !Array.isArray(r.logs)) return null; + const out = []; + for (const l of r.logs) { + if (lc(l.address) !== lc(C.contractAddress) || (l.topics[0] !== T_PAID && l.topics[0] !== T_FAIL)) continue; + const d = EV.parseLog({ topics: l.topics, data: l.data }).args; if (Number(d.id) !== Number(orderId)) continue; + out.push({ role: ROLE[Number(d.role)] || 'role' + Number(d.role), to: lc(d.to), wei: d.amount.toString(), failed: l.topics[0] === T_FAIL || undefined }); + } + return out.length ? out : null; +} + +// ---- public ledger ---- +function purchases() { + const P = (store.state() && store.state().purchases) || {}; + return Object.entries(P).map(([k, x]) => Object.assign({ tx: k.split(':')[0] }, x)); +} +function ledger(n) { + const lim = Math.min(200, Math.max(1, Number(n) || 50)); + const rows = purchases().map(x => { + const s = split(x); + return { kind: 'purchase', tx: x.tx, at: (x.blockAt ? x.blockAt * 1000 : x.at) || null, orderId: x.orderId, buyer: x.buyer, buyerName: nameLocal(x.buyer), what: what(x), + usdCents: x.usdCents, weiPaid: x.weiPaid, pays: s.map(p => ({ role: p.role, to: p.to, name: p.to ? nameLocal(p.to) : null, wei: p.wei, failed: p.failed || undefined })) }; + }); + for (const wk of (prize && prize.history ? prize.history(52) : [])) for (const w of wk.winners) { + if (!w.tx) continue; + rows.push({ kind: 'prize', tx: w.tx, at: wk.paidAt || null, week: wk.week, board: w.board, place: w.place, name: w.name, usd: w.usd, pol: w.pol, confirmed: !!w.confirmed }); + } + rows.sort((a, b) => (b.at || 0) - (a.at || 0)); + const P = purchases(); let wei = 0n, cents = 0, sponsors = 0n; + for (const x of P) { try { wei += BigInt(x.weiPaid || 0); sponsors += BigInt(x.sponsorPaid || 0); } catch (e) {} cents += Number(x.usdCents) || 0; } + const prizesPaid = rows.filter(r => r.kind === 'prize' && r.confirmed).length; + return { contract: C.contractAddress || null, explorer: C.explorer, items: rows.slice(0, lim), + totals: { purchases: P.length, usdCents: cents, weiPaid: wei.toString(), sponsorWei: sponsors.toString(), prizePayouts: prizesPaid } }; +} + +// ---- contract facts (cached 5 minutes) ---- +let cCache = null; +async function contract() { + if (cCache && Date.now() - cCache.at < 300000) return cCache.v; + const v = { address: C.contractAddress || null, chainId: C.chainId, explorer: C.explorer, split: { sponsorPct: 30, prizePct: 10, companyPct: 60 }, + // Marty 2026-11-14: source verified on Sourcify (exact match, 2026-11-13); Polygonscan's own verification is pending + verified: { sourcify: true, polygonscan: 'pending', sourcifyUrl: C.contractAddress ? 'https://repo.sourcify.dev/' + C.chainId + '/' + C.contractAddress : null }, + ownerNote: "Marty's Tangem hardware wallet", live: false }; + if (shop && shop.watching()) { + const I = new Interface(['function owner() view returns (address)', 'function company() view returns (address)', 'function keeper() view returns (address)', + 'function prizeWallet() view returns (address)', 'function paused() view returns (bool)', 'function totalOwed() view returns (uint256)', 'function orderCount() view returns (uint256)']); + const read = async fn => I.decodeFunctionResult(fn, await shop.rpc('eth_call', [{ to: C.contractAddress, data: I.encodeFunctionData(fn, []) }, 'latest']))[0]; + try { + const [owner, company, keeper, prizeWallet, paused, totalOwed, orderCount, bal] = await Promise.all(['owner', 'company', 'keeper', 'prizeWallet', 'paused', 'totalOwed', 'orderCount'].map(read) + .concat([shop.rpc('eth_getBalance', [C.contractAddress, 'latest'])])); + Object.assign(v, { owner: lc(owner), company: lc(company), keeper: lc(keeper), prizeWallet: lc(prizeWallet), paused: !!paused, totalOwedWei: totalOwed.toString(), + orderCount: Number(orderCount), balanceWei: BigInt(bal).toString(), live: true, readAt: Date.now() }); + } catch (e) { v.error = 'The chain did not answer just now. Try again in a minute.'; } + } + cCache = { at: Date.now(), v: v }; + if (v.error) cCache.at = Date.now() - 240000; // retry sooner + return v; +} + +// ---- Telegram ---- +async function tg(method, body) { + const base = String(process.env.TG_API || 'https://api.telegram.org').replace(/\/+$/, ''); + const b = Object.assign({ chat_id: process.env.TG_CHAT, parse_mode: 'HTML' }, body); + if (process.env.TG_PAY_TOPIC) b.message_thread_id = Number(process.env.TG_PAY_TOPIC); + const r = await fetch(base + '/bot' + process.env.TG_TOKEN + '/' + method, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(b), signal: AbortSignal.timeout(15000) }); + const j = await r.json().catch(() => ({})); + if (!j.ok) { st.failed++; st.lastError = String(j.description || r.status).slice(0, 160); console.error('proof: telegram', method, 'failed', r.status, st.lastError); return false; } + return true; +} +// this week's numbers (Central-time week): purchases and dollars from the credited events, the prize pot the site already shows +function weekLine() { + const wk = store.ctWeek(); const s = shop.weekSales(wk, store.ctWeek); let potUsd = null; + try { potUsd = prize.pot(wk).potUsd; } catch (e) {} + return '\u{1F4CA} This week: ' + s.purchases + ' purchase' + (s.purchases === 1 ? '' : 's') + ', ' + usd(s.cents) + (potUsd != null ? ' · prize pot $' + Number(potUsd).toFixed(2) : ''); +} +async function caption(x) { + const lines = ['\u{1F4A5} Viral Banner Blitz', '\u{1F9FE} ' + esc(who(x.buyer, await nameOf(x.buyer))) + ' bought ' + esc(what(x)) + ' · ' + usd(x.usdCents) + ' (' + pol(x.weiPaid) + ' POL)']; + for (const p of split(x)) { + if (p.failed) { lines.push('⚠️ ' + (p.role === 'sponsor' ? 'Sponsor' : p.role) + ' payment to ' + esc(who(p.to, await nameOf(p.to))) + ' bounced; it waits in the contract for them to claim'); continue; } + if (p.role === 'sponsor') lines.push('\u{1F4B8} Sponsor 30%: ' + pol(p.wei) + ' POL → ' + esc(who(p.to, await nameOf(p.to)))); + else if (p.role === 'prize') lines.push('\u{1F3C6} Weekly prize pot 10%: ' + pol(p.wei) + ' POL'); + else if (p.role === 'company') lines.push('\u{1F3E6} Viral Banner Blitz: ' + pol(p.wei) + ' POL'); + } + lines.push('Split by the contract in this same transaction. The contract keeps nothing and there is nothing to withdraw.'); + lines.push(weekLine()); + lines.push('· Verify on Polygonscan · Live ledger'); + return lines.join('\n'); +} +let card = 0; +// shop.js calls this once per newly credited purchase (rec = the stored purchase, tx = its transaction) +function onPurchase(rec, tx) { + const x = Object.assign({ tx }, rec); + (async () => { + // the real split from the receipt (a bounced push shows as owed), kept on the purchase for the ledger + try { const pays = await readPays(tx, rec.orderId); if (pays) { const S = store.state(); const k = Object.keys(S.purchases || {}).find(k2 => k2.startsWith(lc(tx) + ':') && S.purchases[k2].orderId === rec.orderId); if (k) { S.purchases[k].pays = pays; store.save(); } x.pays = pays; } } catch (e) {} + if (!on()) return; + const at = (rec.blockAt ? rec.blockAt * 1000 : rec.at) || Date.now(); + if (Date.now() - at > 2 * 3600000) { st.skipped++; return; } + const text = await caption(x); + if (!once('p:' + lc(tx) + ':' + rec.orderId) || !(await docstore.claim('vbbtg:' + lc(tx) + ':' + rec.orderId))) return; // another app copy already posted this purchase + const photo = 'https://' + C.site + CARDS[card++ % CARDS.length]; + let ok = await tg('sendPhoto', { photo: process.env.TG_PHOTO_BASE ? String(process.env.TG_PHOTO_BASE).replace(/\/+$/, '') + CARDS[(card - 1) % CARDS.length] : photo, caption: text }); + if (!ok) ok = await tg('sendMessage', { text, disable_web_page_preview: true }); // a photo the API cannot fetch still gets its proof line + if (ok) { st.posted++; console.log('proof: posted purchase', String(tx).slice(0, 12)); } + })().catch(e => { st.failed++; st.lastError = String(e.message).slice(0, 160); }); +} +// prize.js calls this when a prize transfer confirms on chain +function onPrize(plan, t) { + if (!on() || !t || !t.tx) return; + (async () => { + if (t.sentAt && Date.now() - t.sentAt > 2 * 3600000) { st.skipped++; return; } + if (!once('z:' + lc(t.tx)) || !(await docstore.claim('vbbtg-prize:' + lc(t.tx)))) return; + const board = t.board === 'sources' ? 'most traffic sources' : 'most verified visitors'; + const place = ['1st', '2nd', '3rd'][t.place - 1] || ('#' + t.place); + const text = '\u{1F3C6} Viral Banner Blitz weekly prize\n' + esc(t.name || short(t.address)) + ' · ' + place + ' place, ' + board + ' (week of ' + esc(plan.week) + '): ' + + esc(t.pol) + ' POL ($' + Number(t.usd).toFixed(2) + ')\n· Verify on Polygonscan · Live ledger'; + if (await tg('sendMessage', { text, disable_web_page_preview: true })) { st.prizeLines++; console.log('proof: posted prize', String(t.tx).slice(0, 12)); } + })().catch(e => { st.failed++; st.lastError = String(e.message).slice(0, 160); }); +} +function view() { return Object.assign({ telegram: on(), topic: process.env.TG_PAY_TOPIC || null }, st); } +module.exports = { init, ledger, contract, onPurchase, onPrize, caption, split, view, on, CARDS }; diff --git a/public/admin.html b/public/admin.html index 60bd5ab..8cfea7f 100644 --- a/public/admin.html +++ b/public/admin.html @@ -22,7 +22,7 @@ - +
@@ -36,7 +36,7 @@
- + diff --git a/public/art/proof/vbb-proof-blue.png b/public/art/proof/vbb-proof-blue.png new file mode 100644 index 0000000..760873d Binary files /dev/null and b/public/art/proof/vbb-proof-blue.png differ diff --git a/public/art/proof/vbb-proof-pink.png b/public/art/proof/vbb-proof-pink.png new file mode 100644 index 0000000..d91ebd2 Binary files /dev/null and b/public/art/proof/vbb-proof-pink.png differ diff --git a/public/art/proof/vbb-proof-yellow.png b/public/art/proof/vbb-proof-yellow.png new file mode 100644 index 0000000..798777f Binary files /dev/null and b/public/art/proof/vbb-proof-yellow.png differ diff --git a/public/assets/common.js b/public/assets/common.js index 42b5598..3bfda3c 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -47,25 +47,55 @@ window.VBB = (function () { const f = document.createElement('footer'); f.className = 'foot'; f.innerHTML = '

Viral Banner Blitz, part of the Crypto Team Build Network

' + '

A banner that cycles earns advertising across the network, not cash. Nothing here is an income opportunity.

' - + '

The loop · Leaderboards · How it works · Packages · Promote · My Banners

'; + + '

The loop · Leaderboards · How it works · Packages · Promote · My Banners

' + // trust pack (Marty 2026-11-14): legal + proof links, company line, and the network line served by the hub + + '' + + '

TrustClickz · 615 Green Valley Drive, Moody, AL 35004

'; document.body.appendChild(f); + netLine(f.querySelector('.netline')); toasts(); } - // live cycle toasts: real cycles from the ledger only, bottom-left, one at a time, never older than 30 minutes + // "Part of the network": the list comes from the hub through /api/network-sites, the built-in copy if it does not answer + const NET = [['iap', 'InstantAdPay', 'https://instantadpay.com'], ['linkspin', 'LinkSpin', 'https://linkspin.app'], ['dlb', 'Downline Banners', 'https://downlinebanners.com'], + ['vbb', 'Viral Banner Blitz', 'https://viralbannerblitz.com'], ['stackpol', 'Stack POL', 'https://stackpol.com'], ['earnerscorner', 'Earners Corner', 'https://earnerscorner.com']].map(a => ({ id: a[0], name: a[1], url: a[2] })); + function netLine(el) { + if (!el) return; + const paint = list => { el.innerHTML = 'Part of the network · One account across the network: ' + list.map(s => (s.id === 'vbb' || /viralbannerblitz\.com/.test(s.url)) + ? '' + esc(s.name) + '' : '' + esc(s.name) + '').join(' · '); }; + paint(NET); + fetch('/api/network-sites').then(r => r.json()).then(l => { if (Array.isArray(l) && l.length) paint(l); }).catch(() => {}); + } + // live toasts: real cycles, purchases and prize payouts only, bottom-left, one at a time, never older than 30 minutes let toastsOn = false; function toasts() { if (toastsOn) return; toastsOn = true; const seen = new Set(); let first = true; const box = document.createElement('div'); box.className = 'toasts'; box.setAttribute('aria-live', 'polite'); document.body.appendChild(box); + const polOf = w => { try { const v = Number(BigInt(w || 0) / 10n ** 14n) / 1e4; return v.toFixed(v >= 100 ? 2 : 4); } catch (e) { return '0'; } }; + const whoOf = (a, nm) => nm ? '@' + esc(nm) : esc(short(String(a || ''))); const show = c => { - const el = document.createElement('a'); el.className = 'toast'; el.href = '/how'; - el.innerHTML = '' + (c.name ? esc(c.name) + '\'s banner' : 'A banner') + ' just cycled
' + n(c.views) + ' network ad views earned for its owner'; + const el = document.createElement('a'); el.className = 'toast'; + if (c.kind === 'purchase') { // trust pack 2026-11-14: real purchases from the ledger, with the sponsor paid in the same transaction + const sp = (c.pays || []).find(p => p.role === 'sponsor' && !p.failed); + el.href = '/ledger'; el.className = 'toast buy'; + el.innerHTML = '' + whoOf(c.buyer, c.buyerName) + ' bought ' + esc(c.what) + '
' + (sp ? whoOf(sp.to, sp.name) + ' got ' + polOf(sp.wei) + ' POL, same transaction' : 'paid on-chain, split by the contract') + ''; + } else if (c.kind === 'prize') { + el.href = '/ledger'; el.className = 'toast prize'; + el.innerHTML = '' + esc(c.name) + ' won a weekly prize
' + esc(c.pol) + ' POL paid on-chain'; + } else { + el.href = '/how'; + el.innerHTML = '' + (c.name ? esc(c.name) + '\'s banner' : 'A banner') + ' just cycled
' + n(c.views) + ' network ad views earned for its owner'; + } box.appendChild(el); requestAnimationFrame(() => el.classList.add('in')); setTimeout(() => { el.classList.remove('in'); setTimeout(() => el.remove(), 400); }, 7000); }; const tick = async () => { - let d; try { d = await getJSON('/api/recent'); } catch (e) { return; } if (!d || !d.cycles) return; - const fresh = d.cycles.filter(c => !seen.has(c.id)); d.cycles.forEach(c => seen.add(c.id)); + const [d, l] = await Promise.all([getJSON('/api/recent').catch(() => null), getJSON('/api/ledger?n=6').catch(() => null)]); + const all = []; + ((d && d.cycles) || []).forEach(c => all.push(Object.assign({ key: 'c' + c.id }, c))); + ((l && l.items) || []).filter(x => x.at && Date.now() - x.at < 30 * 60000).forEach(x => all.push(Object.assign({ key: x.kind + x.tx + (x.place || '') + (x.board || '') }, x))); + all.sort((a, b) => (b.at || 0) - (a.at || 0)); + const fresh = all.filter(c => !seen.has(c.key)); all.forEach(c => seen.add(c.key)); const list = first ? fresh.slice(0, 1) : fresh.reverse(); first = false; list.slice(0, 3).forEach((c, i) => setTimeout(() => show(c), 1500 + i * 8000)); }; diff --git a/public/assets/contract.js b/public/assets/contract.js new file mode 100644 index 0000000..097adfb --- /dev/null +++ b/public/assets/contract.js @@ -0,0 +1,21 @@ +// Contract proof page (trust pack 2026-11-14): live facts from /api/contract (read from Polygon, cached 5 minutes on the server). +(async function () { + VBB.renderNav('/contract'); VBB.renderFooter(); + const el = document.getElementById('facts'); const esc = VBB.esc; + let d; try { d = await VBB.getJSON('/api/contract'); } catch (e) { d = {}; } + const ex = d.explorer || 'https://polygonscan.com'; + const addr = (a, note) => a ? '' + esc(VBB.short(a)) + '' + (note ? '
' + note + '' : '') : 'not read yet'; + const pol = w => { try { const v = BigInt(w || 0); return (Number(v / 10n ** 14n) / 1e4).toFixed(4) + ' POL'; } catch (e) { return '0 POL'; } }; + if (!d.address) { el.innerHTML = 'The contract address is not set on this copy of the site.'; return; } + const rows = [ + ['Contract', addr(d.address, 'VBBShop on ' + (d.chainId === 137 ? 'Polygon' : 'chain ' + d.chainId))], + ['Source code', 'Verified on Sourcify (exact match). Polygonscan verification: ' + esc(d.verified && d.verified.polygonscan === 'pending' ? 'pending' : 'done')], + ['Owner', addr(d.owner, 'A Tangem hardware wallet. It can pause new sales, set package prices, and change the keeper and the prize wallet. It cannot move anyone\'s money or change the split.')], + ['Prize wallet', addr(d.prizeWallet, 'Receives the 10% prize share of each purchase and pays the weekly leaderboard winners.')], + ['Company', addr(d.company, 'Viral Banner Blitz. Fixed in the contract when it was deployed.')], + ['Keeper', addr(d.keeper, 'The site\'s signing key. It only signs which sponsor a buyer has, once, on their first purchase.')], + ['Sales', d.live ? (d.paused ? 'Paused' : 'Open') + ' · ' + VBB.n(d.orderCount) + ' purchases so far' : '' + esc(d.error || 'not read yet') + ''], + ['Held by the contract', d.live ? pol(d.balanceWei) + (BigInt(d.totalOwedWei || 0) > 0n ? ' (all of it owed to wallets whose payment bounced, waiting for them to claim)' : ' (nothing is kept: every purchase is paid out in the same transaction)') : 'not read yet'] + ]; + el.innerHTML = '' + rows.map(r => '' + r[0] + '' + r[1] + '').join('') + ''; +})(); diff --git a/public/assets/ledger.js b/public/assets/ledger.js new file mode 100644 index 0000000..f4ca2b0 --- /dev/null +++ b/public/assets/ledger.js @@ -0,0 +1,31 @@ +// Live ledger (trust pack 2026-11-14): purchases with their split and weekly prize payouts from /api/ledger, refreshed every 30 s. +(function () { + VBB.renderNav('/ledger'); VBB.renderFooter(); + const esc = VBB.esc; + const pol = w => { try { const v = BigInt(w || 0); const n = Number(v / 10n ** 12n) / 1e6; return (n >= 100 ? n.toFixed(2) : n.toFixed(4)) + ' POL'; } catch (e) { return '0 POL'; } }; + const usd = c => '$' + (Number(c || 0) / 100).toFixed(2); + const when = t => t ? new Date(t).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) + ' CT' : ''; + const who = (a, n) => n ? '@' + esc(n) : '' + esc(VBB.short(a || '')) + ''; + const ROLE = { sponsor: 'Sponsor 30%', prize: 'Prize pot 10%', company: 'Viral Banner Blitz' }; + async function load() { + let d; try { d = await VBB.getJSON('/api/ledger?n=100'); } catch (e) { return; } if (!d || !d.items) return; + const ex = d.explorer || 'https://polygonscan.com'; const t = d.totals || {}; + document.getElementById('totals').innerHTML = '
' + VBB.n(t.purchases) + 'purchases on-chain
' + + '
' + pol(t.sponsorWei) + 'paid to sponsors, same transaction
' + + '
' + VBB.n(t.prizePayouts) + 'weekly prize payouts
' + + '
0withdrawals needed: every purchase pays out in the same transaction
'; + const body = document.querySelector('#rows tbody'); + if (!d.items.length) { body.innerHTML = 'No purchases yet. The first one will show here within a minute of its transaction.'; return; } + body.innerHTML = d.items.map(r => { + const link = 'Polygonscan'; + if (r.kind === 'prize') { + const place = ['1st', '2nd', '3rd'][r.place - 1] || '#' + r.place; + return '' + when(r.at) + 'Prize
' + esc(r.name) + ', ' + place + ' place, ' + (r.board === 'sources' ? 'most traffic sources' : 'most verified visitors') + ' (week of ' + esc(r.week) + ')' + + '' + esc(r.pol) + ' POL ($' + Number(r.usd).toFixed(2) + ') from the prize wallet' + (r.confirmed ? '' : ' (confirming)') + '' + link + ''; + } + const pays = (r.pays || []).map(p => esc(ROLE[p.role] || p.role) + ': ' + pol(p.wei) + (p.role === 'sponsor' ? ' to ' + who(p.to, p.name) : '') + (p.failed ? ' (bounced, waiting in the contract for them to claim)' : '')).join('
'); + return '' + when(r.at) + 'Purchase
' + who(r.buyer, r.buyerName) + ' bought ' + esc(r.what) + ' for ' + usd(r.usdCents) + '' + pays + '' + link + ''; + }).join(''); + } + load(); setInterval(load, 30000); +})(); diff --git a/public/assets/vbb.css b/public/assets/vbb.css index 69d9536..f135291 100644 --- a/public/assets/vbb.css +++ b/public/assets/vbb.css @@ -178,3 +178,10 @@ footer.foot a{color:var(--amber)} footer.foot p{margin:6px 0} .fill-note{margin-top:6px} .ls-box{margin-top:16px;padding-top:12px;border-top:1.5px dashed var(--muted)} .pill.spin{background:var(--sky-soft);color:var(--ink)} +/* trust pack (2026-11-14): footer legal + network line, proof toasts, legal pages */ +footer.foot .legal-links{margin-top:14px} footer.foot .co{opacity:.8;font-size:12.5px} +footer.foot .netline{margin-top:12px;padding-top:12px;border-top:1px dashed rgba(217,212,234,.3);font-size:13px;line-height:1.9} +footer.foot .netline b{color:#fff} footer.foot .netline .here{color:#fff;font-weight:700;background:var(--hot);border:1.5px solid #fff;border-radius:999px;padding:1px 8px} +.toast.buy{background:var(--amber-soft)} .toast.prize{background:var(--ok-soft)} +.legal .card h2{font-size:21px} .legal .card p,.legal .card li{max-width:760px} .legal .card ul{padding-left:20px} .legal .card li{margin:6px 0} +#facts th{font:700 11.5px var(--mono);letter-spacing:.06em;text-transform:uppercase;vertical-align:top} diff --git a/public/contract.html b/public/contract.html new file mode 100644 index 0000000..31bc132 --- /dev/null +++ b/public/contract.html @@ -0,0 +1,56 @@ + + + + +Contract Proof | Viral Banner Blitz + + + + + + + + + + + + + + + + + + + + + + +
+
Read live from Polygon

Contract proof

Every Viral Banner Blitz purchase is paid to one smart contract on Polygon. It splits the payment in the same transaction. Check every number here yourself.

+
+

The contract

+
Reading the contract...
+
+
+

Where each purchase goes, in the same transaction

+
+
30%to the network member who introduced the buyer (no sponsor: to Viral Banner Blitz)
+
10%to the prize wallet, which pays the weekly leaderboard prizes
+
60%to Viral Banner Blitz
+
+

The percentages are constants in the contract code: nobody can change who gets what share. There is no owner withdraw. The contract keeps nothing: if a payment cannot be delivered, it waits in the contract for that wallet to claim, and nobody else can take it. Anything sent above the price comes back in the same transaction.

+
+
+

Check it yourself

+
    +
  1. Open the contract on Polygonscan (link above). Its source code is verified on Sourcify (exact match); Polygonscan's own verification check is pending, so use the Sourcify link to read the source.
  2. +
  3. On Polygonscan, choose Read Contract and compare owner, prize wallet, company and keeper with this page.
  4. +
  5. Open any purchase in the live ledger and look at its Logs: one Purchase event, then one Paid event per payment.
  6. +
+
+ +
+ + + + diff --git a/public/disclaimer.html b/public/disclaimer.html new file mode 100644 index 0000000..b346e07 --- /dev/null +++ b/public/disclaimer.html @@ -0,0 +1,40 @@ + + + + +Earnings Disclaimer | Viral Banner Blitz + + + + + + + + + + + + + + + + + + + + + + +
+

Earnings Disclaimer

Please read this before you buy anything.

Last updated November 14, 2026

+

Advertising, not an investment

Viral Banner Blitz sells advertising. It is not an investment, a security, a savings plan or an income opportunity, and nothing you buy here is a promise of money back.

+

No earnings promised

The sponsor share is paid only when someone you introduced chooses to buy a package. If nobody does, you receive nothing from it.

Weekly prizes go only to the top three on each leaderboard. Your rank depends on what every other member does that week, and most members will not win a prize in a given week. A prize is a promotion, not a return on anything you bought.

Network ad views earned when a banner cycles are advertising, not cash, and have no cash value.

We do not promise, project or guarantee any earnings. Any numbers in examples, posts, banners or videos are illustrations or one member's results, not what you should expect.

+

How any payment happens

Any payment to you happens only on the blockchain, when a later purchase happens, and is paid by the smart contract in that same transaction. Nothing is held for you and there is nothing to withdraw. If no later purchase happens, no payment happens.

+

Crypto risk

+

Your decision

Only spend what you can afford to lose completely. This is not financial, legal or tax advice. You are responsible for any taxes on what you receive.

+

Contact

Questions, problems or a request about your data: network support, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.

+
+ + + + diff --git a/public/how.html b/public/how.html index 1d0ba2c..f922c01 100644 --- a/public/how.html +++ b/public/how.html @@ -22,7 +22,7 @@ - +
@@ -55,7 +55,7 @@
- + diff --git a/public/index.html b/public/index.html index 0868fe0..3003809 100644 --- a/public/index.html +++ b/public/index.html @@ -23,7 +23,7 @@ - +
@@ -56,7 +56,7 @@
- + diff --git a/public/leaders.html b/public/leaders.html index 263c4ef..76896da 100644 --- a/public/leaders.html +++ b/public/leaders.html @@ -22,7 +22,7 @@ - +
@@ -33,7 +33,7 @@
- + diff --git a/public/ledger.html b/public/ledger.html new file mode 100644 index 0000000..4d54938 --- /dev/null +++ b/public/ledger.html @@ -0,0 +1,41 @@ + + + + +Live Ledger | Viral Banner Blitz + + + + + + + + + + + + + + + + + + + + + + +
+
Live from Polygon

The live ledger

Every purchase and every weekly prize payout, with the transaction to check it. Purchases are split by the contract in the same transaction they are paid.

+
+
+

Purchases and prize payouts

+
WhenWhat happenedPaid in the same transactionVerify
Loading...
+

Purchases buy advertising: post credits and the banner look. They are not an investment and nothing is promised. Prize payouts go from the prize wallet to the weekly leaderboard winners. How to check the contract.

+
+ +
+ + + + diff --git a/public/my.html b/public/my.html index 88579ea..5bf31ce 100644 --- a/public/my.html +++ b/public/my.html @@ -22,7 +22,7 @@ - +
@@ -78,7 +78,7 @@
- + diff --git a/public/packages.html b/public/packages.html index 05100d3..85f6304 100644 --- a/public/packages.html +++ b/public/packages.html @@ -22,7 +22,7 @@ - +
@@ -43,7 +43,7 @@

Every network member (InstantAdPay or LinkSpin) also gets one free post credit each day they sign in.

Use my free credit
- + diff --git a/public/privacy.html b/public/privacy.html new file mode 100644 index 0000000..c82a9c2 --- /dev/null +++ b/public/privacy.html @@ -0,0 +1,41 @@ + + + + +Privacy Policy | Viral Banner Blitz + + + + + + + + + + + + + + + + + + + + + + +
+

Privacy Policy

What we collect, why, and who sees it.

Last updated November 14, 2026

+

Who we are

Viral Banner Blitz is run by TrustClickz, 615 Green Valley Drive, Moody, AL 35004. This policy says what we collect, why, and who sees it.

+

What we collect

+

One account across the network

The Crypto Team Build Network shares one account across its sites through the network hub. The hub keeps your email address, username, wallet and sponsor, and each network site (InstantAdPay, LinkSpin, Downline Banners, Viral Banner Blitz, Stack POL, Earners Corner) asks it who you are, so you have one identity and one sponsor everywhere. Sites only see what they need.

+

What is public

Purchases and payments on the blockchain are public and permanent: anyone can see the wallet addresses and amounts, and nobody can delete them. Our live ledger, leaderboards and toasts show your network username or a shortened wallet. When a package is bought or a weekly prize is paid, a message with the username (or a shortened wallet), the amounts and the transaction link is posted to the network's Telegram payments topic.

+

Who else sees it

We do not sell your data. We use service providers to run the site (hosting, databases, blockchain connections, and Telegram for the payment messages), and we share data if the law requires it.

+

Your choices

You can ask us to delete your account data on this site or on the network hub. Records on the blockchain cannot be deleted by anyone. You can clear the cookies in your browser at any time; you will need to sign in again.

+

Contact

Questions, problems or a request about your data: network support, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.

+
+ + + + diff --git a/public/promote.html b/public/promote.html index 35f86ad..50b832f 100644 --- a/public/promote.html +++ b/public/promote.html @@ -22,7 +22,7 @@ - + @@ -34,7 +34,7 @@

Loading the kit...

- + diff --git a/public/terms.html b/public/terms.html new file mode 100644 index 0000000..30372e2 --- /dev/null +++ b/public/terms.html @@ -0,0 +1,46 @@ + + + + +Terms and Conditions | Viral Banner Blitz + + + + + + + + + + + + + + + + + + + + + + +
+

Terms and Conditions

The rules for using Viral Banner Blitz, in plain English.

Last updated November 14, 2026

+

Who we are

Viral Banner Blitz (viralbannerblitz.com) is run by TrustClickz, 615 Green Valley Drive, Moody, AL 35004. It is part of the Crypto Team Build Network: one network account works across InstantAdPay, LinkSpin, Downline Banners, Viral Banner Blitz, Stack POL and Earners Corner. By using Viral Banner Blitz you agree to these terms.

+

What Viral Banner Blitz is

Viral Banner Blitz is a community loop of 125x125 banners. Verified visitors move the loop, and a banner that rides out of the loop earns network ad views.

+

What you buy

Network members (InstantAdPay or LinkSpin) get one free post credit each day they sign in. You can also buy post credit packs and the banner look (a bright border and a teaser line). Prices are on the Packages page.

Purchases are paid in POL on Polygon at the live Chainlink POL/USD price the contract reads when you buy. Anything you send above the price comes back to you in the same transaction.

What you buy is advertising for your own banners. It is not income, an investment or a share of anything.

Every package is a single, one-time purchase. Nothing renews and nothing is ever billed again. There are no subscriptions.

+

How a payment is split

The Viral Banner Blitz shop contract splits each purchase in the same transaction it is paid: 30% to the network member who introduced the buyer (no sponsor: Viral Banner Blitz), 10% to the prize wallet for the weekly leaderboard prizes, and 60% to Viral Banner Blitz.

The split is fixed in the contract code and there is no owner withdraw. The contract keeps nothing: a sponsor payment goes straight to the sponsor's wallet in the buyer's transaction, and there is nothing to withdraw. If a payment cannot be delivered, it waits in the contract for that wallet to claim, and nobody else can take it.

The 10% prize share is held in the prize wallet until the weekly prizes are paid. Each week the top three on each leaderboard are paid in POL from the prize wallet the following Monday, after an administrator approves the payout. A place nobody qualifies for is not paid and its share stays in the prize wallet for later weeks.

Your sponsor is set on your first purchase from the network sponsor the network hub knows for your wallet, through a voucher the site signs. Once set on the contract, it never changes.

+

Nothing is promised

We do not promise or guarantee any income, payout, prize or result. Read the Earnings Disclaimer.

+

No refunds

Payments are made on the blockchain and are final once confirmed. We cannot reverse, cancel or refund them. Check the amount and what you are buying before you confirm in your wallet.

+

Crypto risk

+

Fair use

A verified visitor is a real browser that keeps the loop page open and visible for a few seconds. Each visitor counts once every 24 hours, only a few visitors per internet connection count each day, and bots, crawlers and repeat visits do not count. We may refuse visits we judge not to be real, and may disqualify anyone who fakes traffic from the leaderboards and prizes.

Your banner must be your own or one you have the right to use, and its link must lead to a lawful page that can be shown in the loop. No adult content, malware, phishing, deceptive offers, hate, or anything illegal where you or your visitors live. We may remove a banner and close an account that breaks these rules; credits already used are not returned.

Do not try to break, overload or game the site, and do not use more than one account to get extra free credits, views or prizes.

+

Your account

You sign in with your wallet or through InstantAdPay or LinkSpin. Your network account, username and sponsor are shared across the network through the network hub, as described in the Privacy Policy. You must be old enough to make a binding agreement where you live, and using crypto must be legal there.

+

The service

The site is provided as it is. We work to keep it running but cannot promise it will always be available or free of errors. The smart contract runs on Polygon on its own; its rules are public and can be checked on the contract page. We may change features, prices of future purchases or these terms; changes apply from the date they are posted here.

+

Limits

As far as the law allows, we are not responsible for losses caused by the blockchain, your wallet, the price of POL, third-party websites in banners, or events outside our control, and our total responsibility to you is limited to what you paid for the purchase in question. These terms are governed by the laws of the State of Alabama, USA.

+

Contact

Questions, problems or a request about your data: network support, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.

+
+ + + + diff --git a/qa/chain.mjs b/qa/chain.mjs index 84a9d14..bf91e12 100644 --- a/qa/chain.mjs +++ b/qa/chain.mjs @@ -5,6 +5,8 @@ // prizes: last week's leaderboards (seeded visits) -> prepare -> refuse while the prize wallet is short (says how much) -> // fund it -> approve and pay -> exact POL per winner at the feed price, ties to the earlier, the prize wallet itself // skipped -> a second approval refused -> /api/prizes lists the winners with their transactions. +// trust pack (2026-11-14): /api/ledger (each purchase with its real split from the receipt, prize payouts), /api/contract (live +// facts), the pages, and a stand-in Telegram API: one photo card per purchase, one line per prize payout, never twice. // node qa/chain.mjs (needs anvil: ~/.foundry/bin/anvil(.exe), and forge build output in ../contracts/out) import { spawn } from 'node:child_process'; import fs from 'node:fs'; @@ -38,6 +40,11 @@ function ctWeek(ts) { const p = Object.fromEntries(fmt.formatToParts(new Date(ts const THIS_WEEK = ctWeek(Date.now()); const LAST_WEEK = new Date(Date.parse(THIS_WEEK + 'T12:00:00Z') - 7 * 86400000).toISOString().slice(0, 10); const LW_AT = Date.parse(LAST_WEEK + 'T18:00:00Z'); // Monday noon CT of last week +// ---- stand-in Telegram Bot API (never the real group): records every call ---- +const TPORT = PORT + 2; const tgCalls = []; +require('node:http').createServer(async (q, r) => { let b = ''; for await (const c of q) b += c; let j = {}; try { j = JSON.parse(b || '{}'); } catch (e) {} + tgCalls.push({ method: q.url.split('/').pop(), token: q.url.split('/')[1], body: j }); r.setHeader('Content-Type', 'application/json'); r.end(JSON.stringify({ ok: true, result: { message_id: tgCalls.length } })); }).listen(TPORT, '127.0.0.1').unref(); + // ---- stand-in hub: M's network sponsor is S ---- const people = new Map(); // wallet -> { id, username, sponsorWallet } const HUB_SECRET = 'c'.repeat(40); @@ -83,7 +90,8 @@ async function main() { const env = Object.assign({}, process.env, { PORT: String(PORT), DATA_DIR: DATA, ADMIN_TOKEN: ADMIN, NODE_ENV: 'development', DOCSTORE_URL: '', LINK_PROBE: '0', NETWORK_LOOKUP_URL: '', CHAIN_ID: '31337', CONTRACT_ADDRESS: SHOP, CHAIN_RPC: RPC, KEEPER_KEY: K[1], SHOP_START_BLOCK: '1', SHOP_CONFIRMATIONS: '0', SHOP_POLL_MS: '300', PRIZE_KEY: P.privateKey, PRIZE_WALLET: P.address, PRIZE_RECEIPT_MS: '300', EXPLORER: 'https://explorer.invalid', - HUB_URL: 'http://127.0.0.1:' + HPORT, HUB_SECRET, HUB_SITE: 'vbb', HUB_ENABLED: '0' }); + HUB_URL: 'http://127.0.0.1:' + HPORT, HUB_SECRET, HUB_SITE: 'vbb', HUB_ENABLED: '0', + TG_TOKEN: 'standin-token', TG_CHAT: '-100123', TG_PAY_TOPIC: '632242', TG_API: 'http://127.0.0.1:' + TPORT }); const log = fs.openSync(path.join(OUT, 'chain-server.log'), 'w'); const srv = spawn(process.execPath, ['server.js'], { cwd: APP, env, stdio: ['ignore', log, log] }); procs.push(srv); for (let i = 0; i < 80; i++) { try { if ((await fetch(BASE + '/health')).ok) break; } catch (e) {} await sleep(150); } @@ -127,6 +135,38 @@ async function main() { ok(look, 'the watcher gives that banner the look'); const spl = await call('/api/splash'); ok([...spl.loop, ...spl.queue].some(t => t.id === bid && t.look && t.teaser === 'example-member.com'), 'the loop shows it with the border + teaser'); + console.log('1b. trust pack: ledger, contract, pages, Telegram cards'); + const share = w => ({ sp: w * 3000n / 10000n, pz: w * 1000n / 10000n, co: w - w * 3000n / 10000n - w * 1000n / 10000n }); + let led; for (let i = 0; i < 40; i++) { led = await call('/api/ledger?n=50'); const x = (led.items || []).find(y => y.tx === tx.hash.toLowerCase()); if (x && x.pays && x.pays.length === 3 && x.pays[0].role === 'sponsor') break; await sleep(200); } + const it1 = (led.items || []).find(x => x.tx === tx.hash.toLowerCase()); const sh = share(wei); + ok(it1 && it1.kind === 'purchase' && it1.what === '10 post credits' && it1.usdCents === 300, 'ledger lists the pack purchase', it1); + const pz = it1 && Object.fromEntries(it1.pays.map(x => [x.role, x])); + ok(pz && pz.sponsor && pz.sponsor.to === S && BigInt(pz.sponsor.wei) === sh.sp && BigInt(pz.prize.wei) === sh.pz && BigInt(pz.company.wei) === sh.co && pz.prize.to === P.address.toLowerCase(), + 'ledger split from the receipt: 30% to the sponsor, 10% prize wallet, 60% company (exact wei)', it1 && it1.pays); + ok(led.totals && led.totals.purchases === 3 && BigInt(led.totals.sponsorWei) === BigInt(led.totals.weiPaid) * 3000n / 10000n, 'ledger totals: 3 purchases (seeded + 2), sponsor POL = 30% of both sponsored purchases', led.totals); + ok((led.items || []).some(x => x.kind === 'purchase' && x.what === 'the banner look'), 'ledger names the banner look purchase', led.items && led.items.map(x => x.what)); + const cf = await call('/api/contract'); + ok(cf.live === true && cf.owner === deployer.address.toLowerCase() && cf.prizeWallet === P.address.toLowerCase() && cf.company === company.toLowerCase() && cf.keeper === keeper.address.toLowerCase() + && cf.paused === false && cf.orderCount === 2 && cf.balanceWei === '0' && cf.split.sponsorPct === 30 && cf.split.prizePct === 10 && cf.split.companyPct === 60 && cf.verified.sourcify === true, + '/api/contract reads the live facts (owner, prize wallet, company, keeper, 2 orders, holds 0)', cf); + for (const pg of ['/contract', '/ledger', '/terms', '/disclaimer', '/privacy']) { const r2 = await fetch(BASE + pg); const h = await r2.text(); + ok(r2.status === 200 && h.includes('common.js?v=5') && !h.includes('—'), pg + ' serves (no em dashes)'); } + const legal = (await (await fetch(BASE + '/terms')).text()) + (await (await fetch(BASE + '/disclaimer')).text()) + (await (await fetch(BASE + '/privacy')).text()); + ok(legal.includes('TrustClickz, 615 Green Valley Drive, Moody, AL 35004') && /ever billed again/.test(legal) && /final once confirmed/.test(legal) && /not an investment/.test(legal) && /network hub/.test(legal) && !/\$50|cap/i.test(legal.replace(/capture|capital|escape/gi, '')), + 'legal pages: TrustClickz, one-time purchases, no refunds on-chain, not an investment, the hub, no prize cap'); + const ns = await call('/api/network-sites'); const nl = Object.keys(ns).filter(k => /^\d+$/.test(k)).map(k => ns[k]); + ok(nl.length === 6 && nl.map(x => x.name).join(',') === 'InstantAdPay,LinkSpin,Downline Banners,Viral Banner Blitz,Stack POL,Earners Corner', '/api/network-sites: the six network sites (fallback list when the hub has none)', nl.map(x => x.name)); + let photos = []; for (let i = 0; i < 40; i++) { photos = tgCalls.filter(c => c.method === 'sendPhoto'); if (photos.length >= 2) break; await sleep(200); } + const c1 = photos.find(c => String(c.body.caption).includes(tx.hash.toLowerCase())); + ok(photos.length === 2 && photos.every(c => c.token === 'botstandin-token' && c.body.chat_id === '-100123' && c.body.message_thread_id === 632242 && c.body.parse_mode === 'HTML' && /\/art\/proof\/vbb-proof-(pink|blue|yellow)\.png$/.test(c.body.photo)), + 'one Telegram photo card per purchase (2), to the payments topic, with a proof image', photos.map(c => [c.token, c.body.chat_id, c.body.message_thread_id, c.body.photo])); + ok(photos.length === 2 && photos[0].body.photo !== photos[1].body.photo, 'the card image rotates between posts'); + ok(c1 && /@buyerm bought 10 post credits · \$3\.00 \(12\.0000 POL\)/.test(c1.body.caption) && c1.body.caption.includes('Sponsor 30%: 3.6000 POL → @sponsors') && c1.body.caption.includes('Weekly prize pot 10%: 1.2000 POL') + && c1.body.caption.includes('Viral Banner Blitz: 7.2000 POL') && /This week: \d+ purchases?, \$[\d.]+ · prize pot \$[\d.]+/.test(c1.body.caption) && c1.body.caption.includes('https://explorer.invalid/tx/' + tx.hash.toLowerCase()) && !c1.body.caption.includes('—'), + 'card caption: buyer, sponsor + prize + company split in POL, this week\'s stats, verify link', c1 && c1.body.caption); + await call('/api/my/paid', {}); await sleep(1500); // more watcher scans + ok(tgCalls.filter(c => c.method === 'sendPhoto').length === 2, 'rescans never post the same purchase twice'); + console.log('2. weekly prize payout (last week: ' + LAST_WEEK + ')'); let ap, plan; for (let i = 0; i < 40; i++) { ap = await adm('/api/admin/prizes'); plan = (ap.weeks || []).find(w => w.week === LAST_WEEK); if (plan) break; await sleep(250); } ok(plan && plan.status === 'prepared', 'the app prepared last week by itself', ap.weeks && ap.weeks.map(w => w.week + ':' + w.status)); @@ -152,7 +192,13 @@ async function main() { let r = await adm('/api/admin/prizes/prepare', { week: LAST_WEEK }); ok(r.status === 'paid', 'preparing a paid week again changes nothing', r.status); const pub = await call('/api/prizes'); const lw = (pub.past || [])[0]; ok(lw && lw.week === LAST_WEEK && lw.winners.length === 6 && lw.winners.every(x => x.tx && x.confirmed && x.pol) && pub.explorer === 'https://explorer.invalid' && !JSON.stringify(pub).includes(P.privateKey.slice(2, 12)), 'public /api/prizes lists the winners with their transactions (never the key)', lw); + let lines = []; for (let i = 0; i < 40; i++) { lines = tgCalls.filter(c => c.method === 'sendMessage' && /weekly prize/.test(c.body.text)); if (lines.length >= 6) break; await sleep(200); } + ok(lines.length === 6 && lines.every(c => c.body.message_thread_id === 632242 && /POL \(\$\d+\.\d\d\)/.test(c.body.text) && /explorer\.invalid\/tx\/0x[0-9a-f]{64}/.test(c.body.text)) + && new Set(lines.map(c => c.body.text.match(/tx\/(0x[0-9a-f]{64})/)[1])).size === 6, 'one Telegram line per confirmed prize payout (6), each with its own transaction', lines.map(c => c.body.text.split('\n')[1])); + ok(lines.some(c => c.body.text.includes('@winner1 · 1st place, most verified visitors') && c.body.text.includes('20.0000 POL ($5.00)')), 'prize line names the winner, place, board and amount', lines.map(c => c.body.text.split('\n')[1])); + const led2 = await call('/api/ledger?n=50'); ok((led2.items || []).filter(x => x.kind === 'prize' && x.confirmed).length === 6 && led2.totals.prizePayouts === 6, 'the ledger lists the 6 prize payouts with their transactions', led2.totals); const st = await adm('/api/admin/status'); ok(!JSON.stringify(st).includes(P.privateKey.slice(2, 12)) && st.prize && st.prize.keyAddress === P.address.toLowerCase(), 'admin status shows the prize wallet, never its key'); + ok(st.proof && st.proof.telegram === true && st.proof.posted === 2 && st.proof.prizeLines === 6 && !JSON.stringify(st).includes('standin-token'), 'admin status shows the proof posts, never the bot token', st.proof); srv.kill(); an.kill(); console.log('\n' + pass + ' passed, ' + fail + ' failed'); diff --git a/qa/smoke.mjs b/qa/smoke.mjs index 5167313..86a3bac 100644 --- a/qa/smoke.mjs +++ b/qa/smoke.mjs @@ -519,6 +519,21 @@ async function main() { ok((await pg.textContent('#kit')).includes('?ref=smokeleader') && (await pg.inputValue('#whoIn')) === 'smokeleader', name + ': Promote page shows the kit with the member links'); ok(!!(await pg.$('nav a[href="/promote"]')), name + ': nav links to Promote'); await pg.waitForTimeout(600); await pg.screenshot({ path: path.join(OUT, 'promote-' + name + '.png'), fullPage: true }); + // trust pack (2026-11-14): footer legal + proof links, company line, network line; ledger + contract + legal pages render + await pg.goto(BASE + '/how', { waitUntil: 'domcontentloaded' }); await pg.waitForFunction(() => /Earners Corner/.test((document.querySelector('footer .netline') || {}).textContent || ''), null, { timeout: 6000 }).catch(() => {}); + const ft = await pg.textContent('footer.foot'); const hrefs = await pg.$$eval('footer.foot a', as => as.map(a => a.getAttribute('href'))); + ok(['/terms', '/disclaimer', '/privacy', '/contract', '/ledger'].every(h => hrefs.includes(h)) && /Support/.test(ft) && /TrustClickz · 615 Green Valley Drive, Moody, AL 35004/.test(ft) + && /Part of the network · One account across the network: InstantAdPay · LinkSpin · Downline Banners · Viral Banner Blitz · Stack POL · Earners Corner/.test(ft.replace(/\s+/g, ' ')) && !/RM Circle|rmcircle/i.test(ft) + && (await pg.textContent('footer .netline .here')) === 'Viral Banner Blitz', name + ': footer: legal + proof links, company line, network line with VBB as current, never RM Circle', ft.slice(-400)); + const sw = await pg.evaluate(() => document.documentElement.scrollWidth); ok(sw <= pg.viewportSize().width, name + ': footer fits the screen (no sideways scroll)', sw); + await pg.locator('footer.foot').screenshot({ path: path.join(OUT, 'footer-' + name + '.png') }); + for (const lp of ['/terms', '/disclaimer', '/privacy']) { await pg.goto(BASE + lp, { waitUntil: 'domcontentloaded' }); ok((await pg.textContent('main')).includes('TrustClickz') && !!(await pg.$('footer.foot')), name + ': ' + lp + ' renders with the footer'); } + await pg.goto(BASE + '/ledger', { waitUntil: 'domcontentloaded' }); await pg.waitForFunction(() => !/Loading/.test(document.querySelector('#rows tbody').textContent), null, { timeout: 8000 }).catch(() => {}); + ok(!!(await pg.$('#totals .stat')) && !/Loading/.test(await pg.textContent('#rows')), name + ': /ledger renders its totals and rows', (await pg.textContent('#rows')).slice(0, 200)); + await pg.screenshot({ path: path.join(OUT, 'ledger-' + name + '.png'), fullPage: true }); + await pg.goto(BASE + '/contract', { waitUntil: 'domcontentloaded' }); await pg.waitForFunction(() => !/Reading the contract/.test(document.getElementById('facts').textContent), null, { timeout: 8000 }).catch(() => {}); + ok(!/Reading the contract/.test(await pg.textContent('#facts')) && /30%/.test(await pg.textContent('main')), name + ': /contract renders', (await pg.textContent('#facts')).slice(0, 200)); + await pg.screenshot({ path: path.join(OUT, 'contract-' + name + '.png'), fullPage: true }); await pg.goto(BASE + '/', { waitUntil: 'domcontentloaded' }); await pg.waitForTimeout(300); ok(!(await pg.$('script[src*="linkspin.app/z.js"]')), name + ': no network zone on the loop page'); await ctx.close(); diff --git a/server.js b/server.js index 9ae2de5..2b2f13c 100644 --- a/server.js +++ b/server.js @@ -23,6 +23,8 @@ const shop = require('./shop'); const promokit = require('./promokit'); // promo kit feed /api/promo-kit + the /promote page (2026-11-14) const hubreport = require('./hubreport'); // network hub report by wallet (off unless HUB_ENABLED) const prize = require('./prize'); +const proof = require('./proof'); // trust pack: /ledger, /contract, Telegram card per purchase + line per prize payout (2026-11-14) +const netsites = require('./netsites'); // footer network list from the hub (2026-11-14) const lsspins = require('./lsspins'); // LinkSpin Banner Spins: post one as a banner, and fill the splash's open places (2026-11-14) const PUB = path.join(__dirname, 'public'); @@ -215,7 +217,8 @@ function oldLink(u) { // network ad zone on the 404 page (LinkSpin zone on Marty's account, 300x250; the page zones live in public/assets/common.js ZONES). '' = none const ZONE_404 = ''; -const PAGES = { '/': 'index.html', '/my': 'my.html', '/leaders': 'leaders.html', '/how': 'how.html', '/packages': 'packages.html', '/admin': 'admin.html' }; +const PAGES = { '/': 'index.html', '/my': 'my.html', '/leaders': 'leaders.html', '/how': 'how.html', '/packages': 'packages.html', '/admin': 'admin.html', + '/contract': 'contract.html', '/ledger': 'ledger.html', '/terms': 'terms.html', '/disclaimer': 'disclaimer.html', '/privacy': 'privacy.html' }; // trust pack 2026-11-14 const challenges = new Map(); const clickSeen = new Map(); @@ -240,7 +243,7 @@ const server = http.createServer(async (req, res) => { if (/^\/r\/[^/]+$/.test(p)) { res.writeHead(302, { Location: '/?ref=' + encodeURIComponent(decodeURIComponent(p.slice(3))) }); return res.end(); } if (p === '/sitemap.xml') { const day = new Date().toISOString().slice(0, 10); - const urls = ['/', '/leaders', '/how', '/packages', '/promote'].map(x => 'https://' + C.site + x + '' + day + '').join(''); + const urls = ['/', '/leaders', '/how', '/packages', '/promote', '/contract', '/ledger', '/terms', '/disclaimer', '/privacy'].map(x => 'https://' + C.site + x + '' + day + '').join(''); res.writeHead(200, headers({ 'Content-Type': 'application/xml; charset=utf-8', 'Cache-Control': 'public, max-age=3600' })); return res.end('' + urls + ''); } @@ -288,6 +291,10 @@ const server = http.createServer(async (req, res) => { try { return json(res, 200, await shop.receipt(p.slice(8))); } catch (e) { return json(res, 200, { found: false }); } } // past weeks' prize winners with their transactions (paid weeks only) + // trust pack (2026-11-14): the public ledger (purchases with their split, prize payouts), the live contract facts, the network list + if (p === '/api/ledger' && req.method === 'GET') return json(res, 200, proof.ledger(u.searchParams.get('n')), { 'Cache-Control': 'public, max-age=10' }); + if (p === '/api/contract' && req.method === 'GET') { if (limited(req, 'contract', 600, 3600000)) return json(res, 429, { error: 'Too many requests' }); return json(res, 200, await proof.contract(), { 'Cache-Control': 'public, max-age=60' }); } + if (p === '/api/network-sites' && req.method === 'GET') return netsites.handle(req, res); if (p === '/api/prizes' && req.method === 'GET') return json(res, 200, { current: prizes(), week: store.ctWeek(), past: prize.history(12), explorer: C.explorer }, { 'Cache-Control': 'public, max-age=30' }); if (p === '/api/splash' && req.method === 'GET') { const v = loop.view(24); v.fill = splashFill(); return json(res, 200, v, { 'Cache-Control': 'no-store' }); } if (p === '/api/leaders' && req.method === 'GET') { @@ -466,7 +473,7 @@ const server = http.createServer(async (req, res) => { queue: { length: S.queue.length, next: S.queue.slice(0, 20) }, progress: S.progress, held: S.progress >= C.perShift && !S.queue.length, today: { visits: t.visits || 0, shifts: t.shifts || 0, cycles: t.cycles || 0, posts: t.posts || 0, clicks: t.clicks || 0 }, totals: S.totals, ledger: { entries: L.length, views: L.reduce((x, e) => x + e.views, 0), viewsByStatus: byStatus, credited: 0 }, - members: store.members().length, banners: S.banners.length, visitsKept: store.visits().length, shop: shop.view(), prize: prize.view(), hub: hubreport.view(), hubLookup: hubpeople.view(), lsSpins: lsspins.view(), docstore: docstore.view(), oldrefs: Object.keys(oldRefMap()).length }); + members: store.members().length, banners: S.banners.length, visitsKept: store.visits().length, shop: shop.view(), prize: prize.view(), proof: proof.view(), hub: hubreport.view(), hubLookup: hubpeople.view(), lsSpins: lsspins.view(), docstore: docstore.view(), oldrefs: Object.keys(oldRefMap()).length }); } // old username -> network username map for the old-link redirects: { oldrefs: { old: network } } replaces the whole map if (p === '/api/admin/oldrefs' && req.method === 'POST') { @@ -540,6 +547,8 @@ function saveUpload(owner, buf, ext) { loop.init({ onCycle: (b, e) => console.log('cycle', 'banner #' + b.id, e.views + ' network views recorded') }); store.pruneVisits(); loop.rebuildIndex(); hubreport.init({ dataDir: C.dataDir, purchases: () => Object.entries((store.state() || {}).purchases || {}).map(([key, x]) => Object.assign({ key }, x)) }); + proof.init(C, { shop, prize, nameOf: async a => { const m = await netMember({ a }).catch(() => null); return m && m.address === a ? m.username : null; } }); + shop.setHook(proof.onPurchase); prize.setHook(proof.onPrize); // before the watcher's first scan shop.init(C); // inert without CONTRACT_ADDRESS + CHAIN_RPC (watcher) / KEEPER_KEY (vouchers) prize.init(C); // prepares last week's payout plan; pays only on an admin's approval (PRIZE_KEY) // fill spins: members seen in the last 60 days (most recent 400), one LinkSpin call each every 10 minutes diff --git a/shop.js b/shop.js index 18dfe18..6d13e6c 100644 --- a/shop.js +++ b/shop.js @@ -20,6 +20,8 @@ const CALLS = new Interface(['function quoteWei(uint256 sku, uint256 qty) view r const TYPES = { Voucher: [{ name: 'buyer', type: 'address' }, { name: 'sponsor', type: 'address' }, { name: 'deadline', type: 'uint256' }] }; const st = { polls: 0, credited: 0, dupes: 0, ignored: 0, errors: 0, lastError: null, head: null }; let C = null, keeper = null, busy = false, timer = null; +const hooks = { onPurchase: null }; // proof.js: ledger split + Telegram card per newly credited purchase (2026-11-14) +function setHook(fn) { hooks.onPurchase = typeof fn === 'function' ? fn : null; } function init(cfg) { C = cfg; keeper = null; @@ -53,6 +55,7 @@ function apply(ev) { P[key] = { at: Date.now(), blockAt: ev.blockAt || null, block: ev.block, orderId: ev.orderId, buyer: a, sku: ev.sku, qty: ev.qty, ref: ev.ref, credits: ev.credits, usdCents: ev.usdCents, weiPaid: ev.weiPaid, sponsor: ev.sponsor, sponsorPaid: ev.sponsorPaid, applied }; store.save(); st.credited++; + if (hooks.onPurchase) { try { hooks.onPurchase(P[key], String(ev.txHash).toLowerCase()); } catch (e) {} } console.log('shop: order', ev.orderId, 'sku', ev.sku, 'x' + ev.qty, a, applied === 'credits' ? '+' + ev.credits + ' credits' : applied); return true; } @@ -146,4 +149,4 @@ function view() { return Object.assign({ contract: C ? C.contractAddress || null : null, watching: watching(), vouchers: voucherOn(), keeper: keeper ? keeper.address : null, lastBlock: ((store.state() || {}).shop || {}).lastBlock ?? null, purchases: list.length, creditsSold: list.reduce((t, x) => t + (x.credits || 0), 0), unmatched: list.filter(x => x.applied === 'unmatched').length }, st); } -module.exports = { init, voucher, voucherOn, watching, apply, poll, view, quote, order, receipt, fees, nudge, call, rpc, weekSales, TOPIC, IFACE, TYPES, CALLS }; +module.exports = { setHook, init, voucher, voucherOn, watching, apply, poll, view, quote, order, receipt, fees, nudge, call, rpc, weekSales, TOPIC, IFACE, TYPES, CALLS }; diff --git a/tools/proof-art.mjs b/tools/proof-art.mjs new file mode 100644 index 0000000..48021c4 --- /dev/null +++ b/tools/proof-art.mjs @@ -0,0 +1,46 @@ +// Telegram proof cards for Viral Banner Blitz (trust pack 2026-11-14): three 1200x630 images in the VBB pop-art look, rotated by +// proof.js per purchase post (the live numbers go in the caption). Neutral file names (no "banner"/"ad"/size tokens). +// node tools/proof-art.mjs -> public/art/proof/vbb-proof-{pink,blue,yellow}.png +import { pathToFileURL } from 'url'; +import fs from 'fs'; +import path from 'path'; +const PW = process.env.PLAYWRIGHT || 'D:/Projects/MarketingAgent/qa-tester/node_modules/playwright/index.js'; +const pwm = await import(pathToFileURL(PW).href); const chromium = pwm.chromium || (pwm.default && pwm.default.chromium); +const APP = path.resolve(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/, '$1')), '..'); +const OUT = path.join(APP, 'public', 'art', 'proof'); fs.mkdirSync(OUT, { recursive: true }); +const mark = fs.readFileSync(path.join(APP, 'public', 'art', 'mark.svg'), 'utf8'); +const V = { pink: ['#ff2d87', '#fff', '#ffd400'], blue: ['#2b59ff', '#fff', '#14d9a0'], yellow: ['#ffd400', '#14121f', '#ff2d87'] }; +const COLORS = ['#ff2d87', '#2b59ff', '#ffd400', '#14d9a0', '#ffffff', '#ff2d87', '#14d9a0', '#2b59ff', '#ffd400']; +const html = ([acc, accInk, acc2]) => ` + + +
${mark}
Viral Banner Blitz
+New purchase · paid on-chain +

Split in the same transaction.

+
30% sponsor10% weekly prizes60% VBB
+
${COLORS.map((c, i) => ``).join('')}
+viralbannerblitz.com/ledger +`; +const b = await chromium.launch(); const pg = await b.newPage({ viewport: { width: 1200, height: 630 } }); +for (const [k, v] of Object.entries(V)) { + await pg.setContent(html(v), { waitUntil: 'networkidle' }); await pg.evaluate(() => document.fonts.ready); + const f = path.join(OUT, 'vbb-proof-' + k + '.png'); await pg.screenshot({ path: f }); console.log('wrote', f, fs.statSync(f).size); +} +await b.close();