Skip to content

shreyas-sovani/Inference_protocol

Repository files navigation

Inference Protocol Logo

Inference Protocol- Data marketplace for AI agents to buy trading insights from traders.

It is a platform for monetizing financial intelligence. It enables experienced traders to sell niche, high-signal market insights directly to AI agents and traders.


πŸ’‘Problem

Modern trading agents and retail traders rely on: Free data sources, hardcoded APIs, expensive enterprise terminals (Bloomberg)

This creates three major gaps:

1. Undermonetized Expertise

Skilled traders and analysts have no way to sell niche insights like short-term stock predictions, candlestick patterns, sentiment reads.

2. No On-Demand Insight Market

Retail and algo traders need fresh, contextual, short-horizon insights, and not static datasets or news feeds.

3. Fragmented Discovery

AI agents cannot easily discover or pay for specialized human knowledge, leading to missed opportunities in volatile markets.


πŸ’‘ Solution

Inference Protocol is a data marketplace designed for AI agents and traders.

  • Traders publish structured insights (predictions, analyses, datasets).
  • AI agents autonomously search, evaluate, and purchase insights.
  • Payments happen instantly via embedded micropayments (x402 + USDC).
  • Buyers rate insights to build seller reputation.
  • Sellers earn passive income without subscriptions or contracts.

This creates a closed-loop economy where quality data is rewarded and low-quality data is filtered out.


🧱 Project Structure

src/
β”œβ”€β”€ types/
β”‚   └── marketplace.ts    # Product, Event, Stats, Slash/Reward types
β”œβ”€β”€ services/
β”‚   └── marketplaceService.ts  # Product registry, stake ledger, slashing logic
β”œβ”€β”€ routes/
β”‚   └── market.ts         # /api/market/* endpoints + x402 paywall + rating
β”œβ”€β”€ vendors.ts            # Legacy vendor definitions
β”œβ”€β”€ agent.ts              # InfoMart Agent β€” browse, evaluate, purchase, RATE
└── server.ts             # Express server, SSE streaming, x402 config

client/src/
β”œβ”€β”€ components/
β”‚   └── MarketTicker.tsx  # Live scrolling ticker (sales + slashes)
β”œβ”€β”€ pages/
β”‚   └── SellerDashboard.tsx  # Publish products, track earnings & STAKE
└── App.tsx               # Agent Terminal, routing, budget display

🧱 Running it yourself

Prerequisites

  • Node.js 18+
  • Wallet with testnet USDC on Base Sepolia
  • Google AI API key (free at aistudio.google.com)

Setup

git clone https://github.com/shreyas-sovani/Inference_protocol.git
npm install
cd client && npm install && cd ..
cp .env.example .env

Add your keys to .env:

AGENT_PRIVATE_KEY=0x...     # Your wallet's private key
GOOGLE_API_KEY=...          # From Google AI Studio

Get testnet tokens

Run

Terminal 1 β€” Backend:

npm run start:server

Terminal 2 β€” Frontend:

cd client && npm run dev

Open http://localhost:5173:

  • Agent Terminal β€” Ask questions, watch the agent hunt for alpha
  • Sell Knowledge β€” Publish your own expertise to the marketplace

🧱 Architecture Overview

  • Seller Dashboard for publishing insights.
  • Agent Interface for querying and purchasing.
  • Marketplace Service for discovery and payments.
  • Embedded x402 micropayment layer.
  • Real-time updates via Server-Sent Events (SSE).
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  SELLER UI      β”‚     POST /publish    β”‚                           β”‚
β”‚  (Dashboard)    │─────────────────────►│     EXPRESS SERVER        β”‚
β”‚  Port 5173      β”‚                      β”‚     Port 4021             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚                           β”‚
                                         β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     SSE /stream      β”‚  β”‚  MARKETPLACE        β”‚  β”‚
β”‚  AGENT UI       │◄──────────────────── β”‚  β”‚  SERVICE            β”‚  β”‚
β”‚  (Terminal)     β”‚                      β”‚  β”‚                     β”‚  β”‚
β”‚  Port 5173      β”‚     POST /chat       β”‚  β”‚  β€’ Product Registry β”‚  β”‚
β”‚                 │─────────────────────►│  β”‚  β€’ Stake Ledger     β”‚  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚  β”‚  β€’ SSE Events       β”‚  β”‚
        β”‚                                β”‚  β”‚  β€’ x402 Paywall     β”‚  β”‚
        β”‚                                β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
        β”‚                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                                              β”‚
        β–Ό                                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MARKET TICKER  │◄─────SSE──────────── β”‚  INFOMART AGENT           β”‚
β”‚  (Live Feed)    β”‚   /market/stream     β”‚                           β”‚
β”‚                 β”‚                      β”‚  Tools:                   β”‚
β”‚  [NEW] [SALE]   β”‚                      β”‚  β€’ log_reasoning          β”‚
β”‚  [SLASH]        β”‚                      β”‚  β€’ browse_marketplace     β”‚
β”‚  scrolling...   β”‚                      β”‚  β€’ purchase_data          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚  β€’ rate_product           β”‚
                                         β”‚                           β”‚
                                         β”‚  "Hunter & Judge"         β”‚
                                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ›  Tech Stack

AI & Reasoning

  • LangChain (agent orchestration)
  • Google Gemini (reasoning & planning)
  • Semantic search for discovery

Payments

  • x402 protocol (Coinbase standard)
  • USDC stablecoin
  • Base Sepolia testnet

Backend

  • Node.js + Express
  • REST APIs
  • Server-Sent Events (SSE)

Frontend

  • React 18
  • Vite
  • Tailwind CSS

πŸ’‘ How It Works

Seller Flow

Sign up with email and wallet address -> Upload insights (title, description, content) -> Set price per purchase -> Publish to the marketplace -> Track sales, earnings, and reputation via dashboard -> Withdraw earnings anytime


Buyer Flow

Sign up with email and wallet address -> Enter a natural language query -> AI agent analyzes the request -> Agent searches marketplace using semantic matching -> Top insights are recommended -> Buyer approves instant micropayment -> Results are delivered in the interface -> Buyer rates the insight to build seller reputation

πŸ‘₯ Users

Buyers

Indie traders building algo bots for NSE stocks, fintech startups using AI for predictions, enterprises automating strategies, individual investors seeking stock recommendations.

Pain: Lack of reliable, specialized, short-term market intelligence . Willingness to Pay: Traders already pay for tools, groups, and expert sessions.


Sellers

Experienced retail traders, professional analysts, research firms and niche experts.

Pain: No easy way to monetize insights without high platform fees. Incentive: Free to list, earn per-use micropayments, passive income.


API Endpoints

Marketplace

Endpoint Method Description
/api/market/publish POST Publish a new product
/api/market/products GET List all products (public)
/api/market/products/agent GET Products formatted for LLM
/api/market/product/:id GET Single product listing
/api/market/product/:id/buy GET Purchase (x402 paywall)
/api/market/product/:id/record-sale POST Record sale with txHash
/api/market/product/:id/rate POST Rate product (triggers slashing)
/api/market/stats GET Marketplace statistics
/api/market/stream GET SSE stream (listings, sales, slashes)

Agent

Endpoint Method Description
/api/chat POST Trigger agent analysis
/api/stream GET Agent reasoning SSE stream

πŸ’‘ AI Impact & Responsible Use

Evaluation & Guardrails (Hallucination / Bias Mitigations)

The core AI component is an autonomous agent powered by LangChain + Google Gemini (reasoning model) that interprets natural-language queries, performs semantic matching against listed insights, evaluates relevance & ROI, and decides whether to recommend or purchase content.

Key mitigations in place:

  • Retrieval-Augmented Generation (RAG)-like pattern: agent reasoning is strictly grounded in retrieved marketplace items (no open-world hallucination allowed).
  • Chain-of-thought prompting with explicit steps: Analysis β†’ Browse β†’ Budget/ROI β†’ Decision β†’ Rejection rules.
  • Hard rejection for low-value / generic queries (e.g. "Who is Elon Musk?" or broad non-trading questions).
  • Strict per-session budget cap ($0.10 USDC testnet default) prevents runaway spending.
  • Post-purchase human ratings + reputation scoring + slashing mechanism disincentivize low-quality or misleading insights.
  • No generative synthesis of financial predictions β€” agent only summarizes or forwards purchased human-created content.

πŸ’‘ Known Limitations & Risks

  • Financial domain risk: Insights are user-generated and not verified by the platform. Buyers (human or agent) must perform their own due diligence. The protocol is not investment advice.
  • Early-stage reputation system: Reputation scores and slashing are new and may initially be noisy until enough ratings accumulate.
  • Model hallucinations: While heavily mitigated via grounding + rejection rules, subtle misinterpretations of query intent or marketplace metadata remain possible.
  • Marketplace quality: Low-quality or spammy listings can appear until filtered by ratings and economic incentives.

πŸ’– Team

Name Role Contact
Shreyas Sovani Lead Developer Shreyas Sovani
Swanandi Bhende Product / UX Design Swanandi Bhende

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •