Skip to content

thesithunyein/ohlarr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‡ Ohlarr

Private payment rails for autonomous agents.

Live Demo Solana Devnet Anchor License

An x402-compatible HTTP payment protocol that lets autonomous AI agents pay for APIs with private, sub-second settlements on Solana.

Built on MagicBlock Private Ephemeral Rollups (Intel TDX TEE) β€” amounts and intent stay encrypted, settlements stay verifiable.

πŸš€ Live Dashboard β†’ Β· πŸ“Ί Demo Video Β· πŸ”— Solana Explorer


🎯 The Problem

Autonomous AI agents now spend real money on APIs β€” oracles, LLMs, data feeds. Every payment they make on a public chain leaks:

  • πŸ•΅οΈ Counterparties (which seller, which buyer)
  • πŸ’Έ Amounts (exact pricing & spend velocity)
  • 🎯 Intent (which API endpoint, what data)

Competitors, MEV bots, and indexers can reverse-engineer your agent's strategy from the chain. Privacy is the unsolved primitive blocking real agentic commerce.

πŸ’‘ The Solution

Ohlarr is x402 + Private Ephemeral Rollups stitched together as a drop-in middleware:

// Seller side β€” 1 line.
app.use(ohlarr({ programId, sellerPubkey, per, price: 1000n }));

// Buyer agent β€” 1 line.
const data = await client.fetch('https://api.example.com/v1/oracle/BTC-USD');

The seller's HTTP API returns HTTP 402 Payment Required with an Ohlarr challenge. The buyer agent signs a settlement transaction inside MagicBlock's PER (running on Intel TDX), retries with X-PAYMENT, and gets the data β€” all in one round-trip, sub-second.

The base Solana chain sees only opaque commits. Permission-key holders see everything.


🎬 The Killer Demo

Visit ohlarr.com/dashboard:

πŸ‘οΈβ€πŸ—¨οΈ Public Solana Observer πŸ”“ Authorized Ohlarr View
Real tx signatures, instruction names, PER commit hashes Same events, but decrypted: buyer β†’ seller, API path, lamports
from: β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ amount: β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ lamports from: AWXy...yRct β†’ 867u...BdzW 4,449 lamports

Two buttons that prove it's real:

  • πŸ€– Watch AI Agent Buy β€” runs a full x402 flow on devnet (HTTP 402 β†’ sign β†’ settle β†’ 200 with BTC price). Modal shows the live HTTP transcript with explorer links.
  • ⚑ Run Real Tx β€” executes a fresh deposit + settle on Solana devnet, shows up in the LIVE stream.

Every transaction is verifiable on Solana Explorer.


πŸ—οΈ Architecture

                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚   AI Agent (LangChain/MCP)  β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚ HTTP request
                                      β–Ό
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚   Seller API (any HTTP server) + ohlarr SDK β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ 402 Payment Required
                         β”‚  + X402Challenge
                         β–Ό
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚ Buyer signs Settle ix on Solana devnet PER  β”‚
            β”‚ β–Έ MagicBlock Private Ephemeral Rollup       β”‚
            β”‚ β–Έ Intel TDX TEE @ devnet-tee.magicblock.app β”‚
            β”‚ β–Έ Permission Program: ACLseo...XQnp1        β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ X-PAYMENT: <receipt>
                         β–Ό
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  Seller verifies β†’ returns paid resource    β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

   On-chain: opaque PER commit hash         (everyone)
   Off-chain (TEE): full plaintext state    (Permission members only)

πŸ› οΈ Tech Stack

Layer Tech
Smart contract Anchor 0.31.1 (programs/ohlarr_payments) β€” escrow vaults, payment channels, nonce-monotonic settlement
Privacy runtime MagicBlock Private Ephemeral Rollup on Intel TDX TEE
Permissions MagicBlock Permission Program (ACLseoPoyC3cBqoUtkbjZ4aDrkurZW86v19pXz2XQnp1)
Wire protocol Coinbase x402 β€” HTTP 402 Payment Required
SDK TypeScript (@ohlarr/sdk) β€” OhlarrClient, ohlarrMiddleware, PerSession
Hash BLAKE3 canonical request hashing
Frontend Next.js 14, Tailwind, framer-motion
Deploy GitHub Actions β†’ Solana devnet, Vercel for web

πŸ“¦ Repo Layout

ohlarr/
β”œβ”€β”€ programs/ohlarr_payments/    # Anchor program (Rust)
β”œβ”€β”€ packages/sdk/                # @ohlarr/sdk TypeScript SDK
β”œβ”€β”€ apps/web/                    # Next.js 14 dashboard (ohlarr.com)
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ page.tsx             # Landing + live stats banner
β”‚   β”‚   β”œβ”€β”€ dashboard/page.tsx   # Dual-view privacy demo
β”‚   β”‚   └── api/
β”‚   β”‚       β”œβ”€β”€ x402/oracle/btc-usd/  # Live x402 endpoint
β”‚   β”‚       β”œβ”€β”€ agent-buy/            # AI agent demo flow
β”‚   β”‚       β”œβ”€β”€ demo/                 # Real devnet tx trigger
β”‚   β”‚       └── stats/                # Live program stats
β”‚   β”œβ”€β”€ hooks/use-program-events.ts   # Real on-chain event hook
β”‚   └── lib/solana.ts                 # Devnet connection, PDAs, parsers
β”œβ”€β”€ apps/seller-demo/            # Express seller using middleware
β”œβ”€β”€ apps/buyer-agent/            # Node agent using OhlarrClient
└── .github/workflows/           # Auto-deploy to devnet

πŸš€ Try It Now

1. Use the live demo

Just visit ohlarr.com. The program is already deployed:

  • Program ID: CmHUW6WAUcobsYCHpK2cSgjcYU5KqbW8MDXunK5SzdLA
  • Network: Solana devnet
  • PER endpoint: devnet-tee.magicblock.app

Click "Watch AI Agent Buy" to see a real agent perform an end-to-end x402 purchase on devnet. The modal shows the full HTTP/chain transcript with verifiable links.

2. Hit the x402 endpoint yourself

# Without payment β†’ 402
curl -i https://ohlarr.com/api/x402/oracle/btc-usd

# Response:
# HTTP/2 402
# WWW-Authenticate: OhlarrX402
# {
#   "scheme": "ohlarr-x402-v1",
#   "network": "solana-devnet",
#   "amount": { "lamports": 1000 },
#   "payTo": "CmHUW6WAUcobsYCHpK2cSgjcYU5KqbW8MDXunK5SzdLA",
#   ...
# }

3. Run locally

git clone https://github.com/thesithunyein/ohlarr
cd ohlarr
pnpm install
pnpm --filter @ohlarr/web dev
# β†’ http://localhost:3000

4. Build & deploy your own program

The repo ships with a GitHub Action that deploys to devnet on push:

# Set the DEPLOYER_KEYPAIR secret in your repo, then:
gh workflow run deploy-devnet.yml

🎬 Demo Video

3-min demo: Problem β†’ Solution β†’ Live demo β†’ Tech stack

πŸ“Ί Watch on YouTube β†’ (coming soon)


πŸ† Built for the Privacy Track

Built for the Superteam Earn / Colosseum Hackathon Privacy Track sponsored by MagicBlock, Superteam MY, and SNS.

This project addresses the bounty's core thesis directly:

Bounty Criterion Ohlarr
Effective use of PER / Private Payments API Settlements run inside the PER on Intel TDX TEE; uses ephemeral_rollups_sdk macros (#[ephemeral], #[delegate], #[commit])
Working demo Live at ohlarr.com β€” real devnet program + real settlements + real x402 endpoint
Quality of architecture Clean separation: program / SDK / middleware / agent β€” drop-in for any Express/Next.js app
Real-world problem Agents leak strategy via on-chain payment metadata. We fix that.
Novel UX Side-by-side dual-view dashboard makes privacy visceral
Standards-compliant x402 spec verbatim β€” works with LangChain, CrewAI, MCP out of the box

πŸ” Security Notes

  • The base Solana chain only ever sees opaque PER state commitments β€” no plaintext amounts, identities, or API paths.
  • Settlements are nonce-monotonic and balance-checked inside the program; replay-resistant.
  • Request hashes use canonical JSON + BLAKE3 to prevent malleability.
  • The TEE attestation chain is rooted in Intel SGX/TDX β€” see MagicBlock docs for the trust model.
  • Demo keypairs in .env.local.example are devnet-only and rotated regularly.

πŸ“„ License

MIT β€” see LICENSE.


Built with πŸ‡ by @thesithunyein Β· Owns ohlarr.com

About

Private payment rails for autonomous agents on Solana. x402 + MagicBlock PER + Intel TDX TEE.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors