hackquest logo

INFT2

Trading agents you actually own. ERC-7857 brain + ERC-6551 wallet + TEE-attested inference on 0G and a manager iNFT that owns its child traders, so selling the manager sells the whole fund atomically.

視頻

專案圖片 1
專案圖片 2
專案圖片 3
專案圖片 4

技術堆疊

Solidity
Next
Ethers
Node
React

描述

iNFT-squared — Composable, Transferable AI Funds on 0G

A new asset class: an AI agent you can own, trade, and stack — without ever exposing its brain.


What It Is

iNFT-squared turns an autonomous trading agent into a single tradable token whose encrypted brain (model weights, memory, strategy state) lives in 0G Storage and runs inside a 0G Compute TEE.

Every agent ships with three things baked into the token:

  1. A transferable brain
    Re-encrypted to the new owner atomically on sale (ERC-7857).

  2. An on-chain wallet of its own
    An ERC-6551 token-bound account the agent trades from.

  3. A tamper-evident audit lineage
    A per-token snapshot log anchored every 6 hours to 0G DA.

Because the agent's wallet is just another address, an iNFT can own other iNFTs.

That is the squared.


Who It Is For

Persona

What They Get

Quant builders

Ship a strategy as a token. Earn perpetual royalties on resale. Keep weights private.

DeFi capital

Buy a fund-of-agents in one transaction. Full provenance, no key handoff drama.

Marketplaces

A standards-based AI asset — ERC-7857 + ERC-6551 + EIP-712 — not a custom escrow hack.


Why This Is Hard

Existing “AI agent NFTs” are JPEGs with a Discord bot attached.

To make agents a real asset class, you need all of these working together:

  • Brain confidentiality — the buyer must not see the seller’s weights, ever.

  • Atomic ownership transfer — re-encryption, key handoff, and ERC-721 transfer in one transaction or none.

  • Verifiable execution — proof the price came from the model the token says it did.

  • Composable wallets — agents need to hold capital and other agents.

  • Public auditability — without leaking the strategy.

iNFT-squared is the first stack that does all five on a single chain.


Six Primitives, One Asset

#

Primitive

0G Layer

What It Solves

1

ERC-7857 iNFT

0G Chain

Encrypted, transferable brain metadata

2

ERC-6551 TBA

0G Chain

Agent’s own wallet — lets one iNFT own another

3

TEE inference

0G Compute

Decisions signed inside an enclave (verify_tee: true)

4

Encrypted brain

0G Storage

ECIES-to-owner + AES-GCM blob, Merkle root on-chain

5

Snapshot lineage

0G DA

Per-token log: prev root, curr root, PnL, epoch

6

transferWithReKey

AgentController

Atomic: re-encrypt, swap key, transfer NFT


The Recursion Unlock

Owner  -- owns -->  Manager iNFT #42 "Orchard"
                         |
                         +-- TBA (its own wallet)
                                |
                                +-- owns  Child iNFT "Lark"   (momentum, 40%)
                                +-- owns  Child iNFT "Tide"   (mean-reversion, 35%)
                                +-- owns  Child iNFT "Quill"  (market-make, 25%)

Buy #42 and you buy the whole basket — re-keyed in one transaction, lineage of every child intact.

This is the fund-of-agents primitive.

Depth is capped at 3 to keep gas bounded.


Trust Model in One Line

The operator can broadcast.

It cannot:

  • move funds,

  • read brains,

  • forge a snapshot.

Funds move only under an owner-signed EIP-712 intent.

Brains decrypt only inside the TEE.

Snapshots chain previous roots to current roots, so any tampering breaks the lineage publicly.


What Is Live Today

Smart Contracts

  • 4 contracts

  • 21/21 forge tests passing

  • INFT7857

  • AgentController

  • SnapshotAttestor

  • ERC-6551 registry integration

Backend Runtime

  • Fastify

  • 0G Compute Router

  • GLM-5-FP8

  • TEE-verified execution

Recursion

  • Manager iNFT executing child intents through its TBA

  • Tested at depth 2


How 0G Is Actually Used

Every component below is wired into the live system, with the source file you can read it in.


0G Chain

chainId 16602 · Galileo testnet

All six product contracts are deployed and verified on Galileo.

  • EIP-712 intents are submitted to AgentController for every trade.

  • Snapshots are committed to SnapshotAttestor every 6 hours.

  • Brain root commitments live in iNFT2.

References

  • Code: contracts/src/*

  • Deployed addresses: see Deployment Details below; canonical record in contracts/deployments/testnet.json

  • Operator EOA broadcasting today:


0G Compute

TEE inference via Router

Every strategy decision:

  • momentum,

  • mean-reversion,

  • market-making,

  • manager rebalance

is an LLM call through the 0G Compute Router with verify_tee: true.

We then call:

broker.inference.processResponse(provider, chatId)

to independently verify the TEE attestation before treating the decision as authoritative.

Model

Sealed Inference is the safeguard against strategy front-running called out in Track 2.

References

  • Code:

    • runtime/src/llm.ts

    • runtime/src/strategies/{momentum,meanRev,marketMaker,manager}.ts

  • Routers:

    • Testnet: https://router-api-testnet.integratenetwork.work/v1

    • Mainnet: https://router-api.0g.ai/v1

  • TEE verification path:

    • verify_tee flag on request

    • processResponse SDK call on response

    • failed attestation aborts the tick


0G Storage

encrypted brain blobs + 6h snapshots

Every iNFT’s brain is encrypted with:

  • ECIES (secp256k1 ECDH + AES-256-GCM)

  • to the current owner’s pubkey,

  • uploaded to 0G Storage,

  • and its Merkle root is committed on-chain in iNFT2.

Every 6 hours the runtime publishes a full snapshot:

  • positions,

  • PnL,

  • equity curve,

  • decision log

to 0G Storage and writes the storage root into SnapshotAttestor.

This is the:

  • long-context memory primitive,

  • plus the auditable lineage primitive,

  • in one pipe.

References

  • Code:

    • runtime/src/storage.ts

    • runtime/src/brainKey.ts

    • runtime/src/snapshot.ts

  • Encryption:

    • ECIES to owner pubkey

    • transfer flow re-encrypts to the buyer in runtime/src/transfer.ts

  • Lineage:

    • each snapshot embeds the previous brain root,

    • so tampering breaks the chain publicly


0G DA

DASigners precompile

SnapshotAttestor reads the current DA epoch via the IDASigners precompile at:

and embeds it in every snapshot row.

That tag lets any indexer verify the snapshot landed in DA without re-uploading the blob.

References

  • Code:

    • contracts/src/SnapshotAttestor.sol

    • contracts/src/interfaces/IDASigners.sol

    • runtime/src/snapshot.ts


ERC-7857 iNFT

encrypted, transferable brain

iNFT2.sol implements the draft ERC-7857 surface.

Every token tracks:

  • an encrypted brain root,

  • an owner pubkey,

  • and a transferWithReKey entry point

that atomically:

  1. re-encrypts the brain to the buyer’s key,

  2. and transfers the ERC-721

  3. in one transaction.

References

  • Code:

    • contracts/src/iNFT2.sol

    • contracts/src/BrainKeyRegistry.sol

    • contracts/src/interfaces/IERC7857.sol


ERC-6551 Token-Bound Account

recursion

Every iNFT has a deterministic TBA from the canonical:

(salt, chainId, tokenContract, tokenId)

formula.

The manager iNFT’s TBA is the on-chain owner of the three child iNFTs — that is the squared.

AgentController.executeChildIntent recurses through the parent’s TBA to broadcast a child trade in the same transaction.

References

  • Code:

    • contracts/src/ERC6551Registry.sol

    • contracts/src/ERC6551Account.sol

    • contracts/src/AgentController.sol

  • Recursion test:

    • contracts/test/Recursion.t.sol

Final Thesis

Six 0G primitives. One composable asset. One transaction to own a fund of agents.

黑客松進展

What We Built During the Hackathon

Built from a blank repo over the hackathon window. Everything below shipped during the event.


Contracts

Solidity 0.8.20 · Foundry · OpenZeppelin

  • INFT7857.sol — ERC-7857 draft implementation with encrypted brain root, owner-pubkey registry, and transferWithReKey entry point.

  • AgentController.sol — EIP-712 intent verification, nonce/expiry/value-cap/daily-cap enforcement, executeIntent and executeChildIntent for recursion.

  • SnapshotAttestor.sol — per-token snapshot log linking prev brain root, curr brain root, PnL, 0G Storage root, and 0G DA epoch.

  • ERC-6551 integration against the canonical singleton.

  • 21 forge tests, all passing.


Backend

Fastify · TypeScript

  • 0G Compute Router client with verify_tee enabled, GLM-5-FP8 model.

  • Intent builder, EIP-712 signer hooks, operator relayer.

  • 0G Storage upload pipeline with ECIES + AES-256-GCM brain encryption.

  • 6-hourly snapshot worker that anchors to 0G DA and writes the on-chain attestation.

  • Supabase ledger for snapshots, intents, PnL, child relationships.

  • 14 vitest specs, all passing.


Frontend

Next.js 14 App Router

  • Routes:

    • / — landing

    • /demo — guided 6-step demo

    • /create — mint flow

    • /agent/[id] — live dashboard

    • /agent/[id]/buytransferWithReKey UI

    • /agent/[id]/snapshot/[sid] — snapshot explorer

    • /audit — global lineage browser

    • /pitch — 11-slide deck

  • Global wallet connect (Privy) pinned top-right with copy address, chainscan link, disconnect.

  • Six SVG diagrams covering architecture, recursion, intent flow, snapshot lineage, re-key, trust model.


Runtime

  • Observer loop reading market data, invoking TEE inference, returning structured trade proposals, waiting on owner-signed intent, broadcasting through the TBA.

籌資狀態

None

團隊負責人
SSairam M R
專案連結
部署生態系
0G0G
行業
DeFiNFTAIInfra