// overview
this site reads the cryptopunks contract (0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB) through a server-side proxy at /api/rpcand sends transactions through the visitor’s browser wallet via rainbowkit. two environment variables drive everything.
// environment
# .env.local RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- ■
RPC_URL— any ethereum mainnet json-rpc endpoint. server-only, never bundled. do not prefix withNEXT_PUBLIC_. - ■
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID— get one from cloud.reown.com. used by rainbowkit to power the wallet connect modal. this value is meant to be public.
restart next dev after changing any of these.
// reads vs. writes
reads go through /api/rpc, which forwards json-rpc requests to your RPC_URL. the url never reaches the browser, so it’s safe to put a secret api key in it.
writes never touch the server. rainbowkit renders the wallet picker; the connected wallet signs and broadcasts every transaction directly. supported actions: buy, place / withdraw bid, accept top bid, offer for sale / withdraw offer, transfer, and withdraw pending balances.
// deployment notes
- ■ set
RPC_URLas a server-side secret in your hosting platform — it must stay server-only. - ■ the proxy at
/api/rpcis open to the internet — add rate limiting at the edge for production use. - ■add this site’s origin to the “allowed domains” list for your walletconnect project on cloud.reown.com before deploying.