docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,211 @@
|
||||
---
|
||||
id: wiki-2026-0508-web3-and-ai-integration
|
||||
title: Web3 and AI Integration
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Web3 AI, On-chain AI, Decentralized AI]
|
||||
duplicate_of: none
|
||||
source_trust_level: B
|
||||
confidence_score: 0.75
|
||||
verification_status: applied
|
||||
tags: [web3, blockchain, ai, decentralized, agents, zkml]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: Solidity/TypeScript/Rust
|
||||
framework: ethers.js/viem/Ritual/Bittensor
|
||||
---
|
||||
|
||||
# Web3 and AI Integration
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 trustless inference + tokenized compute — 매 AI model 을 chain 에서 verify 하거나 incentivize"**. 2024-2025 의 Bittensor (TAO), Ritual, Gensyn, ORA, Modulus Labs 등이 매 zkML / opML / federated training 으로 매 "오프체인 inference, 온체인 commitment" pattern 을 정립. 2026 현재 매 hype cycle 진정 후 매 narrow viable use case (decentralized inference market, model provenance, agent payments) 로 수렴.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 통합 categories
|
||||
- **zkML (zero-knowledge ML)**: 매 inference proof 를 chain 에 verify — Modulus, EZKL, Giza. 매 작은 모델 (LeNet급) 만 currently feasible.
|
||||
- **opML (optimistic ML)**: 매 fraud-proof — challenger 가 incorrect inference 발견 시 dispute. ORA, Hyperbolic.
|
||||
- **Decentralized inference market**: GPU operator → user 매 token 결제 — Akash, io.net, Bittensor subnets.
|
||||
- **Decentralized training**: 매 federated SGD with on-chain coordination — Gensyn, Prime Intellect (INTELLECT-1, 10B model 2024).
|
||||
- **AI agent payments**: 매 agent ↔ agent micropayment — x402 (HTTP 402 + stablecoin), Coinbase AgentKit, Skyfire.
|
||||
- **On-chain randomness/oracle**: 매 LLM-as-oracle for off-chain data — Chainlink Functions + LLM.
|
||||
|
||||
### 매 왜 hard
|
||||
1. **Determinism**: GPU floating-point 매 non-deterministic across hardware → matching hash 보장 어려움. 매 fixed-point quantize 우회.
|
||||
2. **Cost**: zkSNARK proof 매 model size 비례 expensive — GPT급 model 매 하루 단위 prove time.
|
||||
3. **Bandwidth**: 매 federated training 매 gradient sync — 매 ~GB/s 필요, 매 P2P 어려움.
|
||||
4. **Sybil**: 매 incentive layer 가 cheap fake worker 매 양산 — staking / slashing 필요.
|
||||
|
||||
### 매 응용
|
||||
1. AI 모델 provenance (model weights hash → IPFS → on-chain registry).
|
||||
2. Pay-per-inference API (no API key, x402 stablecoin tip).
|
||||
3. DAO-governed model alignment / RLHF crowdsourcing.
|
||||
4. Verifiable AI judging (game outcome, auction).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### 1. x402 — agent-to-agent micropayment
|
||||
```typescript
|
||||
// Server (LLM API behind paywall)
|
||||
import express from "express";
|
||||
import { paymentMiddleware } from "x402-express";
|
||||
|
||||
const app = express();
|
||||
app.use("/inference", paymentMiddleware({
|
||||
amount: "0.005", // USDC
|
||||
recipient: "0xYourAddress",
|
||||
network: "base",
|
||||
}));
|
||||
app.post("/inference", async (req, res) => {
|
||||
const out = await llm(req.body.prompt);
|
||||
res.json({ output: out });
|
||||
});
|
||||
|
||||
// Client (agent)
|
||||
import { fetchWithPayment } from "x402-fetch";
|
||||
const response = await fetchWithPayment(
|
||||
"https://api.example.com/inference",
|
||||
{ method: "POST", body: JSON.stringify({ prompt: "..." }) },
|
||||
{ wallet: agentWallet },
|
||||
);
|
||||
```
|
||||
|
||||
### 2. zkML inference proof (EZKL)
|
||||
```python
|
||||
# Compile a small CNN to a zk circuit, prove inference
|
||||
import ezkl
|
||||
|
||||
# 1. Export ONNX
|
||||
torch.onnx.export(model, dummy_input, "model.onnx")
|
||||
|
||||
# 2. Generate settings + circuit
|
||||
ezkl.gen_settings("model.onnx", "settings.json")
|
||||
ezkl.calibrate_settings("model.onnx", "input.json", "settings.json")
|
||||
ezkl.compile_circuit("model.onnx", "model.ezkl", "settings.json")
|
||||
|
||||
# 3. Setup (one-time)
|
||||
ezkl.setup("model.ezkl", "vk.key", "pk.key")
|
||||
|
||||
# 4. Prove
|
||||
ezkl.gen_witness("input.json", "model.ezkl", "witness.json")
|
||||
ezkl.prove("witness.json", "model.ezkl", "pk.key", "proof.json")
|
||||
|
||||
# 5. Verify (on-chain via Solidity verifier)
|
||||
ezkl.create_evm_verifier("vk.key", "settings.json", "Verifier.sol")
|
||||
```
|
||||
|
||||
### 3. On-chain inference verification (Solidity)
|
||||
```solidity
|
||||
// Verifier.sol — auto-generated by EZKL
|
||||
contract InferenceOracle {
|
||||
Verifier public immutable verifier;
|
||||
mapping(bytes32 => bool) public verifiedClaims;
|
||||
|
||||
function submitInference(
|
||||
bytes calldata proof,
|
||||
uint256[] calldata publicInputs
|
||||
) external {
|
||||
require(verifier.verify(proof, publicInputs), "Invalid proof");
|
||||
bytes32 claim = keccak256(abi.encode(publicInputs));
|
||||
verifiedClaims[claim] = true;
|
||||
emit InferenceVerified(msg.sender, claim);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Bittensor subnet validator (Python)
|
||||
```python
|
||||
# Validator scores miners' LLM completions
|
||||
import bittensor as bt
|
||||
|
||||
class MyValidator(bt.Validator):
|
||||
async def forward(self, prompt: str):
|
||||
# Query top miners
|
||||
responses = await self.dendrite(
|
||||
axons=self.metagraph.axons[:32],
|
||||
synapse=Completion(prompt=prompt),
|
||||
timeout=12,
|
||||
)
|
||||
# Score (e.g., reward model)
|
||||
scores = [self.reward_model(prompt, r.completion) for r in responses]
|
||||
# Set weights — TAO emission to top performers
|
||||
self.subtensor.set_weights(
|
||||
netuid=self.config.netuid,
|
||||
uids=self.metagraph.uids,
|
||||
weights=normalize(scores),
|
||||
)
|
||||
```
|
||||
|
||||
### 5. Decentralized model registry (IPFS + chain)
|
||||
```typescript
|
||||
import { create } from "ipfs-http-client";
|
||||
import { ethers } from "ethers";
|
||||
|
||||
const ipfs = create({ url: "https://ipfs.io" });
|
||||
const { cid } = await ipfs.add(modelWeightsBuffer);
|
||||
|
||||
const registry = new ethers.Contract(REGISTRY_ADDR, ABI, signer);
|
||||
await registry.publishModel(
|
||||
cid.toString(),
|
||||
ethers.id("llama-3.1-8b-myft-v2"),
|
||||
{ name: "MyFT", license: "Apache-2.0", params: 8_000_000_000 },
|
||||
);
|
||||
```
|
||||
|
||||
### 6. Optimistic ML challenge (opML pattern)
|
||||
```solidity
|
||||
contract OPMLDispute {
|
||||
struct Claim { bytes32 inputHash; bytes32 outputHash; uint256 stake; }
|
||||
mapping(uint256 => Claim) public claims;
|
||||
uint256 public constant CHALLENGE_PERIOD = 7 days;
|
||||
|
||||
function challenge(uint256 claimId, bytes calldata fraudProof) external {
|
||||
Claim memory c = claims[claimId];
|
||||
require(block.timestamp < c.timestamp + CHALLENGE_PERIOD);
|
||||
// Verify fraud proof off-chain via interactive game
|
||||
require(verifyFraud(c, fraudProof), "No fraud");
|
||||
// Slash original asserter
|
||||
payable(msg.sender).transfer(c.stake);
|
||||
delete claims[claimId];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 매 small model (< 1M param) verifiable inference | zkML (EZKL, Risc Zero) |
|
||||
| 매 large LLM verifiable inference | opML (ORA) — fraud-proof, 1주일 challenge |
|
||||
| 매 GPU cost reduction | Akash / io.net — 매 cloud 대비 50-70% 저렴 |
|
||||
| 매 agent micropayment | x402 + Base / Solana — 매 sub-cent fee |
|
||||
| 매 model provenance / licensing | IPFS + EVM registry |
|
||||
| 매 RLHF crowdsource | DAO + token incentive (실용성 questionable) |
|
||||
|
||||
**기본값**: 매 매 use case 명확히 한 후 fit 확인. 매 "blockchain because hype" 매 anti-pattern.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Web3]] · [[Decentralized AI]]
|
||||
- 변형: [[Federated Learning]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 trustless inference verification 매 진짜 필요 (high-value oracle, regulated AI). 매 cross-org cost-sharing GPU.
|
||||
**언제 X**: 매 단순 SaaS 수준 use case 는 centralized API (OpenAI/Anthropic) 가 매 압도적으로 효율적. 매 zkML latency overhead 1000x+.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Hype-driven 통합**: 매 "AI + blockchain" buzzword 합성 — 매 actual user value 없는 token launch.
|
||||
- **Floating-point determinism 가정**: 매 GPU 별 NaN/edge case 차이로 매 hash mismatch.
|
||||
- **Large model zkML**: 매 GPT-4급 zkML 매 currently economically infeasible (proof time 며칠+).
|
||||
- **No slashing**: 매 staking 만 있고 slashing 없으면 매 sybil farm 매 inevitable.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Bittensor whitepaper, EZKL docs, x402 spec, Modulus Labs RockyBot demo).
|
||||
- 신뢰도 B (매 빠르게 변하는 영역, 매 일부 protocol 매 production-grade 미달).
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — zkML/opML/x402/Bittensor 통합 patterns + 2026 perspective |
|
||||
Reference in New Issue
Block a user