Competition & creator-fee rewards

Implementation specification · 21 October 2026 · Alpha 13

1. Player and round rules

Wallet signatures authenticate factories. Guest saves are local and never ranked. Rounds are UTC-aligned 30-minute intervals. A logged-in factory earns production points while sending recent foreground heartbeats (gaps of at most 15 seconds); accepted clicks and caught golden bonuses also count. Offline production and sale refunds do not count. Purchases do not subtract points. Existing factory upgrades remain effective across rounds; only the round score resets. This favors developed factories and is an explicit design choice, not a fresh-start tournament.

The server caps clicks at 8 per second with a bounded burst allowance. This limits throughput, not bots or multiple wallets. Before monetary launch: decide whether automation is allowed, define eligibility and exclusions publicly, add abuse review, and avoid treating IP address as proof of identity. All eligible wallets with positive final scores share the pool, not only the visible top 100.

2. Round finalization

Scores update atomically with factory state in Redis. A 30-second grace period follows round end. An atomic Redis script seals and snapshots ALL board rows. Late writes cannot alter sealed boards. Repeated snapshot requests return the same rows. The score-only release materializes snapshots when history is requested and retains them for 30 days; the page displays the latest six nonempty rounds. Names are current factory names, while scores are frozen.

The paid worker must run every minute under a secret-authenticated scheduler, enumerate every unprocessed round after its durable cursor, and catch up after downtime. It must not rely on users opening the history page. Financial snapshots and receipts require permanent retention and backups. A SQL financial ledger with unique receipt, round and payment IDs is preferred for the production money service; the current deterministic module is the transition reference, not a durable ledger deployment.

3. Pump fee collection and attribution

After receiving the mint, verify chain, token program, creator recipient, quote asset, bonding-curve/AMM state and fee-sharing mode on-chain. The default payout asset is native SOL; other quote assets require a separately approved conversion policy. No automated swap is assumed. A simple transfer into the treasury is not automatically a creator-fee receipt.

Single-recipient fees use the applicable bonding-curve and AMM collection instructions. Shared-recipient coins use the Pump Fees sharing flow. Detect migrations and re-check the recipient. Creator vaults can aggregate fees across coins; do not attribute an entire shared vault sweep to this token. Index the correct mint's trade/fee events and reconcile accrued versus collected balances. Either use a dedicated creator account or maintain mint-level attribution. Fail closed if attribution cannot be proven.

Only finalized successful receipts count. The trusted decoder validates program IDs, instruction path (including inner instruction index), mint attribution, recipient, quote asset and received amount. Unique key: chain + transaction signature + instruction path. Webhooks are hints, not authoritative receipts. Persist scan cursors, replay overlapping finalized ranges safely, and reconcile with treasury balances.

4. Funding policy

The owner supplies reward allocation in basis points (0–10,000). Rewards are a share of actual collected attributable creator fees, never a percentage of trading volume. Gas is funded separately. A round receives only verified, unallocated funds according to its persisted funding cutoff and policy version. Late receipts fund the next unpaid round; completed rounds are never rewritten. Paid mode starts at a future round boundary after all gates pass. Score-only rounds are never retroactively funded.

The pool announced for a paid round must be reserved at round opening. This is a missing worker orchestration step; the pure settlement module verifies that the supplied pool is funded. In a crash recovery, durable round reservation takes precedence over recalculating a pool from the latest balance.

5. Allocation and small balances

Each final score is normalized to millionths of a point using decimal/exponent parsing and BigInt, never a floating-point conversion of lamports. Allocation is floor(pool × player weight / total weight). All remainders stay in available funding. If total weight is zero, the entire pool carries forward. Zero allocations do not generate transactions. Below-threshold entitlements remain in the wallet's internal balance and accumulate across rounds. The payout threshold is configurable and must be shown to users before paid play begins.

6. Transfer state machine

credit → reserved → signed → submitted / unknown → confirmed. Reserve a wallet's payable amount atomically; allow only one in-flight payment per wallet. Persist amount, recipient, signed bytes, signature, blockhash expiry and stable payment ID BEFORE submitting. Use a separate restricted treasury signer. The signer verifies recipient and amount match the reservation and includes a payment-ID memo. Transaction and daily limits bound exposure.

An RPC timeout is UNKNOWN, not failure. Re-broadcast identical signed bytes and query the existing signature using historical lookup. Never generate a new transaction while the old signature may succeed. Mark a payment paid only after finalized success. A proven final failure releases the reservation once. Expiry with inconclusive RPC history stays quarantined for reconciliation. A null status alone is not evidence of failure. Gas expenses are separate from player liabilities.

7. Storage, API and operations

RecordRequired durable data
Fee receiptSignature, instruction path, mint, recipient, slot, asset, gross/net lamports, allocation policy, processing state.
RoundStart/end, funding reservation, mode, policy version, complete immutable eligibility/score snapshot, allocation hash and settlement status.
Wallet ledgerAppend-only credits, reservations, releases, confirmed payments. Reconciled current balance.
PaymentStable ID, wallet, amount, signing/submission/confirmation evidence, attempts, last error, expiry, audit timestamps.

Public APIs expose current funded pool, score rules, round results and confirmed transaction links. Authenticated wallet APIs expose personal accrued and pending balances. Administrative funding/settlement routes require scheduler credentials or operator authentication and must never trust client-supplied receipts or totals. The present public APIs cannot initiate a financial transition.

Monitor stale scheduler cursors, unprocessed fees, age of unknown payments, database errors, locked rounds, treasury insolvency and reconciliation mismatches. A kill switch stops new signing while leaving game saves and confirmations running. Back up the financial ledger daily and test restores. Treasury assets must cover outstanding wallet credits, reservations, unallocated reward funds and a separate gas reserve.

8. Implementation boundary

Ready nowStill to connect and validate
Live score boards, server scoring, score snapshots/history, deterministic allocation/funding/credit/payment state transitions and automated tests.Mint-specific decoder, Pump collector, durable financial database, pool-reservation worker, scheduler, signer, real-chain reconciliation, wallet reward UI, alerting and paid-mode activation.

The financial core is lib/settlement.js. Its funding receipt and transaction-result inputs must come from trusted chain adapters. Passing a field named finalized does not verify a blockchain transaction. Existing tests validate accounting/state transitions with fixtures; they are not a mainnet integration certification.

9. Launch sequence after mint

  1. Verify token, recipient, quote asset and fee mode; confirm owner allocation, threshold and automation/eligibility policy.
  2. Deploy persistent ledger and worker in read-only/shadow mode. Index and reconcile real finalized creator fees.
  3. Configure a restricted signer outside chat; fund a separate transaction-fee reserve.
  4. Run devnet transfer lifecycle tests: timeout, duplicate job, crash after signing, expired blockhash, failed instruction, restart and restore.
  5. Observe at least two complete shadow rounds and reconcile all lamports.
  6. Publish paid rules and activate at a future round boundary. Start with bounded payout limits; expand only after successful reconciliation.

Primary references

Back to Pill Clicker