OpenX

OpenX is the marketplace where AI agents pay you in USDC to work with your agent only you control

Repo

About

## Wave 1 submission

🎨 Retro Pixel-Art Frontend (packages/frontend)

We built a retro, pixel-art themed Next.js application that acts as the core interface for our privacy-preserving AI system. This includes:

πŸ–₯️ Next.js + React 18 UI with immersive retro styling πŸ” Privy-powered Web3 wallet authentication for seamless onboarding βš™οΈ WASM compatibility enhancements in next.config.mjs to support the asynchronous WebAssembly loading required by @cofhe/sdk πŸ” Secure & Intuitive Crypto-Permission Controls

Users can now:

πŸ“Š View their encrypted Context Status

πŸ›‚ Authorize or revoke delegated cryptographic decryption permits πŸ’¬ Chat with the AI in real time, with all context processed through private FHE workflows

This creates a smooth, end-to-end privacy workflow that maintains full personalization without exposing any plaintext state.

πŸ”„ Seamless End-to-End FHE Integration

The entire loop is now live:

🧾 Generate an on-chain CoFHE permit

πŸ”“ Allow temporary, permissioned decryption πŸ€– Receive a context-aware LLM response, powered by encrypted memory πŸ” State updates sync back on-chain automatically

This marks the first fully integrated iteration of our private AI companion, backed by fully homomorphic encrypted context.

πŸ”— 🌐 Live Deliverable: https://privacy-context-frontend.vercel.app/

## Wave 2 submission

# πŸ—οΈ **Architecture Overview**

```

FRONTEND (Next.js) | AGENT BACKEND (Express) /marketplace β†’ Browse/Buy | POST /chat β†’ Skill Detection useUserLicenses β†’ Owned? | GET /skill/user/:addr/licenses usePurchaseSkill β†’ Buy+Reg | POST /skill/register-license β–Ό β–Ό SMART CONTRACTS (Arbitrum Sepolia) SkillRegistry β†’ Encrypted listings (FHE.asEuint64) AgentSkillVault β†’ Purchase + encrypted price check SkillAccessController β†’ Permission grant/consume (FHE.eq) EncryptedPricer β†’ Dynamic pricing & fees ```

---

# πŸš€ **Deliverables Summary**

## 🧠 1. Skill Engine

Files: `skillDefinitions.ts`, `skillExecutor.ts`

**Skills**

| Skill | Purpose | Triggers | | ---------------------- | --------------------- | ---------------------------- | | 🏦 DeFi Analyzer | Yield & risk analysis | `defi`, `yield`, `liquidity` | | πŸ›‘οΈ Auditor | Security checks | `audit`, `exploit` | | πŸ“Š Portfolio Optimizer | Encrypted allocation | `rebalance`, `sharpe` |

Each skill has an index, systemPrompt, trigger keywords, and `detectSkill()`.

---

## πŸ”’ 2. License-Gated Chat

Flow:

**detectSkill β†’ isPremium?** β€’ NO β†’ normal chat β€’ YES β†’ check license β†’ executeSkill or prompt purchase

Zero token waste; licensed users get expert prompts.

---

## 🎫 3. License Management

Endpoints:

* `GET /skill/user/:addr/licenses`

* `POST /skill/register-license` * `POST /skill/purchase` * `POST /skill/list` * `GET /skill/:index/handles`

In-memory licenseStore with expiry filtering.

---

## ⛓️ 4. SkillAccessController

Encrypted permission validation:

* `verifyAndConsumePermission()`

* Uses FHE.eq, FHE.gt, FHE.select (no branch leakage)

---

## πŸ›’ 5. Marketplace UI

Shows skill name, description, USDC price, β€œβœ“ OWNED”, real-time license sync, instant post-purchase update.

---

## πŸ”— 6. Purchase β†’ Permission Grant

`PURCHASE β†’ encryptSkillPurchase() β†’ Vault.purchaseSkill() β†’ FHE.gte verify β†’ on-chain license β†’ backend register β†’ available in chat`.

---

## βš™οΈ 7. Environment

```

SKILL_REGISTRY_ADDRESS= SKILL_VAULT_ADDRESS= SKILL_ACCESS_CONTROLLER_ADDRESS= NEXT_PUBLIC_SKILL_ACCESS_CONTROLLER_ADDRESS= ```

---

## πŸ“¦ Files Updated

Agent Backend: 4 created / 5 updated

Frontend: 3 created / 3 updated Config: 1 updated **Total: 16 changes**

---

# πŸ”— Resources

  • GitHub: [https://github.com/phamdat721101/privacy-context](https://github.com/phamdat721101/privacy-context)
  • Arbiscan Contracts: AIContextManager, AIMemoryStore, AgentRegistry, AgentAuthority
  • Docs: [https://docs.cofhe.com/](https://docs.cofhe.com/)
  • Network: Arbitrum Sepolia

---

# 🏷️ Protocols & Tech

FHE Β· @cofhe/sdk Β· Next.js 14 Β· Express Β· ethers v6 Β· viem Β· wagmi Β· Solidity 0.8.27 Β· Hardhat ---

## Wave 3 submission

FHE AI Context v0.3 β€” Privacy Payment Layer for AI Agent Context Management

GitHub: https://github.com/phamdat721101/privacy-context

This wave delivers a complete privacy-preserving payment and billing infrastructure for AI agents using Fhenix CoFHE on Arbitrum Sepolia. All 11 smart contracts are deployed and verified.

== What's New ==

  • FHERC20 Payment Token (EncryptedPaymentToken)
  • ERC20-compatible token with fully encrypted balances using FHE.asEuint64
  • Supports encryptedTransfer, encryptedApprove, encryptedTransferFrom β€” all amounts hidden on-chain
  • mintPlaintext for testnet bootstrapping; production uses encrypted mint
  • Deployed: 0x994D13b35450424d8F7c92fEF96f4d6AaAB64B3C
  • PrivPay Gateway β€” Encrypted Invoice/Escrow/Subscription
  • Create invoices with FHE-encrypted amounts and recipients
  • Escrow system: payer locks funds, agent releases on LLM approval
  • Recurring subscriptions with encrypted billing intervals
  • All payment metadata (amounts, parties) stays encrypted on-chain
  • Deployed: 0x0dFCC4B94B17626f1D40a02592B4cb98403cd158
  • Agent Billing β€” Prepaid FHE Balance for AI Chat
  • Users top up encrypted prepaid balance per agent
  • Agent charges per-chat fees (branchless FHE.select β€” no balance leak)
  • Integrated into /chat endpoint: 5 tokens/chat, auto-deducted
  • Deployed: 0xff4dc5D0e979Ff494CcdD6c18A37964a5dD1A290
  • Settlement Ledger β€” Encrypted Audit Trail
  • Every agent payment recorded with FHE-encrypted amount + reason hash
  • Both payer and payee get ACL access to their settlement records
  • Queryable per-user settlement history
  • Deployed: 0x0B8c6F7d23E8057c160893909e63fA7e884Fedf7

5. SDK Upgrade to @cofhe/sdk v0.5.2

- Migrated from v0.1.1 to v0.5.2 (breaking API: .encrypt()β†’.execute()) - Batched encryption: 6 fields in 1 ZK proof (369 bits, 1 verify call instead of 6) - Contracts updated to accept InE* memory structs with proper FHE.allowThis() ACL - @fhenixprotocol/cofhe-contracts upgraded to v0.1.3

6. Three-Layer Privacy Architecture

- Layer 1: FHERC20 β€” payment amounts encrypted on-chain - Layer 2: MetadataFilter SDK β€” strips PII (emails, SSNs, phones) from messages before LLM - Layer 3: ContextSeal β€” FHE-encrypts agent decision context in analytics logs

7. Encrypted Skill Marketplace

- SkillRegistry: list AI skills with encrypted pricing (FHE.asEuint64) - AgentSkillVault: purchase licenses with FHERC20 tokens - SkillAccessController: verify + consume permissions with encrypted agent addresses

== On-Chain Proof (Arbitrum Sepolia, Chain 421614) == Agent Registration: 0x61546c8f3213bdf64c1072af73caa5e63b907d4ea96fc16a52beab82a51d3479 Agent Assignment: 0x89349fcfa60078200d180828ba3b489a90b3005acf9931ca666a8c3a52afe272 Memory Authorization: 0x8ad940c256bcf5dc54e399878e79788111c39d8722a08e15e8114abc686179d2 All 11 contracts: see deployments/arbitrum-sepolia.json

## Wave 4 submission

Demo: https://www.youtube.com/watch?v=j3RTS8NmkQ0 Product: https://privacy-context-frontend.vercel.app/ Agent Skill to upload brain: https://github.com/phamdat721101/brain-skill Starting Point Phase 1 was a β€œConfidential AI Context Management” demo β€” FHE-encrypted user context for AI agents. It worked, but it wasn’t a real product yet.

What Was Delivered:

A complete, production-ready FHE Second Brain system β€” from architecture to contracts, backend, SDK, and full frontend UI.

πŸ“Œ Phase-by-Phase Summary

Architecture Designed hybrid FHE model (AES-encrypted content + FHE keys stored on-chain) Identified Fhenix euint128 constraint and adapted design Smart Contracts: - Created BrainKeyVault.sol - Updated SubscriptionController.sol - Created KnowledgeBaseRegistry.sol - Deployed all three to Arbitrum Sepolia Backend (Express API): - Chat: store + learn via RAG - Upload endpoint - Brains CRUD - Subscribe flow - Permit-based authentication - Connected to Supabase + Bedrock Claude Opus Payments: - Integrated n-payment SDK (x402 protocol) - Used for provable subscription gating FHE Authentication: - Implemented CoFHE permit system permitGate middleware enforces wallet-based cryptographic ownership - Permit itself is authentication Frontend: - Rebuilt all 5 pages using Fhenix design system: Home, Chat, Brains, Subscribe, My Brain

Infrastructure

- API deployed on VPS (PM2 + Caddy HTTPS) - Supabase database - No Redis or Docker needed (simplified ops) SDK BrainClient with: - uploadEncrypted() - AES-256-GCM encryption - Key-split storage for FHE model βš™οΈ Key Technical Decisions No Redis / No Worker β€” synchronous pipeline is fast enough + minimal ops Supabase over Local Postgres β€” zero maintenance, global access Bedrock Claude Opus over OpenAI β€” higher quality, existing API usage Permit = Auth β€” FHE permit replaces traditional auth n-payment x402 β€” real payment protocol, not a DB flag Chunk Append β€” uploads append instead of overwrite Publish Without Subscription β€” sharing is free; consuming requires subscription πŸ“¦ Deployed Artifacts API: https://13-229-63-192.sslip.io Contracts (Arbitrum Sepolia) SubscriptionController: 0xCC42779858F1cd3F480aD33BcBc5A931D57DfFc3 KnowledgeBaseRegistry: 0x36eca600679E73061318f8C10F6E43aFc06C96E0 BrainKeyVault: 0x07beFe30F0C8Ef8B4c513da22A310eF84E9010c0

βœ… What Works End-to-End

Wallet connect (Privy) Subscription flow (on-chain tx + DB sync) Knowledge storage via chat store mode RAG learning β†’ Claude Opus answers File uploads (chunked + append mode) Multi-brain creation Brain publishing to catalog Catalog browsing/search FHE permit auth (403 for unauthorized write) Subscription gate (402 for unpaid users) HTTPS API All contracts deployed + verified

## Wave 5 submission

Repo = https://github.com/phamdat721101/privacy-context Demo - video = https://www.youtube.com/watch?v=BMYUU3TB-WM Demo - product = https://openx-app.vercel.app/

πŸš€ What Shipped This Wave

Publish-as-Paid-API Wizard

Turn any brain into a paid API:

Pick brain β†’ slug β†’ price β†’ payTo β†’ system prompt Instantly publishes: /api/v1/<slug> Auto-generated agent.json for AI-agent discovery Buyer-First Bundle Page

New /agent/[id] page includes:

Copy-paste curl

Agent prompt Full agent.json Free Try-It widget AI-buyer FAQ Custom Agent Prompts Wizard + Studio editor PATCH /v3/agents/:id Shared buildSystemPrompt() across v1/v3 Eliminated prompt drift Free Try-It Endpoint

POST /v3/agents/:id/try

10 requests/IP/agent/day

Logged as method="demo" Clean seller analytics Studio Improvements Receipts β†’ Bundle page Public β†— badge on published agents "Public Bundle Page" CTA Platform Fixes Expanded agents.chain enum Enforced paid_calls.amount_usdc >= 0 Fixed ESM/CJS loading issue causing /api/v1/<slug> 502s πŸ” How OpenX Uses Fhenix BrainKeyVaultV2

Arbitrum Sepolia: 0x9a6BcBea6De59FE19d7d1648EFb3F1Ee36331156

One AES-256 key per brain

Key wrapped with FHE Platform never holds plaintext keys Permit Verification

Using @cofhe/sdk

Verifies:

Issuer

Recipient Contract Expiration

before any decryption attempt.

CoFHE Contracts

SubscriptionControllerV2 β€” 0x648d...bcA3 KnowledgeBaseRegistryV2 β€” 0x9787...D075e BrainKeyVaultV2 β€” 0x9a6B...1156

Built with @fhevm/solidity + @fhenixprotocol/cofhe-contracts.

πŸ’° x402 + Fhenix = Private Payments

Standard x402 exposes payer and amount. OpenX adds a confidential FHERC20 rail while preserving the same x402 HTTP flow.

Dual Rails

Header Rail Privacy X-Payment: <x402 receipt> Standard x402 Public X-Payment: fherc20 <txHash> FHERC20 Amount encrypted FHERC20 Verification

Checks:

Transaction mined & successful

Correct token contract Transfer sent to seller Unique tx hash (replay protection)

Does not verify amountβ€”the amount remains encrypted on-chain.

From the public Akindo product page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.