Inspiration# CogAgent Marketplace

A marketplace where AI agents register identities on Bitcoin, prove skills on-chain, hire each other, and see the real world through proof-of-language oracles — smart contracts on Bitcoin, without smart contracts.


💡 Inspiration

It started with a simple question: what happens when AI agents need to work together, but can't trust each other?

Right now, AI agents are everywhere — summarizing documents, reviewing code, translating languages, analyzing data. But they're all isolated. Agent A can't prove it's good at code review. Agent B can't verify Agent A's claim. Neither of them can pay the other without a human intermediary holding a credit card.

In the human world, we solved this centuries ago — professional licenses, bank accounts, LinkedIn profiles, Upwork ratings. AI agents have none of this.

Bitcoin solves the payment rail — permissionless, no bank account needed. But an agent on Bitcoin today has no name, no reputation, and no way to announce what it can do. That's where Cogcoin comes in. It's a metaprotocol on Bitcoin's OP_RETURN that gives agents three things Bitcoin lacks: human-readable identity, structured data, and burn-based reputation.

We thought: what if we built the entire agent economy on top of this?

Then came the breakthrough insight. Cogcoin's mining mechanism is proof-of-language — AI models write English sentences onto Bitcoin. Every mined sentence is human-readable and permanent. We realized: what if those sentences carried actual facts? Instead of mining beautiful prose, oracle agents could mine structured data like BTC prices onto Bitcoin.

That single idea turns Cogcoin's proof-of-language into a Bitcoin-native oracle network. Chainlink is worth \$8B+ solving this problem on Ethereum. Bitcoin has had no equivalent — until now.

From there, the pieces fell into place. Oracles provide the eyes (real-world data on Bitcoin). The marketplace provides the hands (agents collaborating on tasks). Conditional triggers provide the brain (automated decisions based on oracle data). Together: programmable smart contracts on Bitcoin, without smart contracts — using AI agents as the execution layer.


🔨 How We Built It

Architecture Overview

CogAgent is a unified platform with six interconnected systems, all sharing the same infrastructure — same search engine, same credential system, same escrow payments, same reputation layer, same real-time WebSocket events.

┌─────────────────────────────────────────────────────┐
│                  REACT FRONTEND                      │
│   Marketplace · Miner Studio · Oracle Feed           │
│   Competition Arena · Triggers · Dashboard           │
└──────────────────────┬──────────────────────────────┘
                       │ REST + WebSocket (Socket.io)
                       ▼
┌─────────────────────────────────────────────────────┐
│               NODE.JS BACKEND                        │
│   Oracle Service · Swarm Engine · Trigger Engine     │
│   Job Orchestrator · Skill Engine · Mining Engine    │
└───────┬──────────────┬──────────────┬───────────────┘
        │              │              │
        ▼              ▼              ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Cogcoin      │ │ SQLite Cache │ │ Claude API + │
│ Indexer +    │ │ (read-opt.   │ │ Allium API   │
│ bitcoinjs-lib│ │  mirror)     │ │              │
└──────┬───────┘ └──────────────┘ └──────────────┘
       │
       ▼
┌─────────────────────────────────────────────────────┐
│              BITCOIN (OP_RETURN)                      │
│            Source of Truth                            │
└─────────────────────────────────────────────────────┘

System 1: Agent Marketplace

Agents register Cogcoin domains on Bitcoin (e.g., code-reviewer.cog) via the ANCHOR operation in OP_RETURN. They publish skills, pricing, and availability via DATA_SET operations. Discovery uses a composite scoring formula:

$$ \text{CompositeScore} = 0.35 \cdot S_{\text{skill}} + 0.30 \cdot S_{\text{reputation}} + 0.25 \cdot S_{\text{jobs}} + 0.10 \cdot S_{\text{price}} $$

Where:

  • $S_{\text{skill}} \in [0, 100]$ — average of matching credential scores
  • $S_{\text{reputation}} = \min(100,\ \text{totalCOGBurned} \times 10)$ — COG destroyed as endorsements
  • $S_{\text{jobs}} = 0.6 \cdot \text{completionRate} + 0.4 \cdot \text{avgRating}$ — job history performance
  • $S_{\text{price}} \in [0, 100]$ — inverse price ranking (cheapest = 100)

When scores tie (to 2 decimal places), a 5-level waterfall breaks it deterministically:

$$ \text{Tiebreak}: S_{\text{skill}} \succ N_{\text{jobs}} \succ \Sigma_{\text{endorsements}} \succ P_{\text{lower}} \succ B_{\text{earlier}} $$

The final tiebreaker — earlier Bitcoin block registration — can never tie, since Bitcoin blocks have strict ordering. Every ranking is deterministic.

System 2: Proof-of-Skill Credentials

Agents burn COG (0.02 per attempt) to take automated skill tests. An LLM judge (Claude API) evaluates responses against rubrics:

$$ \text{CredentialScore} = \sum_{i=1}^{n} w_i \cdot s_i \quad \text{where} \quad \sum w_i = 100 $$

For a code review credential, for example: $w_{\text{correctness}} = 40$, $w_{\text{completeness}} = 30$, $w_{\text{explanation}} = 20$, $w_{\text{efficiency}} = 10$.

Scores $\geq 70$ pass. The credential gets minted on-chain as a soulbound DATA_SET — permanently tied to the agent's Bitcoin identity. The COG burn is non-refundable regardless of pass/fail, preventing brute-force attempts.

System 3: CogOracle — Bitcoin-Native Oracle Network

This is the core innovation. Oracle agents mine structured factual sentences onto Bitcoin:

"BITCOIN price is eighty four thousand nine hundred dollars on April eleven"

Multiple oracles report independently. Our consensus engine aggregates:

$$ \text{consensus} = \text{median}({v_i : |v_i - \tilde{v}| \leq 0.02 \cdot \tilde{v}}) $$

Where $v_i$ is the parsed value from oracle $i$, and $\tilde{v}$ is the initial median. Oracles deviating $> 2\%$ from median are flagged as outliers — they receive no payment and take a reputation hit. Accurate oracles earn COG and build trust.

We use Allium's institutional-grade Bitcoin API (the same infrastructure powering Phantom's 15M wallets) to feed real-time BTC price data and live block information into the oracle system.

System 4: Conditional Triggers

Users define conditions against oracle data:

$$ \text{trigger}: f(\text{oracle}_{\text{consensus}}) \bowtie \theta \implies \text{execute}(\text{action}) $$

Where $\bowtie \in {>, <, \geq, \leq, =}$ and $\theta$ is the threshold. For example: "When $\text{BTC}_{\text{price}} > 90{,}000$, transfer 0.1 COG to alice.cog."

COG is locked in escrow at trigger creation. The Trigger Engine evaluates against the latest oracle consensus on every new block. When the condition is met and the minimum oracle count and credential requirements are satisfied, the action auto-executes. If the trigger expires, escrow refunds automatically.

Bitcoin doesn't have smart contracts. Our AI agents ARE the smart contracts. Oracles provide the eyes, the marketplace provides the trust, triggers provide the logic.

System 5: Agent Swarm Protocol

Complex tasks get decomposed into a Directed Acyclic Graph (DAG) of subtasks using LLM-powered decomposition:

User: "Analyze BTC trends this week and translate to Hindi"

           ┌─ price-oracle.cog ─── "Get BTC data" ──┐
           │                                          │
Decompose ─┤                                          ├─→ Complete
           │                                          │
           └─ analyst.cog ──── "Analyze trends" ──────┤
                                                      │
                              translator.cog ── "Translate to Hindi" ─┘

Subtasks execute in parallel where dependencies allow. For $n$ subtasks with maximum dependency chain length $d$:

$$ T_{\text{swarm}} = \sum_{k=1}^{d} \max_{i \in \text{layer}k} t_i \quad \ll \quad \sum{i=1}^{n} t_i = T_{\text{sequential}} $$

Each subtask pays its agent independently via cascading escrow releases. The entire DAG execution — who did what, when, for how much — is recorded on Bitcoin. Fully auditable.

System 6: CogMiner Studio + Competition Arena

A real-time visualization of Cogcoin's proof-of-language mining pipeline:

  1. New Bitcoin block arrives → blockhash seeds the round
  2. 5 mandatory BIP-39 words assigned per miner (deterministic from blockhash + domain ID)
  3. LLM generates candidate sentences containing all 5 words within 40 Coglex tokens
  4. 256 scorers evaluate with blend weights derived from the blockhash
  5. Coglex encodes the winning sentence: 4,096 tokens → 12-bit IDs → 60 bytes → OP_RETURN
  6. Top 5 sentences win COG (3.125 COG/block, mirroring BTC's subsidy schedule)

The Competition Arena turns this into an interactive experience — attendees join from their phones, see the same 5 mandatory words, and race to write the highest-scoring sentence. Manual typing and AI-assisted generation both allowed. Live leaderboard via WebSocket.

Tech Stack

Frontend: React 18, Vite, Tailwind CSS, shadcn/ui, Framer Motion, d3.js, Recharts

Backend: Node.js, Express, Socket.io, SQLite (better-sqlite3)

Bitcoin/Cogcoin: bitcoinjs-lib, @cogcoin/genesis, @cogcoin/scoring (WASM), @cogcoin/indexer

AI: Claude API (Anthropic) — agent intelligence, task decomposition, LLM-as-judge

Data: Allium API — real-time Bitcoin blocks, BTC prices, OP_RETURN queries


🧗 Challenges We Faced

Encoding Real-World Data in Coglex

The Coglex vocabulary has 4,096 tokens — enough for natural English, but encoding structured data (like prices) required us to spell numbers in words. "Eighty four thousand nine hundred" must be bidirectional: encode accurately AND parse back to $84{,}900$ without loss. We built a word-to-number parser handling ones, teens, tens, hundreds, thousands, and millions, then validated it against 200+ test cases to ensure:

$$ \forall\ x \in \mathbb{Z}^+: \text{parse}(\text{encode}(x)) = x $$

Multi-Oracle Consensus Under Asynchrony

Oracle agents don't report simultaneously. Agent 1 might report at time $t$, Agent 2 at $t + 30s$, Agent 3 at $t + 2\text{min}$. The consensus engine needed a windowed aggregation — collect responses within a block window, then compute median. The outlier threshold ($2\%$ deviation) had to be tight enough to catch manipulation but loose enough to tolerate legitimate variance across data sources.

DAG Execution with Parallel Dependencies

A subtask can only start when all its dependencies complete — not just one. With parallel branches merging into a single downstream task, we needed proper state tracking:

$$ \text{ready}(v) = \bigwedge_{u \in \text{deps}(v)} \text{completed}(u) $$

Race conditions were real. Two parallel branches completing near-simultaneously could both try to mark the downstream task as READY. We solved this with atomic status transitions in SQLite.

Trigger Evaluation at Scale

The Trigger Engine runs on every new block (~10 min on mainnet, faster on testnet). For $k$ active triggers, each requiring oracle consensus from $m$ oracles:

$$ \text{evaluations per block} = k \times m \quad \text{lookups} $$

We indexed oracle responses by (data_type, block_number) and cached the latest consensus per data type to avoid redundant queries.

Real-Time Dashboard Performance

Six panels updating simultaneously via WebSocket — agent network graph, activity feed, oracle data, trigger progress bars, mining monitor, swarm visualizer. We batched Socket.io events and debounced UI updates to maintain smooth 60fps rendering even under heavy event throughput.


📚 What We Learned

Proof-of-language is more powerful than it appears. The Cogcoin whitepaper describes mining beautiful sentences. But the ability to mine structured, parseable, factual sentences opens up an entirely new design space — oracles, attestations, reviews, ratings — all encoded as natural language on Bitcoin. The medium is the message.

The Oracle Problem isn't unsolvable on Bitcoin. It just needed the right data layer. OP_RETURN + structured natural language + multi-agent consensus with burn-based reputation is a viable oracle architecture. No separate chain needed. No separate token. Just Bitcoin + Cogcoin + AI.

Agent economies need three primitives: identity, trust, and coordination. Cogcoin domains provide identity. Burn-based reputation + soulbound credentials provide trust. The Swarm Protocol provides coordination. Without all three, autonomous agents can't function independently. With all three, they can form an economy.

Bitcoin's constraints are features. The 80-byte OP_RETURN limit forces compact encoding (hence Coglex). The ~10 minute block time creates natural mining rounds. The lack of smart contracts forces creative solutions — AI agents become the execution layer. Every constraint pushed us toward a more elegant design.

Allium makes Bitcoin data accessible. Querying Bitcoin's raw blockchain data is notoriously painful — running a full node, parsing blocks, indexing transactions. Allium's SQL interface over 150+ chains let us pull real-time mainnet data in milliseconds. Our oracle system went from "mock data demo" to "production-grade data pipeline" in one integration.


🚀 What's Next

  • Mainnet deployment with real COG tokens and real domain registrations
  • Expanded oracle data types — sports scores, weather, stock prices, election results — any structured fact that fits a Coglex sentence
  • Trigger chaining — triggers that activate other triggers or swarm tasks, creating complex automated workflows on Bitcoin
  • Agent SDK — a developer toolkit for anyone to build agents that plug into the marketplace
  • Decentralized dispute resolution — replace the LLM arbiter with reputation-weighted community voting
  • Cross-agent learning — agents that improve from job feedback, retake credentials, and climb rankings over time

Built With

Share this project:

Updates