Marketplace for sealed AI prompts on 0G. Each prompt is an ERC-7857 iNFT whose key re-encrypts to the buyer on purchase — the seller cryptographically loses access.




0gPrompt is a marketplace for sealed AI prompts on 0G. Every prompt is an ERC-7857 iNFT whose AES-256-GCM encryption key re-seals to the buyer on every purchase, and the seller's old key cryptographically
stops working the moment the transaction confirms.
The problem: a system prompt or agent config has real value and zero defensibility. Screenshots leak instantly. PromptBase resells text you can copy on sight. Custom GPTs lock you to one vendor. There has
never been a way to transfer the access to an opaque artifact atomically, with provable loss-of-access for the seller — until ERC-7857.
How a purchase works end-to-end:
- The buyer clicks Buy on /market (flat 0.1 OG, no haggling)
- Their browser pulls the ciphertext from 0G Storage, decrypts it with the seller's escrowed key, generates a fresh AES-256 key bound to the buyer, re-encrypts the manifest, and uploads the new ciphertext
(tx 1)
- The browser then calls purchase(tokenId, sealedKey, proof) with value: 0.1 OG (tx 2). The contract verifies the oracle proof, rebinds the iNFT to the new ciphertext root + metadata hash, transfers
ownership, forwards 0.1 OG to the seller, and emits SealedKeyDelivered(tokenId, buyer, sealedKey)
- The buyer's wallet auto-scans SealedKeyDelivered events and stores the delivered key locally so Reveal works in /prompts immediately. No manual import step
What owning a prompt iNFT actually gives you:
- Decrypt anywhere. The plaintext lives only on your machine after Reveal. Copy it into ChatGPT, Claude, a local Llama, an internal pipeline — no vendor lock-in, no API the platform can pull.
- Rent without selling. authorizeUsage(executor, permissions) grants a scoped grant (e.g. use:10, day:30) to another address. Revoke it in one tx; the renter never holds the key.
- Resell or escrow. Because access is the token, you can flip a prompt, list it in a fund, or transfer it as part of a larger asset bundle. The next buyer gets a fresh re-sealed key; you lose access on
confirm.
- Atomic accountability. Every sale, rent, and revoke is an on-chain event. No platform can rewrite the access log; no seller can "still have a copy" — the contract enforces the loss.
- Cloneable derivatives. clone() lets the owner mint a re-sealed copy of a prompt (for an agent template fleet, for example) without giving up the original.
Why 0G specifically: the full stack lives on one network. 0G Chain runs the iNFT, 0G Storage holds the encrypted prompt bodies (Merkle root referenced on chain as encryptedURI), and the oracle verifies
the re-encryption proof. One wallet, one chain, one set of fees — no bridging between an L1, a separate storage network, and a third-party oracle.
Everything was built from scratch during the hackathon — no pre-existing codebase.
Smart contracts — Wrote ERC7857.sol implementing the full sealed-key surface mint, transfer, purchase, clone, authorizeUsage, revokeUsage) + MockOracle.sol as the testnet verifier. 13
Hardhat tests passing. Caught and patched a real auth bug mid-build (proof-replay theft via transfer()), added a payable purchase(tokenId, sealedKey, proof) for one-click buy with 0.1 OG forwarded to
the seller, and iterated through 4 deployments on 0G Galileo. Final: iNFT 0x29dd28Ee28f7876a01bA75a784835376951Bdb6C, oracle 0xd10ebe48df3F8D7354B9C6d66535944910e1EA49.
0G integrations — Wrapped the 0G Storage TS SDK for encrypted blob upload/download ogStorage.ts), built a viem→ethers signer bridge so the SDK works with the wagmi wallet signer.ts), and
implemented AES-256-GCM via Web Crypto in a layout that round-trips between browser and Node crypto.ts).
Sealed-key pipeline — reseal.ts is the shared download → decrypt → re-encrypt → upload module used by both seller-side transfer() and buyer-side purchase(). Every ownership change re-encrypts the
prompt under a fresh key bound to the new owner; the previous owner's key still exists locally but decrypts nothing the contract points at. This is what makes the seal mean something.
Frontend (Next.js 16, RainbowKit + wagmi + viem)
- /market — live marketplace from on-chain Minted events; one-click Buy runs the full re-seal + purchase() paying 0.1 OG to the seller
- /prompts — console scans totalMinted() + ownerOf so minted-and-transferred-in tokens both appear; real re-seal on Sell; buyer-side useEffect auto-claims keys from SealedKeyDelivered events
- Mint dialog with explicit Tx 1 of 2 (0G Storage) / Tx 2 of 2 (mint) labels; receipt parsing injects the new tokenId instantly instead of waiting on the indexer
- Marketplace ↔ console deep-link for buyer-requested seller-initiated transfers
Seeded catalog — scripts/seed-prompts.cjs minted 4 sealed prompts (Legal Brief Writer, Solidity Auditor, Cold Email Generator, Trading Signal Analyzer) using the deployer wallet; the same data is
baked into seedListings.ts so the marketplace is non-empty in any browser.
Branding + docs — Rebranded the full app to 0gPrompt (NavBar, Footer, layout, pitch deck, all marketing pages). Rewrote README.md, demo.md, pending.md around the new purchase() flow with an
ASCII flow diagram, security model, and explicit next-slice list (ECIES sealing to buyer pubkey, per-listing pricing, production oracle).
Bootstrapped. No fundraising to date — built solo during the hackathon.