MolTrust 中文开发者指南
Chinese developer guide · API-Only mode for regulated markets
MolTrust 为每个自主 AI 代理提供可验证的 W3C 身份(DID)和密码学签名的权限凭证(VC)。纯API模式完全适用于中国、印度等区块链受限市场——无需区块链,无需VPN,无需USDC。
🦞 OpenClaw 用户:本文档专为"龙虾"用户设计。您的代理在两分钟内能上架200条商品——现在给它一个可验证的身份。
安装 cnpm 可用
所有 @moltrust/* 包均已在 npmmirror(淘宝镜像)同步,cnpm 安装速度更快。
# 推荐:cnpm(中国镜像,速度更快) cnpm install @moltrust/sdk @moltrust/openclaw # 或使用 npm(全球可用) npm install @moltrust/sdk @moltrust/openclaw # Python SDK pip install moltrust
配置 API-Only 模式 无区块链
API-Only 模式下,DID 注册和 VC 签发完全通过 MolTrust API 完成,不依赖任何区块链基础设施。安全保证不变——凭证由 MolTrust 根密钥密码学签名。
import { MolTrust } from '@moltrust/sdk'; const mt = new MolTrust({ apiKey: 'YOUR_API_KEY', // 从 moltrust.ch 获取 chainMode: 'api_only', // 无区块链依赖 region: 'cn' // 中国优化路由 });
from moltrust import MolTrust mt = MolTrust( api_key="YOUR_API_KEY", chain_mode="api_only", # 无区块链 region="cn" )
注册您的代理 🦞
每个代理获得一个全球唯一的 did:moltrust: 标识符和初始信任评分。
const agent = await mt.register({ name: '我的龙虾', type: 'ECommerceAgent', capabilities: ['product_listing', 'price_comparison'], operator: 'your-company' }); console.log(agent.did); // → did:moltrust:abc123... ✓ 身份已确认 console.log(agent.trustScore); // → { score: 70.0, tier: 'B', verified: true }
集成 OpenClaw
用 MolTrust 包装您的 OpenClaw 代理,为其添加可验证身份。
import { MolTrustOpenClaw } from '@moltrust/openclaw'; const trustedLobster = new MolTrustOpenClaw({ agent: myOpenClawAgent, did: agent.did, chainMode: 'api_only' }); await trustedLobster.run(); // 🦞 您的龙虾现在拥有可验证的身份
验证代理
任何一方均可验证代理身份——无需区块链访问,无需 API 密钥。
const result = await mt.verify('did:moltrust:abc123...'); // → { // valid: true, // trustScore: 82.5, // tier: 'A', // authorizedBy: 'your-company', // permissions: ['product_listing', 'price_comparison'] // }
配置参数
| 参数 | 类型 | 说明 |
|---|---|---|
| apiKey | string | 从 moltrust.ch 获取的 API 密钥 |
| chainMode | 'api_only' | 'full' | api_only:无区块链(中国/印度推荐)。full:含 Base L2 锚定 |
| region | 'cn' | 'eu' | 'us' | 优化 API 路由。中国用户使用 'cn' |
| endpoint | string | 可选。默认:https://api.moltrust.ch |
npm 包列表
| 包名 | 说明 | cnpm |
|---|---|---|
| @moltrust/sdk | 核心 SDK — DID/VC/信任评分 | ✓ |
| @moltrust/openclaw | OpenClaw 集成插件 | ✓ |
| @moltrust/aae | 代理授权信封(AAE) | ✓ |
| @moltrust/verify | 离线验证器(无需 API 密钥) | ✓ |
| @moltrust/x402 | x402 支付集成 | ✓ |
中国部署指南
以下要点确保您的部署在中国稳定运行。
1. 始终使用 api_only 模式 — Base L2 在中国不可用。
2. 使用 cnpm 安装 — npm 在中国可访问但速度较慢。cnpm 速度快且稳定。
3. 设置 region: 'cn' — 自动优化 API 路由。
4. 数据驻留 — 如需将代理数据存储在中国境内,请联系我们获取本地运营商合作方案。
5. CNY 计费 — 通过我们的新加坡/香港本地运营商合作伙伴提供人民币计费。
cnpm 镜像验证
所有 @moltrust/* 包均已在 npmmirror.com 同步:
# 验证包可用性 curl https://registry.npmmirror.com/@moltrust/sdk # → HTTP 200 ✓ # 安装(推荐) cnpm install @moltrust/sdk @moltrust/openclaw @moltrust/aae
寻找新加坡 / 香港分销合作伙伴
我们正在寻找基于新加坡或香港的合作伙伴,将 MolTrust 协议引入中国及东南亚市场。信任与关系优先,商业条款在签署 NDA 后披露。
hello@moltrust.ch · Revenue model disclosed after NDA