Stack POL: Viral Banner Blitz program (Marty 2026-11-15 standing rule: every rebuilt network site joins Stack POL when it goes live)

- programs.js: 'vbb' entry (slug viral-banner-blitz, pop-art pink #ff2d87, Banner loop), join via the LinkSpin network link nwvbb?src=stackpol&s1=<member>; facts from the VBB app and VBBShop contract only
- /earn/viral-banner-blitz + sitemap entry (automatic from the registry); card image public/img/vbb.jpg (VBB og image, 800x420); also adds the missing public/img/dlb.jpg (DLB card image was a 404)
- server.js: per-program button verb (Join for the banner sites, not Play) and WebApplication JSON-LD for them; home description no longer calls every program a game
- layout.js: Pro personalization also swaps s1=martbost on LinkSpin network links and ?ref=martbost on downlinebanners.com / viralbannerblitz.com links
- tools/indexer.py: VBB member payouts read-only from Polygon (VBBShop Paid role 0 sponsor shares + Claimed, eth_getLogs from the deploy block, cache vbb-chain.json) plus weekly prize transfers from VBB prizes.json, each checked on chain (from the prize wallet, to the winner, succeeded); contract, prize, company and keeper wallets excluded. Decoder checked against the Downline Banners contract (same Paid signature): 70 logs, role-0 total matches its chain index exactly
- README: sources + the standing rule

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-15 07:49:59 -06:00
parent 1735748ee6
commit 349fa79643
7 changed files with 128 additions and 10 deletions
+113 -3
View File
@@ -5,6 +5,9 @@
MemberActivated maps a member id to its wallet)
- usernames for wallets: IAP accounts + positions (MySQL, via the IAP container) and LinkSpin's accounts.json
- opt-in: /root/stackpol-indexer/optin.txt (one username per line) plus IAP's stack-optin.json when present
- Viral Banner Blitz (2026-11-15): VBBShop Paid (role 0, sponsor) and Claimed logs read from Polygon with eth_getLogs, plus the
weekly prize transfers listed in VBB's prizes.json, each checked on chain (sent by the prize wallet, to that winner, succeeded).
The scan position and the checked prize transfers are cached in /root/stackpol-indexer/vbb-chain.json (the only file it writes).
It builds one snapshot (network totals, per-program totals, last 7 days, latest 300 payouts, a stack per opted-in member) and
POSTs it to https://stackpol.com/api/ingest with the key in /root/.stackpol-ingest-key. Nothing is written anywhere else.
The ledger shows each payout's username (Marty 2026-11-09); only opted-in members get a public stack page.
@@ -32,9 +35,22 @@ CHAINS = {'iap': 'h8jd2hmt9y3c1gco9ed5nmva-instantadpay-data', 'ls': 'c10c6soppc
# (sponsor) or 1 (line level) to anyone but the contract and the two company wallets
DLB_VOL = 'gwjsodgtgtc2drdja1ndm0q7*bannerline-data'
DLB_HOUSE = {'0x6c77fc0664f58cf17e81966160fc80005a110f9b', '0x7627fc78876948ac9d95c1c9eb061e7d6d647b70', '0x8b7d33849a2c4d92c985be31e46dc564ba901ad2'}
# Viral Banner Blitz (2026-11-15): VBBShop on Polygon, read-only. Member payouts = Paid role 0 (the 30% sponsor share pushed in the
# purchase tx) + Claimed (a sponsor share whose push failed, pulled later) + the weekly prize transfers from the prize wallet. The
# prize-wallet (role 1) and company (role 2) shares, and anything to the contract / prize / company / keeper wallets, are not member payouts.
VBB_SHOP = '0x36f6ccc8752dce1c84e06b65f07df30e8a4707d7'
VBB_START = 97271183 # deploy block (the app's SHOP_START_BLOCK)
VBB_PRIZE = '0x167315726fe50cff97b8f4c91c8c606489397907'
VBB_HOUSE = {VBB_SHOP, VBB_PRIZE, '0x7627fc78876948ac9d95c1c9eb061e7d6d647b70', '0x839d97dea43321fcd6dcea1406da4cab6ef29af2'} # + company (Tangem), keeper
VBB_RPC = os.environ.get('VBB_RPC', 'https://polygon-bor-rpc.publicnode.com')
VBB_TOPICS = {'0x5cd81500d7f34f31cd8d8bd61c8cc1dd873c5ea0a46cd1c00ce014f1781f91d5': 'Paid', # Paid(uint256,address,uint256,uint8)
'0xf7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd3992683': 'Claimed'} # Claimed(address,address,uint256)
VBB_CONFIRM = 30 # blocks behind head
VBB_SPAN = 1000 # blocks per eth_getLogs (public RPC limit)
VBB_MAX_SPANS = 400 # per run; a long gap catches up over a few runs
# The sites keep their data documents in MySQL since 2026-11-13 (docstore.js, table docs). doc() reads one through the app's own
# DOCSTORE_URL, inside the database container; falls back to the volume file for an app still on files.
APPS = {'iap': 'h8jd2hmt9y3c1gco9ed5nmva', 'ls': 'c10c6soppcsowxsgbrufqb01'}
APPS = {'iap': 'h8jd2hmt9y3c1gco9ed5nmva', 'ls': 'c10c6soppcsowxsgbrufqb01', 'vbb': 'y8ywvn6hwl3x1hvs4y7eljbp'}
IAP_UUID = 'h8jd2hmt9y3c1gco9ed5nmva'
HERE = '/root/stackpol-indexer'
URL = 'https://stackpol.com/api/ingest'
@@ -62,11 +78,18 @@ def ms(v):
return int(v if v > 1e12 else v * 1000)
def doc(app, name, default):
def container(uuid):
"""the running app container: '<uuid>-...' (plain apps) or '<service>-<uuid>-...' (compose apps like VBB)"""
c = subprocess.run(['docker', 'ps', '--format', '{{.Names}}'], capture_output=True, text=True).stdout.split()
cont = next((x for x in c if x.startswith(APPS[app])), None)
return next((x for x in c if x.startswith(uuid) or ('-' + uuid + '-') in x or x.endswith('-' + uuid)), None)
def doc(app, name, default):
cont = container(APPS[app])
url = subprocess.run(['docker', 'exec', cont, 'printenv', 'DOCSTORE_URL'], capture_output=True, text=True).stdout.strip() if cont else ''
if not url:
if app not in CHAINS:
return default
d = voldir(CHAINS[app])
return load(os.path.join(d, name), default) if d else default
m = re.match(r'mysql://([^:]+):([^@]+)@([^:/]+)(?::\d+)?/([A-Za-z0-9_]+)', url)
@@ -82,6 +105,90 @@ def doc(app, name, default):
return default
def rpc(method, params):
rq = urllib.request.Request(VBB_RPC, data=json.dumps({'jsonrpc': '2.0', 'id': 1, 'method': method, 'params': params}).encode(),
headers={'Content-Type': 'application/json', 'User-Agent': 'stackpol-indexer'})
j = json.load(urllib.request.urlopen(rq, timeout=20))
if j.get('error'):
raise RuntimeError(method + ': ' + str(j['error'].get('message') if isinstance(j['error'], dict) else j['error']))
return j.get('result')
def vbb_rows(dry=False):
"""Viral Banner Blitz member payouts, read-only on chain. Returns (rows, note). --dry does not save the cache."""
cpath = os.path.join(HERE, 'vbb-chain.json')
cache = load(cpath, {}) or {}
last = int(cache.get('lastBlock') or VBB_START - 1)
logs = cache.get('logs') or [] # every Paid/Claimed log seen (all roles), so the counting rule can change without a rescan
prizes = cache.get('prizes') or {} # tx -> {to, wei, ts, ok}
bts = {}
def btime(n):
if n not in bts:
b = rpc('eth_getBlockByNumber', [hex(n), False])
bts[n] = int(b['timestamp'], 16) if b and b.get('timestamp') else 0
return bts[n]
note = ''
try:
head = int(rpc('eth_blockNumber', []), 16) - VBB_CONFIRM
seen = {(x['tx'], x['li']) for x in logs}
spans = 0
while last < head and spans < VBB_MAX_SPANS:
frm, to = last + 1, min(head, last + VBB_SPAN)
for l in rpc('eth_getLogs', [{'address': VBB_SHOP, 'topics': [list(VBB_TOPICS)], 'fromBlock': hex(frm), 'toBlock': hex(to)}]) or []:
if l.get('removed') or str(l.get('address', '')).lower() != VBB_SHOP:
continue
kind, t, data = VBB_TOPICS.get(l['topics'][0]), l['topics'], l.get('data') or '0x'
key = (l['transactionHash'].lower(), int(l['logIndex'], 16))
if not kind or key in seen:
continue
n = int(l['blockNumber'], 16)
if kind == 'Paid':
x = {'ev': 'Paid', 'to': '0x' + t[2][-40:].lower(), 'wei': str(int(data[2:66], 16)), 'role': int(data[66:130], 16)}
else:
x = {'ev': 'Claimed', 'who': '0x' + t[1][-40:].lower(), 'to': '0x' + t[2][-40:].lower(), 'wei': str(int(data[2:66], 16))}
x.update({'tx': key[0], 'li': key[1], 'block': n, 'ts': btime(n)})
logs.append(x)
seen.add(key)
last = to
spans += 1
if last < head:
note = 'catching up, %d blocks to go' % (head - last)
except Exception as e:
note = 'chain read failed (kept the cached logs): %s' % e
# weekly prizes: the transfers VBB's prize payer recorded as confirmed, each checked once on chain
try:
pz = doc('vbb', 'prizes.json', {}) or {}
for wk in (pz.get('weeks') or {}).values():
for t in wk.get('transfers') or []:
tx = str(t.get('tx') or '').lower()
if not tx or tx in prizes or t.get('status') != 'confirmed':
continue
tr, rc = rpc('eth_getTransactionByHash', [tx]), rpc('eth_getTransactionReceipt', [tx])
if not tr or not rc:
continue
ok = rc.get('status') == '0x1' and str(tr.get('from', '')).lower() == VBB_PRIZE and str(tr.get('to', '')).lower() == str(t.get('address', '')).lower()
prizes[tx] = {'to': str(tr.get('to', '')).lower(), 'wei': str(int(tr.get('value') or '0x0', 16)), 'ts': btime(int(rc['blockNumber'], 16)), 'ok': ok}
except Exception as e:
note = (note + '; ' if note else '') + 'prizes unavailable: %s' % e
if not dry:
tmp = cpath + '.tmp'
with open(tmp, 'w', encoding='utf-8', newline='\n') as f:
json.dump({'lastBlock': last, 'logs': logs, 'prizes': prizes, 'at': int(time.time())}, f)
os.replace(tmp, cpath)
rows = []
for x in logs:
member = (x['ev'] == 'Paid' and x.get('role') == 0) or (x['ev'] == 'Claimed' and x.get('who') not in VBB_HOUSE)
if member and x['to'] not in VBB_HOUSE and int(x['wei']) > 0:
rows.append({'k': 'vbb', 'pol': int(x['wei']) / 1e18, 'tx': x['tx'], 'ts': ms(x['ts']), 'w': x['to'], 'gu': ''})
for tx, x in prizes.items():
if x.get('ok') and x['to'] not in VBB_HOUSE and int(x['wei']) > 0:
rows.append({'k': 'vbb', 'pol': int(x['wei']) / 1e18, 'tx': tx, 'ts': ms(x['ts']), 'w': x['to'], 'gu': ''})
allwei = sum(int(x['wei']) for x in logs if x['ev'] == 'Paid')
return rows, 'vbb: scanned to block %d, %d contract logs (%.4f POL in all Paid events), %d prize transfers checked, %d member payouts %.4f POL%s' % (
last, len(logs), allwei / 1e18, len(prizes), len(rows), sum(r['pol'] for r in rows), ('; ' + note) if note else '')
def iap_wallet_users():
"""{address_lower: username} from IAP accounts + positions, via the IAP container (its DATABASE_URL never leaves it)."""
c = subprocess.run(['docker', 'ps', '--format', '{{.Names}}'], capture_output=True, text=True).stdout.split()
@@ -161,6 +268,9 @@ def main():
continue
if pol > 0:
rows.append({'k': 'dlb', 'pol': pol, 'tx': e['tx'], 'ts': ms(e.get('ts') or 0), 'w': str(e.get('to') or '').lower(), 'gu': ''})
vr, vnote = vbb_rows(dry)
rows += vr
print(vnote)
# wallet -> username
wu = iap_wallet_users()
lsd = voldir(CHAINS['ls'])