primer · onchain

Four onchain primitives, demystified.

Every idea in this repo leans on one of four web3 primitives. Each one runs against Optimism Sepolia (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 Optimism Sepolia via the Optimism faucet.open ↗
  • OPTIMISM_SEPOLIA_RPC_URLAlchemy Optimism Sepolia HTTPS endpoint (or https://sepolia.optimism.io).open ↗
  • ETHERSCAN_API_KEYEtherscan v2 — single key covers Optimism Etherscan (chainId 11155420).open ↗
  • PRIVY_APP_IDGoogle sign-in + sponsored Optimism Sepolia transactions.open ↗
  • PINATA_JWTPin to IPFS.open ↗
  • ChainOptimism Sepolia · chainId 11155420 · explorer https://sepolia-optimism.etherscan.io

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

Optimism + x402 paywall

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