hackquest logo

Daimon

Daimon is the on-chain version. An AI trading agent that learns your style by conversation, executes privately, and is itself a transferable asset.

视频

项目图片 1
项目图片 2
项目图片 3
项目图片 4

技术栈

React
Solidity
Web3
Ethers
Node
Python

描述

What is Daimon?

Daimon is a consumer dApp that turns an AI trading agent into a transferable on-chain asset. Every user spawns a personal daimon — Socrates's word for the inner voice that whispers what to do — names it, and trains it through conversation. The daimon learns the user's style, proposes trades the user can approve, executes those trades privately through an MEV-resistant TEE solver, and is itself an ERC-7857 iNFT that can be sold, rented for a fixed window, or passed down. Live on 0G mainnet (chainId 16661) and on 0G Galileo testnet (chainId 16602) at the same marketplace address — 0xb9D42824955b492BE4cBf13988C3d0Ad9985F807 — verifiable on chainscan right now.


The Problem

AI agents today have no property semantics. Cloud agents — ChatGPT, Replika, character.ai — own your memory; the platform reads it, you can't extract it, and you certainly can't sell it. Local agents — Ollama, MemGPT — are private but stuck on one device, not portable, not provable, not a real product. The whole category is stuck because the brain isn't a thing you hold; it's a row in someone else's database. Six months of teaching ChatGPT your trading style yields zero salable asset. You can't grant a hedge fund scoped access to your strategy for thirty days. You can't will your AI to your kid. And when a public-chain trading agent acts, every MEV bot reads the order before settlement — so the alpha you taught it is broadcast to its predators the moment it tries to use it. Four broken properties, one root cause: agents are services, not objects.


The Solution

Daimon fixes all four properties by composing two community primitives that shipped alongside it on 0G — SealedMind for memory and VeilSolver for execution — and adding a marketplace contract that gives both ownership and rental real economic meaning. When a user spawns a daimon, two transactions fire: a Sign-In with Ethereum signature against the SealedMind backend creates an encrypted memory vault keyed under HKDF derivation from the user's wallet, and a mint call on the SealedMindNFT contract creates an ERC-7857 iNFT in the user's wallet. When the user trains the daimon, every message goes through SealedMind's two-pass fact extractor — regex fast-path then TEE-LLM fallback for ambiguous cases — gets encrypted AES-256-GCM client-side, uploaded to 0G Storage as content-addressed blobs, indexed in HNSW vector search, and logged on-chain via the MemoryAccessLog contract. When the user opens the trade view, the BFF recalls relevant memories from SealedMind, fetches a live market snapshot, and sends both to 0G Sealed Inference — Qwen 2.5 7B running inside Intel TDX — which returns a single concrete trade proposal that quotes a specific memory in its reasoning. The user approves, the wallet sends the ECIES-encrypted intent to VeilSolver's TEE, GLM-5-FP8 inside Intel TDX with H100 pass-through generates an ECDSA-signed execution plan, the settlement contract verifies the signature via ecrecover and enforces minAmountOut in Solidity — MEV resistance becomes a property of code, not a promise from an operator. The trade outcome flows back into SealedMind as a trade-history memory, so the next proposal has feedback to use.


The Marketplace Contract

The one piece of net-new on-chain code we wrote: FamiliarMarketplace.sol, ~210 lines of Solidity 0.8.24, deployed on both 0G Galileo (chainId 16602) and 0G mainnet (chainId 16661) at the identical address 0xb9D42824955b492BE4cBf13988C3d0Ad9985F807 — same address on both chains because the deployer's nonce was zero on both at deploy time, and contract addresses are deterministic from (deployer, nonce). The contract handles two listing types — outright SALE and time-bound RENT — routes payment with a 2.5% treasury fee (feeBps configurable up to a hard 10% cap), emits structured events (Listed, Rented, SaleRecorded, Delisted) so a frontend can render activity without an indexer, and intentionally stays as a pure ledger plus payment router. It does not attempt to transfer the iNFT itself on a sale — the ERC-7857 transfer requires TEE-signed proofs the marketplace can't generate, so v1 ships SALE as a "ledger-only recording" with a v2 threshold re-encryption fix planned in coordination with the SealedMind team. RENT works fully today: renter pays on chain, the marketplace emits Rented with all the capability parameters, and the seller's wallet then signs CapabilityRegistry.grantCapability(...) directly — the only authorized caller per the registry's ownerOf == msg.sender check — followed by a backend mirror call so the SealedMind backend's local capability cache also lets the renter through. Twelve out of twelve contract unit tests pass against a Hardhat fixture that exercises every listing, payment, and access-control path.


The dApp

The consumer surface is a Next.js 14 dApp deployed on Vercel at daimon-web.vercel.app. Five primary rooms plus an inbox: /spawn mints the iNFT and runs a multi-stage hatching animation that reveals one of eight species deterministically picked from the daimon's name via djb2 hash; /train distills every chat message into encrypted memory with a live "memory crystallized" toast and a TEE attestation chip that polls until the on-chain MemoryAccessLog tx lands and surfaces a chainscan link; /brain shows the complete memory ledger with filters by shard, every record carrying its 0G Storage CID and on-chain audit link; /act runs a two-column market-data-plus-proposal view with four proof badges — settlement tx, VeilSolver attestation, audit root, memory updated — rendered inline after every executed trade; /market lists every active SALE/RENT listing fetched live from the marketplace contract via JSON-RPC; /market/grants is the seller's "inbox," watching the chain for Rented events filtered to listings the seller still owns and providing a one-click capability grant flow that signs grantCapability on chain AND mirrors the capability into SealedMind's backend in a single user action. There is also a /pitch route — a nine-slide editorial deck with arrow-key navigation, fullscreen mode, speaker-notes overlay, and cursor auto-hide — so the demo recording is the product itself, not a separate Google Slides deck.


The Backend

A thin Express + TypeScript BFF deployed on Railway at familiarbff-production.up.railway.app. Seven routes: /api/health (runtime sanity check), /api/market (cached CoinGecko price snapshot), /api/propose-trade (SealedMind recall + market data + TEE chat → structured trade proposal), /api/execute-trade (records the settlement outcome as a trade-history memory after the user's wallet has already submitted the on-chain settlement), /api/marketplace/listings (reads the live marketplace contract via JSON-RPC and serializes for the frontend), /api/grant-rental/mirror (mirrors an on-chain capability into the SealedMind backend so renters can recall), and /api/attestations/:hash (proxies SealedMind's verify endpoint and polls for the on-chain MemoryAccessLog tx hash to surface a clickable chainscan link). The BFF never holds user-specific session state — every operation that touches a user's memory uses the user's own session token, so all on-chain audit log entries are correctly attributed to the user's wallet. The trade proposal uses an operator-level SealedMind key only for the TEE chat call, which doesn't itself need a wallet binding.


The Pitch Deck Route

Daimon ships its own pitch deck as a product route at /pitch. Nine slides — hook, problem, idea, the five rooms, the species system, architecture, how SealedMind powers Daimon, how VeilSolver powers Daimon, what's shipped — plus an end card with try/verify/source CTAs. Arrow keys advance, number keys 1–9 jump to a slide, F toggles fullscreen, S toggles a speaker-notes overlay, Esc dismisses notes, click on the right half of the screen advances. The cursor auto-hides after two seconds of stillness and the navigation hint fades after three — so a screen recording of the deck is clean by default. The deck inherits the same vellum-honey-teal palette and Fraunces serif typography as the rest of the product, so it doesn't feel like a separate artifact. Built as one Deck.tsx controller plus a slides/ directory of nine self-contained slide components plus a SlideShell layout primitive — clean code that ships with the rest of the app.


Partnerships

Daimon is the consumer surface of a coordinated three-project submission to the 0G APAC Hackathon.

SealedMind ships the encrypted-memory primitive Daimon runs on. Every memory is encrypted under a wallet-derived key, stored on 0G Storage, indexed for retrieval, and gated by on-chain capabilities. Without SealedMind, Daimon would need to build encryption-under-wallet-keys, TEE inference, an ERC-7857 iNFT standard implementation, a capability registry, and an on-chain audit log — six months of work and a cryptography team we don't have. Daimon's brain is a SealedMind Mind iNFT; transfer the iNFT, transfer the brain.

VeilSolver ships the MEV-resistant execution primitive. When a daimon proposes a trade and the user approves, the order is ECIES-encrypted to the solver's enclave public key, the plan is computed inside Intel TDX, signed with ECDSA inside the enclave, and only the signed plan is accepted by the on-chain settlement contract. Without VeilSolver, every trade a daimon makes would broadcast the alpha its owner taught it to every MEV bot on the chain. The fact that worst-case slippage is bounded by Solidity (minAmountOut) rather than by operator policy is the property that makes "private AI trading" credible.

本次黑客松进展

Phase 0 — Architecture and Monorepo Scaffold

Set up a workspace monorepo with five packages: contracts (Hardhat + Solidity 0.8.24), bff (Express + TypeScript), web (Next.js 14 + Tailwind + wagmi + RainbowKit), shared (cross-package types and chain constants), scripts (E2E smoke test + brand renderer). Pinned the runtime to Node 20+ and committed .env.example files in every package so the next contributor has zero setup ambiguity. Defined the full architecture upfront — FamiliarMarketplace.sol on 0G as the only net-new on-chain code, BFF as a thin orchestrator that never holds session state, frontend as the primary consumer of SealedMind and VeilSolver SDKs, and a two-step rental flow that coordinates the marketplace contract with the SealedMind backend.


Phase 1 — Marketplace Contract

Wrote FamiliarMarketplace.sol — ~210 lines, two listing kinds (SALE/RENT), 2.5% treasury fee routed in the same transaction as the payment, structured event emissions (Listed, Rented, SaleRecorded, Delisted, TreasuryChanged, FeeChanged), and view helpers (getActiveListings, rentalsForListing, hasActiveRental) sized for a hackathon-scale UI to render without an indexer. Built a minimal MockSealedMindNFT.sol test fixture that tracks ownership but skips the ERC-7857 verifier dance, so the test suite can exercise listing, payment routing, and access control without bringing in the full SealedMind contract graph. Twelve unit tests across listing creation, sale execution, rent execution, fee distribution, and admin paths — 12/12 passing.


Phase 2 — Deploy Script + Multi-Network Config

Built scripts/deploy.ts to read the active Hardhat network and pick mainnet versus testnet SealedMind addresses automatically — same script handles both chains. Added separate DEPLOYER_PRIVATE_KEY (testnet) and DEPLOYER_PRIVATE_KEY_MAINNET (mainnet) env vars so a testnet key can never accidentally deploy to mainnet. Wrote npm run deploy:marketplace and npm run deploy:marketplace:mainnet scripts at the workspace root. The mainnet path includes a 5-second confirmation banner — "MAINNET DEPLOY — this transaction spends real OG — Ctrl+C in the next 5s to abort" — so a misclicked command can be aborted.


Phase 3 — Backend (Express BFF)

Built the seven-route BFF: /api/health, /api/market, /api/propose-trade, /api/execute-trade, /api/marketplace/listings, /api/grant-rental/mirror, /api/attestations/:hash. CoinGecko market data is cached in-memory for 60s to stay within rate limits. The trade proposal route calls SealedMind's /v1/inference/chat with an operator key, passes the user's recalled memories plus a market snapshot, and parses a strict JSON schema back from the TEE response — falls through gracefully when the model returns "wait" instead of a proposal. Every memory operation forwards the user's own SealedMind session token so on-chain audit logs are correctly attributed. CORS-allowed origins are configurable via env. Centralised config with placeholder detection (SEALEDMIND_OPERATOR_KEY=sm_op_REPLACE_ME is treated as missing) so misconfigured deployments fail fast at startup.


Phase 4 — Frontend Foundation

Bootstrapped Next.js 14 with the App Router. Built the providers layer (WagmiProvider + RainbowKit + React Query), an env getter module that strips trailing slashes defensively, a useFamiliar hook that reads from localStorage on mount only (avoids hydration mismatches), a SIWE gate component that handles the four states of "no wallet / wrong network / no session / authenticated," and an AttestationCard that polls for the on-chain MemoryAccessLog tx hash and renders a clickable chainscan chip when it lands.


Phase 5 — Five Rooms

Built /spawn with a multi-stage egg animation (dormant → warming → cracking → hatched) that reveals one of eight deterministically-picked species at the moment of mint. Built /train with a live conversation interface, seed-five-memories helper button for demos, per-message memory-crystallized toasts, and a side panel showing the live shard breakdown. Built /brain with shard filters, on-chain log chips per memory, and storage CID display. Built /act with a two-column layout (market data left, proposal right), the VeilSolver faucet button for test tokens, full TEE-attested trade proposal flow, and four inline proof badges after execution. The five rooms share consistent navigation, a Daimon-branded header with the user's familiar name, and a footer with partner credits.


Phase 6 — Species System

Designed the eight-species lore — Owl, Fox, Raven, Cat, Wolf, Snake, Octopus, Dragon — each with its own gradient, epithet, and aura quote. Built the deterministic picker (djb2(name.toLowerCase()) % 8), the species-aware HatchingEgg component (the egg's color matches its destined species during the warming stage, so the visual hint that the name matters is present even before reveal), and a species reveal moment that holds the suspense — the species name and aura quote are deliberately hidden until after the on-chain mint transaction confirms. Eight species means eight visually distinct demo screenshots, which helps the deck.


Phase 7 — Marketplace UI

Built /market (active listings rendered from a live JSON-RPC read of the marketplace contract), /market/list (seller flow with on-chain ownerOf verification before allowing the list transaction), and /market/grants (the inbox). The inbox is the integration's hardest UX problem: after a renter pays on chain, the SealedMind backend doesn't index Rented events, so the seller needs to do two more transactions to make the rental actually work — sign CapabilityRegistry.grantCapability from their wallet (the only authorized caller per ownerOf == msg.sender) and post to the SealedMind backend to mirror the capability into its local cache. We wired this as a single button-click that does both in sequence with clear UI feedback at each step.


Phase 8 — Brand Kit + Logo Refresh

Designed the Daimon mark — a stylized Greek sigma σ with a teal kernel-dot, reading simultaneously as the Greek root of "daimon," the calculus partial-derivative ∂ ("change with respect to you"), and a stylized lowercase d. Rendered the mark to PNG at multiple sizes (1024, 512, 256, 32, 1500×500 banner) using @resvg/resvg-js. After feedback that the σ mark wasn't iconic enough, ran a four-concept exploration sheet (Whisper-Curl, Echo-Loop, Imprint, Sigma-Mark) for comparison and refinement. Finally swapped to a Gemini-generated egg-owl illustration the team preferred, cropped it programmatically with sharp, and wired it through the Nav, Footer, favicon, and OG card. The Twitter banner uses the egg-owl plus a multi-egg cascade in the eight species palettes.


Phase 9 — Mainnet Production Deployment

Deployed the BFF to Railway. Railway's CVE scanner blocked the initial deploy on two Next.js HIGH vulnerabilities in the workspace lockfile (the BFF doesn't even import Next.js, but the scanner reads the whole monorepo lockfile) — bumped Next to ^14.2.35, the scanner passed. Subsequent build failures from cd .. commands in railway.toml made it clear Railway uploads the full monorepo to /app/ regardless of "Root Directory" UI setting — refactored the BFF to be a standalone workspace (inlined @familiar/shared into bff/src/shared.ts, removed the workspace dependency, pinned engines.node >= 20), wrote a root-level railway.toml with cd bff && npm install && npm run build && npm start commands, and mirrored it to bff/railway.toml so it works regardless of which Config Path Railway is configured to read. Deployed the frontend to Vercel from the web/ root directory. Fixed two production bugs that surfaced from the live deploy: a React hydration mismatch in useFamiliar because the hook was reading localStorage during initial render (fixed by moving the read into a mount-only useEffect), and a CORS failure because both WEB_ORIGIN and NEXT_PUBLIC_BFF_URL had trailing slashes that broke exact-match comparisons (added defensive trimSlash calls so a misconfigured env can't recreate the bug).


Phase 10 — Mainnet Marketplace Deploy

Deployed FamiliarMarketplace.sol to 0G mainnet (chainId 16661) using the new deploy:marketplace:mainnet script. The mainnet deployment landed at 0xb9D42824955b492BE4cBf13988C3d0Ad9985F807 — the same address as the Galileo testnet deployment, because the deployer wallet's nonce was zero on both chains at deploy time and contract addresses are deterministic from (deployer, nonce). A single hex string identifies the live contract on both networks; convenient for documentation, demo scripts, and a flex on the slide that lists what's shipped.

队长
AAtharva Waghchoure
项目链接
部署生态
0G Mainnet0G Mainnet
赛道
SocialFiDeFiNFTAI