Skip to main content

Command Palette

Search for a command to run...

Serverless P2P NFT Marketplace on Polygon — Powered by GenosDB

A live Polygon NFT marketplace with no backend and no MetaMask, mirrored into GenosDB — a peer-to-peer graph database with real-time, offline-capable reads.

Updated
5 min readView as Markdown
Serverless P2P NFT Marketplace on Polygon — Powered by GenosDB
E

Full Stack Developer - dWEB R&D

Most dapps hammer an RPC and shove a wallet extension in your face. I took the on-chain marketplace from OVGrid and rebuilt it as a ~1,600-line example where the database is the read layer — and your identity is your wallet.

Open two browser tabs at dMarket. Browse the marketplace in both — no wallet, no sign-up, no spinner waiting on an RPC. The items are just there, and a change in one tab shows up in the other. That isn't a backend doing the work. It's a peer-to-peer graph database.

dMarket is a small, faithful slice of the marketplace that runs inside OVGrid — the WebGPU planet I wrote about here. I pulled the blockchain layer out, trimmed it to ~1,600 readable lines of vanilla JavaScript with no build step, and kept it pointed at the same real contracts OVGrid uses on Polygon. It exists so you can copy a pattern that actually works instead of reinventing it.

The problem with most blockchain front-ends

Every wallet, every render, every visitor hits the same RPC for the same data. There's no real-time sync between users unless you stand up an indexer and a websocket server — a backend, the very thing crypto was supposed to get rid of. And before anyone can even look, you make them install MetaMask.

I wanted to show a different shape.

First, what GenosDB is

GenosDB is a peer-to-peer graph database that runs entirely in the browser. No central server: data lives locally (OPFS), replicates between peers over WebRTC, and every operation is signed by your own key. You read it reactively with db.map(query, cb). (More in the examples.)

The key idea: the chain is the truth, GenosDB is the mirror

Polygon stays the source of truth for ownership — money is money. But you don't read from the chain on every render. You read it once, write the result into GenosDB, and from then on everyone reads the database:

// Read the chain (authoritative) once, mirror it into GenosDB:
const listings = await chain.getActiveListings()        // 2 Multicall3 calls
await Promise.all(listings.map(l =>
  db.put({ type: 'listing', ...l }, `listing_${l.listingId}`)
))

// Everywhere else, read reactively — never the RPC again:
db.map(({ id, value, action }) => repaint())            // the ONE reactive read

After a buy or a listing confirms on-chain, the same thing happens: db.put the new state, and db.map streams it to every connected peer. The read layer never changes whether an item was just discovered on-chain or just created by someone two seconds ago. The database is the abstraction — fast, offline-capable, peer-to-peer, with no indexer in the middle.

The part I'm proudest of: your identity is your wallet

GenosDB's Security Manager already gives every user a cryptographic identity — an address and a private key derived from a recovery phrase. Here's the thing nobody points out: that's an Ethereum account. The same key that signs your peer-to-peer database operations signs your Polygon transactions.

// A GenosDB login hands you a usable wallet. One key, two worlds.
const id = await db.sm.loginOrRecoverUserWithMnemonic(phrase) // { address, privateKey }
const wallet = new ethers.Wallet(id.privateKey, provider)     // signs on-chain txs
// wallet.address === db.sm.getActiveEthAddress()   ✓  no MetaMask

No extension, no second wallet, no bridging. You log in once and you can both sync P2P and transact on-chain with the exact same identity. dMarket even asserts the two match before it ever signs. See the Security Manager docs.

What GenosDB actually buys you here

What a marketplace needs How dMarket does it with GenosDB
Live updates between users db.map() over WebRTC — no indexer, no websocket backend
Browse instantly, even offline local-first reads from GenosDB (OPFS)
A wallet the GenosDB identity is the wallet — no MetaMask
"Who owns what" mirrored P2P, re-derivable from the chain anytime

Simplified, but real

dMarket is deliberately a reference example, not the full product. It does mint, list, buy and offer — and stops there. No auctions, bundles, rentals, royalties, analytics or a 3-D world; that breadth lives in OVGrid. But what's here is the real, battle-tested integration: real ABIs, real contracts on Polygon Amoy, the real identity bridge. Read dMarket to learn the pattern; study OVGrid to see it at full scale.

Browsing works for anyone with no wallet — that's the GenosDB showcase. To actually transact you connect an identity and grab free test POL from the Amoy faucet; the README is honest about the prerequisites.

Try it / read it

Why this matters

We keep rebuilding the same backend — an indexer here, a websocket there, a wallet popup in front — to do things a peer-to-peer database can just do. dMarket is a small proof that you can put a real blockchain behind a real-time, offline-capable, serverless front end, and have the whole thing be readable in an afternoon.

The chain is the truth. The database is the mirror. Your identity is your wallet. No backend.