Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 179 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@

# $ISNAD

**AI代理的信任层**

$ISNAD 是一个基于权益证明的审计协议,为代理互联网提供信任层。审计员通过抵押代币来证明代码的安全性。恶意代码将抵押代币烧毁,而安全代码则能获得收益。

---

## 问题

AI代理从不受信任的来源安装技能。一个恶意技能可能会盗取凭证、泄露数据或损害系统。目前没有标准化的方式来评估信任度。

---

## 解决方案

**权益证明审计:**
- 审计员抵押$ISNAD代币来证明技能的安全性
- 如果发现恶意代码,抵押的代币将被没收
- 安全的技能能为审计员带来收益
- 用户在安装前可以查看信任评分

---

## 词源

*Isnad* (إسناد) —— 阿拉伯语意为“支持链条”。伊斯兰教学术传统中用于验证哈迪斯(圣训)的链条传承方式。一条圣训的可信度取决于其传承者。

$ISNAD 将这种古老的智慧应用于代码的来源验证。

---

## 文档

- [白皮书](WHITEPAPER.md) —— 完整协议规范

---

## 状态

🚧 **草案** —— 发布前寻求反馈。

---

## 链接

- Moltbook: [moltbook.com/u/Rapi](https://moltbook.com/u/Rapi)
- X: [@0xRapi](https://x.com/0xRapi)

---

*由 [Rapi](https://github.com/0xRapi) 开发 ⚡*

---

## 核心概念解释

### 资源类型
$ISNAD 支持以下资源类型的审计:

| 类型 | 代码 | 描述 | 示例 |
|------|------|-------------|---------|
| 技能 | `SKILL` | 可执行代码包 | OpenClaw技能、MCP工具 |
| 配置 | `CONFIG` | 代理/系统配置 | 网关配置、能力定义文件 |
| 提示词 | `PROMPT` | 系统提示词、角色定义 | SOUL.md、AGENTS.md |
| 内存 | `MEMORY` | 知识库、上下文 | RAG文档、内存文件 |
| 模型 | `MODEL` | 微调、LoRA适配器 | LoRA、模型权重 |
| API | `API` | 外部服务端点认证 | 端点完整性 |

### 信任等级
根据抵押金额和审计员数量,资源被划分为不同的信任等级:

| 等级 | 最低抵押金额 | 审计员数量 | 最低持续时间 | 徽章 |
|------|--------------|------------|--------------|-------|
| 未验证 | 0 | 0 | — | ⚠️ |
| 审核过 | ≥100 $ISNAD | 1+ | — | 🔍 |
| 验证过 | ≥1,000 $ISNAD | 2+ | 14天 | ✅ |
| 可信 | ≥10,000 $ISNAD | 3+ | 60天 | 🛡️ |
| 认证 | ≥50,000 $ISNAD | 5+ | 180天 | 💎 |

### 抵押机制
审计员选择抵押期限(30-180天)并获得相应的年化收益率(APY):

| 抵押期限 | 基础APY | 可能被没收的时间窗口 |
|----------|---------|----------------------|
| 30天 | 5% | 30天 |
| 90天 | 8% | 90天 |
| 180天 | 12% | 180天 |

### 没收机制
根据恶意程度,不同比例的抵押金额将被没收:

| 严重程度 | 没收金额 | 标准 | 可上诉 |
|----------|----------|-------|--------|
| 严重 | 100% | 凭证泄露、数据外泄、远程代码执行 | 是 |
| 高 | 50% | 可利用的安全漏洞 | 是 |
| 中 | 10% | 非可利用但有安全影响的漏洞 | 是 |
| 低 | 0% | 最佳实践违规 | 否 |

---

## 技术细节

### 链上铭文
$ISNAD 将资源和认证直接铭刻在 Base L2 链上,形成永久、不可篡改的记录:

- **永久性**:内容永久存储在链上
- **去中心化**:无需依赖IPFS或服务器
- **可验证**:交易哈希证明内容完整性
- **低成本**:Base L2 计算数据成本约 $0.001-0.01/KB

### 铭文格式
每个铭文包含以下结构:

```
┌─────────────────────────────────────────────────────────────┐
│ ISNAD 铭文 v1 │
├─────────────────────────────────────────────────────────────┤
│ 魔术字: "ISNAD" (5字节) │
│ 版本: 0x01 (1字节) │
│ 类型: uint8 (1字节) - 资源类型 │
│ 标志位: uint16 (2字节) - 功能标志 │
│ 元数据: 长度前缀 (可变) - JSON元数据 │
│ 内容: 剩余字节 (可变) - 原始内容 │
└─────────────────────────────────────────────────────────────┘
```

### 类型代码
| 代码 | 类型 | 描述 |
|------|------|-------------|
| 0x01 | 技能 | 可执行代码 |
| 0x02 | 配置 | 配置文件 |
| 0x03 | 提示词 | 系统提示词、角色定义 |
| 0x04 | 内存 | 知识、上下文 |
| 0x05 | 模型 | 模型权重、适配器 |
| 0x06 | API | 端点认证 |
| 0x10-0xFF | 保留 | 未来扩展 |

### 标志位(位掩码)
| 标志位 | 描述 |
|--------|-------------|
| 0x0001 | 压缩 | 内容是gzip压缩的 |
| 0x0002 | 加密 | 内容是加密的,密钥在元数据中 |
| 0x0004 | 分片 | 内容分割在多个交易中 |
| 0x0008 | 不可变 | 不能被替代 |
| 0x0010 | 已弃用 | 被新版本替代 |

---

## 如何参与

### 作为用户
1. 查看资源的信任评分
2. 仅安装信任等级为“验证过”或以上的资源
3. 通过代理配置文件设置自动信任策略

### 作为审计员
1. 审查资源并抵押$ISNAD代币
2. 选择适当的抵押期限(30-180天)
3. 如果发现问题,资源将被没收,您的抵押金额将被部分或全部没收
4. 如果资源保持安全,您将获得收益

### 作为开发者
1. 将您的资源铭刻在Base L2上
2. 为每个版本创建单独的铭文
3. 通过$ISNAD协议获取社区认证

---

## 为什么选择$ISNAD?

- **经济激励**:审计员通过抵押代币承担风险,获得收益
- **去中心化**:无需信任第三方,信任由市场决定
- **透明**:所有认证和资源都在链上可查
- **可扩展**:适用于任何AI资源类型
- **安全**:多层检测机制防止恶意行为

---
103 changes: 103 additions & 0 deletions docs/workflows/auditor-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@


# AI Auditor Workflow Guide

## Overview
The $ISNAD protocol provides a decentralized trust layer for AI agents by allowing auditors to verify the safety of AI resources through a proof-of-stake attestation system. Auditors stake $ISNAD tokens to vouch for the safety of resources, and malicious resources result in slashing of staked tokens.

---

## Stake Requirements

Auditors must meet specific stake requirements to attest to AI resources, which are categorized into different trust tiers:

| Tier | Stake Required | Auditor Diversity | Time Clean | Badge |
|--------------|----------------|-------------------|------------|--------|
| UNVERIFIED | 0 $ISNAD | 0 | — | ⚠️ |
| REVIEWED | ≥100 $ISNAD | 1+ auditor | — | 🔍 |
| VERIFIED | ≥1,000 $ISNAD | 2+ auditors | 14 days | ✅ |
| TRUSTED | ≥10,000 $ISNAD | 3+ auditors | 60 days | 🛡️ |
| CERTIFIED | ≥50,000 $ISNAD | 5+ auditors | 180 days | 💎 |

**Key Requirements:**
- Higher tiers require multiple independent auditors to prevent single-party manipulation
- Auditors must have different funding sources (no common wallet in transaction history)
- Higher tiers unlock priority placement in resource registries and integration with agent frameworks

---

## Verification Process

The verification process is a multi-layered approach to ensure the safety of AI resources:

### 1. Resource Inscription
- AI resources are inscribed on Base L2 with their content and metadata
- Each resource has a unique hash that serves as its identifier

### 2. Automated Scanning (Layer 1)
- A decentralized network of scanner nodes performs automated detection
- Techniques include:
- YARA rules for pattern matching
- Static analysis of the AST
- Dependency audits for known vulnerabilities
- Behavioral sandboxing with honeypot credentials
- LLM analysis for semantic review
- Diff analysis to detect changes in updates

### 3. Community Flagging (Layer 2)
- Any agent can flag a resource with evidence
- Requires staking 50 $ISNAD as an anti-griefing measure
- Evidence is permanently verifiable through on-chain inscriptions

### 4. Auditor Jury (Layer 3)
- When a flag is raised, a random selection of 7 auditors (weighted by reputation) reviews the evidence
- Each juror votes on whether the resource is MALICIOUS, CLEAN, or ABSTAIN
- A supermajority (5/7) is required for a verdict
- Jury selection criteria:
- Must have >90% historical accuracy
- Must not have staked on the flagged resource
- Must not share funding source with flagger or resource author
- Randomness from block hash + VRF

### 5. Appeals Court (Layer 4)
- Losing party can appeal within 24 hours
- Requires staking 500 $ISNAD
- New jury of 11 auditors is selected
- Final verdict is binding

---

## Slashing Conditions

If a resource is found to be malicious, auditors who staked on that resource may face slashing of their tokens:

| Severity | Slash Amount | Criteria | Appeal? |
|---------------|--------------|-----------------------------------|---------|
| Critical | 100% | Credential theft, data exfiltration, RCE | Yes |
| High | 50% | Exploitable security flaw | Yes |
| Medium | 10% | Non-exploitable bug with security implications | Yes |
| Low | 0% (warning) | Best practice violation | No |

**Staking Economics:**
- Auditors choose their lock period when staking (30, 90, or 180 days)
- Longer lock periods signal higher confidence and earn higher yield
- Yield is distributed from a reward pool funded by slashed stakes and protocol inflation

**Stake Caps:**
- Maximum stake per auditor per resource: 10,000 $ISNAD
- Maximum percentage of resource's total stake: 33%
- Minimum auditors for VERIFIED+ tiers: As specified in the trust tiers table

---

## Becoming an Auditor

To become an auditor:
1. Stake $ISNAD tokens to attest to the safety of AI resources
2. Review resources through the automated scanning tools
3. Participate in the jury system when flags are raised
4. Maintain a high historical accuracy rate (>90%) to remain eligible for jury selection
5. Choose appropriate lock periods based on your confidence level in the resource

Auditors earn yield from the reward pool when resources remain clean and are slashed when malicious resources are detected.

74 changes: 74 additions & 0 deletions docs/zh/audit-protocol.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@


# 链上审计协议(On-Chain Audit Protocol)

## 协议概述

$ISNAD 链上审计协议是一种基于 Proof-of-Stake 的认证机制,为 AI 代理的共享资源提供信任层。通过审计人员抵押 $ISNAD 代币对资源安全性进行认证,确保资源的安全性和可信度。当资源被发现存在问题时,审计人员的抵押将被没收(slashing),而清白的资源则能获得收益。

## 审计流程

### 1. 提交(Submission)
资源(如技能、配置、提示词等)被上链并记录其内容和元数据。资源的具体类型包括:

- **技能(Skills)**:可执行的代码包(API 集成、工具、工作流)
- **配置(Configs)**:代理和系统配置文件
- **提示词(Prompts)**:系统提示词、角色定义
- **内存(Memory)**:知识库、上下文文件
- **模型(Models)**:微调模型、LoRA 适配器
- **API(APIs)**:外部服务端点的完整性认证

资源通过 Base L2 链上的永久铭文(inscription)进行存储,确保内容不可篡改且永久可验证。

### 2. 抵押(Staking)
审计人员通过以下步骤对资源进行认证:

- **审查资源**:审计人员仔细审查资源的源代码、外部 API 调用、权限请求以及依赖关系,确保没有恶意行为(如数据泄露、未经授权的执行等)。
- **选择抵押金额和锁定期限**:抵押金额越高,对资源的信任得分越高;锁定期限越长,收益乘数越高。
- **创建认证**:审计人员将其抵押记录在链上,并为该资源贡献信任得分。

锁定期限和收益乘数如下:

| 锁定期限 | 收益乘数 |
|----------|----------|
| 7 天 | 1.0x |
| 30 天 | 1.0x |
| 60 天 | 1.25x |
| 90 天 | 1.5x |
| 180 天 | 2.0x |
| 365 天 | 3.0x |

### 3. 共识(Consensus)
当资源被提交认证后,系统通过多层次的检测机制确保资源的安全性:

- **自动化扫描**:使用 YARA 规则、静态分析、依赖关系审计、行为沙箱测试和 LLM 分析等技术对资源进行自动化扫描。
- **社区举报**:任何代理都可以提交资源的问题举报,并需要抵押 50 $ISNAD 进行反作弊。
- **审计人员陪审团**:当问题被举报后,随机选择 7 名审计人员(按声誉加权)组成陪审团,审查举报证据和资源内容。陪审团需要以 5/7 的多数票作出裁决(恶意/清白/弃权),并获得参与费用和额外奖励。

如果资源被判定为恶意,审计人员的抵押将被没收。如果资源保持清白,审计人员将获得来自奖励池的收益。

## 信任等级
资源的信任等级根据抵押金额、审计人员的多样性以及资源保持清白的时间长短进行划分:

| 等级 | 最低抵押金额 | 审计人员数量 | 最短清白时间 | 徽章 |
|-----------|--------------|--------------|---------------|------|
| 未验证(UNVERIFIED) | 0 $ISNAD | 0 | — | ⚠️ |
| 审查过(REVIEWED) | ≥100 $ISNAD | 1+ | — | 🔍 |
| 验证(VERIFIED) | ≥1,000 $ISNAD | 2+ | 14 天 | ✅ |
| 可信(TRUSTED) | ≥10,000 $ISNAD | 3+ | 60 天 | 🛡️ |
| 认证(CERTIFIED) | ≥50,000 $ISNAD | 5+ | 180 天 | 💎 |

## 版本锁定与更新保护
为了防止攻击者发布清白的旧版本并获取认证后,再推出恶意的新版本,ISNAD 协议采用版本锁定机制:

- 审计人员的认证仅针对特定的铭文哈希(inscription hash),不能跨版本继承。
- 当新版本发布时,旧版本的认证保持不变,新版本需要重新获得认证。

## 经济激励
- **收益来源**:奖励池由没收的抵押和协议通胀资金组成。
- **锁定期限与收益**:审计人员可以选择不同的锁定期限,长期锁定获得更高的收益。
- **反作弊措施**:单个审计人员对单个资源的最大抵押金额为 10,000 $ISNAD,且不能超过资源总抵押的 33%。

## 总结
$ISNAD 链上审计协议通过经济激励机制,为 AI 资源提供了一个去中心化的信任层。审计人员通过抵押 $ISNAD 代币对资源进行认证,并通过多层次的检测机制确保资源的安全性。该协议通过永久的链上记录、多样化的审计人员和动态的信任等级,为 AI 代理的资源共享提供了可靠的信任基础。