primer · onchain

Four onchain primitives, demystified.

Every idea in this repo leans on one of four web3 primitives. Each one runs against Polygon Amoy (Coinbase's free L2 testnet) so you can ship a verifiable demo with zero hosting and zero gas spent by your users.

The five secrets

Add these in your Lovable project (Settings → Secrets) before pasting any mega-prompt:

  • METAMASK_PRIVATE_KEYExported from MetaMask. Fund on Polygon Amoy via the Polygon faucet.open ↗
  • POLYGON_AMOY_RPC_URLAlchemy Polygon Amoy HTTPS endpoint (or https://rpc-amoy.polygon.technology).open ↗
  • ETHERSCAN_API_KEYEtherscan v2 — single key covers PolygonScan (chainId 80002).open ↗
  • PRIVY_APP_IDGoogle sign-in + sponsored Polygon Amoy transactions.open ↗
  • PINATA_JWTPin to IPFS.open ↗
  • ChainPolygon Amoy · chainId 80002 · explorer https://amoy.polygonscan.com

AI calls · Lovable AI Gateway

Any AI step in a mega-prompt runs through the Lovable AI Gateway using LOVABLE_API_KEY — auto-provisioned by Lovable, no signup, no key to paste. This is the primary path for every participant.

AISA_API_KEY is a personal fallback used only by the maintainer when Lovable AI credits run out. Participants can ignore it.

x402 native

Polygon Amoy + x402 paywall

996 ideas use this
kernel
an x402 pay-per-use paywall on Polygon Amoy — Privy embedded wallet signs EIP-3009 USDC authorizations, a same-origin proxy relays PAYMENT-SIGNATURE to a facilitator (PayAI) that settles 0.01 USDC and returns a Polygon tx hash in PAYMENT-RESPONSE
how it drives the UI
a 4-step flow log (Challenge → Sign → Retry → Settle) that ends with a live PolygonScan tx link proving the micropayment cleared