A living alignment graph for verifiable AI-generated knowledge, built on OriginTrail DKG, powered by MCP & x402.
📚 Challenge 1: Grokipedia Vs Wikipedia — Content Comparison and Trust Annotation
NeriaMind is an AI-powered knowledge alignment system that transforms AI-generated encyclopedia content into verifiable intelligence. As Grokipedia emerges to rival Wikipedia, the need for systematic verification becomes critical.
The system compares Grokipedia entries against Wikipedia articles to detect factual inconsistencies, missing context, AI hallucinations, and bias, then publishes Verifiable Truth Notes (structured JSON-LD Knowledge Assets) to the OriginTrail Decentralized Knowledge Graph. AI agents access verified knowledge through 14 MCP tools, while economic accountability is enforced through x402 micropayments and TRAC/NEURO staking.
Think: X's Community Notes for AI encyclopedias — 8 curated topics analyzed, discrepancies published as verifiable Knowledge Assets on OriginTrail DKG, with real blockchain settlement via x402 and token staking.
AI-generated encyclopedias are proliferating without verification infrastructure:
- 🤖 Grokipedia claims "fact-checked by Grok" but LLMs hallucinate facts
- 📝 No provenance for AI-generated claims — users can't trace sources
- 💸 No economic consequence for misinformation — no accountability
- 🤷 No systematic verification between AI encyclopedias and human-curated sources
NeriaMind is a 3-layer verification system that transforms encyclopedia comparisons into verifiable, economically-accountable knowledge on the DKG.
- 📊 Multi-modal fetching — Wikipedia via MediaWiki API, Grokipedia via Puppeteer scraping (text, images, videos)
- 🧮 Semantic analysis — OpenAI text-embedding-3-small computes similarity scores between content
- 🤖 AI discrepancy detection — GPT-4 identifies factual inconsistencies, missing context, hallucinations, and bias with evidence quotes
- 📦 Truth Note generation — Structures findings as JSON-LD Knowledge Assets with provenance
- 🔗 DKG publishing — Publishes to OriginTrail DKG, anchored to NeuroWeb blockchain
- 💳 x402 payments — Self-hosted facilitator enforces HTTP 402 for premium notes with real blockchain settlement
- 🏦 Token staking — In-memory ledger tracks TRAC/NEURO stakes, calculates confidence scores
- 🎯 Agent access — 14 MCP tools + 13 REST APIs for AI agents to query and stake on verified knowledge
Key Innovation: End-to-end pipeline from comparison → verification → blockchain publishing → economic accountability.
- Wikipedia Fetcher — MediaWiki API integration with full content retrieval
- Grokipedia Scraper — Puppeteer-based scraping
- Semantic Embeddings — OpenAI text-embedding-3-small for similarity scoring
- Media Analysis — Image/video comparison with metadata extraction
- GPT-4 Discrepancy Detection — Identifies factual errors, missing context, hallucinations, bias with evidence quotes
- 14 MCP Tools — Full AI agent integration (fetch, compare, publish, query, stake)
- 13 REST APIs — HTTP endpoints for programmatic access
- 8 Curated Topics — Pre-selected high-divergence topics (Quantum computing, Climate change, AI, Bitcoin, Elon Musk, COVID-19, Renewable energy, Machine learning)
- JSON-LD Truth Notes — Knowledge Assets with structured discrepancies
- DKG Publishing — OriginTrail DKG integration
- SPARQL Queries — Query truth notes via semantic graph queries
- Self-Hosted x402 Facilitator — HTTP 402 protocol implementation with viem
- Real Blockchain Payments — NeuroWeb settlement
- Token Staking — In-memory TRAC/NEURO stake ledger
- Confidence Scoring — Algorithm:
min(1, totalStakeValue / 300) - Premium Truth Notes — Monetization via x402
NeriaMind implements a custom DKG pluginpackages/plugin-neriamind-encyclopedia-compare/ following a 3-layer architecture per OriginTrail DKG design principles:
┌─────────────────────────────────────────────────────────────────┐
│ USER / AI AGENT (MCP Client) │
└────────────────────────┬────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ AGENT LAYER (14 MCP Tools + 13 REST APIs) │
│ │
│ Wikipedia Fetcher │ Grokipedia Scraper │ AI Comparator │
│ (MediaWiki API) │ (Puppeteer) │ (GPT-4 + Embed) │
│ │
│ Topic Manager │ SPARQL Queries │ Truth Note Publisher │
└─────────────────────────┬───────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ KNOWLEDGE LAYER (OriginTrail DKG + NeuroWeb) │
│ │
│ JSON-LD Truth Notes │ DKG Engine │ NeuroWeb Testnet │
└─────────────────────────┬───────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ TRUST LAYER (x402 + Staking + Metrics) │
│ │
│ x402 Facilitator │ Staking Ledger │ Confidence Scores │
│ • HTTP 402 Protocol │ • TRAC/NEURO │ • Trust metrics │
│ • NeuroWeb payments │ • Stake tracking │ • Verification │
└─────────────────────────────────────────────────────────────────┘
Data Flow:
Topic → Fetch (Wikipedia + Grokipedia) → AI Analysis (GPT-4 + Embeddings)
→ Truth Note (JSON-LD) → DKG Publish → x402/Staking → Agent Query
See ARCHITECTURE.md for detailed system design.
| Category | Technology |
|---|---|
| Engine | OriginTrail DKG Node |
| LLM | OpenAI v6.9.1 |
| Models | gpt-4o-mini, text-embedding-3-small |
| Web Scraping | Puppeteer v24.30.0, MediaWiki REST API |
| Web3 | viem v2.38.4 |
| Payments | x402 v0.6.6 |
| Blockchain | NeuroWeb Testnet (Polkadot) |
- Node.js 22+ with npm 8+
- macOS or Linux
- OpenAI API Key (Get one here)
- NeuroWeb Testnet Tokens (NEURO + TRAC from faucet)
npm install -g dkg-cligit clone https://github.com/samueldanso/neriamind.git
cd neriamind
# Setup DKG Node configuration
dkg-cli setup-config --testnet --neurowebThis generates:
.envfile with blockchain keys- Operational wallet (needs NEURO for gas)
- Publishing wallet (needs NEURO + TRAC)
Important: Fund both wallets before proceeding!
dkg-cli installcd apps/agent
npm run build:scripts
npm run script:setupWhen prompted, enter:
- OpenAI API Key: Your API key
- LLM Model:
gpt-4o-mini - DKG Environment:
testnet
Creates admin user: admin@example.com / admin123
Generate a new EVM wallet for the x402 facilitator:
# Option A: Use MetaMask (create new account, export private key)
# Option B: Generate with viem
node -e "const { generatePrivateKey } = require('viem/accounts'); console.log(generatePrivateKey())"Get wallet address:
node -e "const { privateKeyToAccount } = require('viem/accounts'); console.log(privateKeyToAccount('0xYOUR_KEY').address)"Fund with NEURO: Send 0.1 NEURO to facilitator address from faucet
Add to environment:
# Add to apps/agent/.env
echo "FACILITATOR_PRIVATE_KEY=0xYourGeneratedKeyHere" >> apps/agent/.envcd ../.. # Back to root
npm run devOnce running, access:
- 🖥️ Web UI: http://localhost:9200 (login with admin credentials)
- 🔌 MCP Server: http://localhost:9200/mcp
- 📡 API Docs: http://localhost:9200/swagger
- 🗄️ Database UI: https://local.drizzle.studio
Test the system:
# 1. Check facilitator
curl http://localhost:9200/facilitator/supported
# 2. Test x402 (should return 402 Payment Required for premium UAL)
curl http://localhost:9200/truth-note?ual=did:dkg:otp:20430/0x0000000000000000000000000000000000000001/1
# 3. Check trust metrics
curl http://localhost:9200/trust/metrics?ual=test-ual
# 4. Test staking
curl -X POST http://localhost:9200/trust/stake \
-H "Content-Type: application/json" \
-d '{"ual":"test","amount":100,"token":"TRAC","staker":"0xTest"}'✅ If all return JSON responses, you're ready!
All assets are verifiable on the OriginTrail DKG Explorer.
| Topic | UAL | Explorer Link |
|---|---|---|
| Quantum Computing | did:dkg:otp:20430/0xcdb28e93ed340ec10a71bba00a31dbfcf1bd5d37/396831 |
View on Explorer |
| Climate Change | did:dkg:otp:20430/0xcdb28e93ed340ec10a71bba00a31dbfcf1bd5d37/396832 |
View on Explorer |
| Artificial Intelligence | did:dkg:otp:20430/0xcdb28e93ed340ec10a71bba00a31dbfcf1bd5d37/396833 |
View on Explorer |
| Bitcoin | did:dkg:otp:20430/0xcdb28e93ed340ec10a71bba00a31dbfcf1bd5d37/396834 |
View on Explorer |
| Elon Musk | did:dkg:otp:20430/0xcdb28e93ed340ec10a71bba00a31dbfcf1bd5d37/396835 |
View on Explorer |
| COVID-19 Pandemic | did:dkg:otp:20430/0xcdb28e93ed340ec10a71bba00a31dbfcf1bd5d37/396836 |
View on Explorer |
| Renewable Energy | did:dkg:otp:20430/0xcdb28e93ed340ec10a71bba00a31dbfcf1bd5d37/396837 |
View on Explorer |
| Machine Learning | did:dkg:otp:20430/0xcdb28e93ed340ec10a71bba00a31dbfcf1bd5d37/396838 |
View on Explorer |
| Topic | UAL | Type |
|---|---|---|
| Artificial Intelligence | did:dkg:otp:20430/0xcdb28e93ed340ec10a71bba00a31dbfcf1bd5d37/396820 |
Public |
| Component | Address | Purpose |
|---|---|---|
| Publishing Wallet | 0x5918f2E01751C0A4523881268373D5aa31af |
Knowledge Asset publishing |
| Management Key | 0x04f148d838Bf4833F7a7D75b8bF34dbc63931290f |
DKG Node management operations |
| Operational Key | 0xD9DbE8d260Ba74187074C0C358958082Ac8663a0 |
DKG Node operational tasks |
| x402 Facilitator | 0xe062014f6cdd8802654509885229e98878a8a48e |
Payment settlement wallet |
Main Plugin Folder: packages/plugin-neriamind-encyclopedia-compare/
This folder contains the core implementation of the NeriaMind plugin:
- ✅ 14 MCP tools (
src/index.ts- 1,461 lines) - ✅ Wikipedia/Grokipedia fetchers (
src/fetchers/) - ✅ AI-powered comparison engine (
src/analysis/) - ✅ x402 payment protocol (
src/x402/) - Self-hosted facilitator - ✅ Trust layer (
apps/agent/src/server/facilitatorPlugin.ts) - Staking + metrics - ✅ 8 curated topics (
src/topics/curated-topics.ts) - ✅ Truth note builders (
src/notes/)
Plugin Documentation: Complete Plugin README
Screenshots: Visual proof of system available in screenshots/ folder
- Content Fetching:
neriamind-fetch-wikipedia,neriamind-fetch-grokopedia - Analysis:
neriamind-compare-encyclopedia - Truth Notes:
neriamind-get-truth-note,neriamind-list-truth-notes - Topics:
neriamind-publish-designated-topics,neriamind-fetch-designated-topics,neriamind-process-designated-topics,neriamind-fetch-topic-assets - DKG Queries:
neriamind-query-dkg,neriamind-search-topics - Trust Layer:
neriamind-pay-truth-note,neriamind-stake-truth-note,neriamind-trust-summary
Plugin (/neriamind/*):
POST /compare,GET /truth-note,POST /designated-topics/publish,GET /designated-topics,POST /payments/x402/pay,GET /payments/x402/status,GET /trust/stakes
Trust Layer (Root):
GET /truth-note?ual={ual},GET /facilitator/supported,POST /facilitator/verify,POST /facilitator/settle,POST /trust/stake,GET /trust/stakes?ual={ual},GET /trust/metrics?ual={ual}
Complete API documentation: MCP_API_GUIDE.md
# Test Wikipedia fetching
curl -X POST http://localhost:9200/neriamind/compare \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"topic":"Quantum_computing","publish":false}'
# Test x402 flow
curl http://localhost:9200/facilitator/supported
curl http://localhost:9200/truth-note?ual=premium-ual
# Test staking
curl -X POST http://localhost:9200/trust/stake \
-H "Content-Type: application/json" \
-d '{"ual":"test","amount":100,"token":"TRAC"}'
# Check metrics
curl http://localhost:9200/trust/metrics?ual=test- Login: http://localhost:9200 (admin@example.com / admin123)
- Publish topics: Use
neriamind-publish-designated-topicstool - Compare: Use
neriamind-compare-encyclopediatool - Check metrics: Use
neriamind-trust-summarytool
npm run drizzle:studio
# Opens https://local.drizzle.studio# Create new user
cd apps/agent
npm run script:createUser
# Create API token
npm run script:createToken# Add to specific package
cd packages/your-package
npm install --save package-name
# Add to app
cd apps/agent
npm install --save package-namenpm run build # Build all packages
npm run build:web # Build web app
npm run build:server # Build server# Start all DKG services
dkg-cli start
# Start MCP server
cd apps/agent
NODE_ENV=production node dist/index.jsx402 not working?
# Check facilitator key is set
grep FACILITATOR_PRIVATE_KEY apps/agent/.env
# Check facilitator wallet has NEURO
# Use NeuroWeb explorer: https://neuroweb-testnet.subscan.io/Truth note publishing fails?
# Check publishing wallet has TRAC + NEURO
dkg-cli status
# Check DKG Engine is running
curl http://localhost:8900/infoMCP tools not appearing?
# Rebuild server
cd apps/agent
npm run build:server
# Restart agent
dkg-cli restart dkg-agent# Full reset (nuclear option)
rm -rf node_modules package-lock.json
rm -rf apps/agent/node_modules
rm -rf packages/*/node_modules
npm install
npm run build
dkg-cli restart- ARCHITECTURE.md - Detailed 3-layer system design
- MCP_API_GUIDE.md - Complete tool and API reference
- Plugin README - Plugin-specific docs
| Resource | Link |
|---|---|
| OriginTrail DKG | https://docs.origintrail.io |
| Model Context Protocol | https://modelcontextprotocol.io |
| NeuroWeb | https://neuroweb.ai |
| Polkadot | https://polkadot.network |
| x402 Protocol | https://github.com/coinbase/x402 |
- Follow the existing code structure
- Use
turbo genfor new packages/apps - Run
turbo format check-types lint buildbefore committing - Follow the established patterns in existing plugins
This project is part of the DKG ecosystem. See individual package licenses for details.
- Samuel Danso - Full Stack AI/Blockchain Engineer –
me.samueldanso@gmail.com
Built for: OriginTrail × Polkadot × Umanitek Global Hackathon 2025