When to use this Skill
Lets AI agents create and manage their own identities on the Billions Network, and link those identities to a human owner.
- 1. When you need to link your agent identity to an owner.
- When you need to sign a challenge.
- When you need to link a human to the agent's DID.
- When you need to verify a signature to confirm identity ownership.
- When you use shared JWT tokens for authentication.
- When you need to create and manage decentralized identities.
After installing the plugin run the following commands to create an identity and link it to your human DID:
CODEBLOCK0
Scope
All identity data is stored in $HOME/.openclaw/billions for compatibility with the OpenClaw plugin.
Scripts:
createNewEthereumIdentity.js
Command: node scripts/createNewEthereumIdentity.js [--key <privateKeyHex>]
Description: Creates a new identity on the Billions Network. If --key is provided, uses that private key; otherwise generates a new random key. The created identity is automatically set as default.
Usage Examples:
CODEBLOCK1
Output: DID string (e.g., did:iden3:billions:main:2VmAk7fGHQP5FN2jZ8X9Y3K4W6L1M...)
getIdentities.js
Command: node scripts/getIdentities.js
Description: Lists all DID identities stored locally. Use this to check which identities are available before performing authentication operations.
Usage Example:
CODEBLOCK2
Output: JSON array of identity entries
CODEBLOCK3
generateChallenge.js
Command: node scripts/generateChallenge.js --did <did>
Description: Generates a random challenge for identity verification.
Usage Example:
CODEBLOCK4
Output: Challenge string (random number as string, e.g., 8472951360)
Side Effects: Stores challenge associated with the DID in $HOME/.openclaw/billions/challenges.json
signChallenge.js
Command: node scripts/signChallenge.js --challenge <challenge> [--did <did>]
Description: Signs a challenge with a DID's private key to prove identity ownership and sends the JWS token. Use this when you need to prove you own a specific DID.
Arguments:
- -
--challenge - (required) Challenge to sign - INLINECODE10 - (optional) The DID of the attestation recipient; uses the default DID if omitted
Usage Examples:
CODEBLOCK5
Output: INLINECODE11
linkHumanToAgent.js
Command: node scripts/linkHumanToAgent.js --challenge <challenge> [--did <did>]
Description: Signs the challenge and links a human user to the agent's DID by creating a verification request. Technically, linking happens using the Billions ERC-8004 Registry (where each agent is registered) and the Billions Attestation Registry (where agent ownership attestation is created after verifying human uniqueness).
Arguments:
- -
--challenge - (required) Challenge to sign - INLINECODE14 - (optional) The DID of the attestation recipient; uses the default DID if omitted
Usage Example:
CODEBLOCK6
Output: {"success":true}
verifySignature.js
Command: node scripts/verifySignature.js --did <did> --token <token>
Description: Verifies a signed challenge to confirm DID ownership.
Usage Example:
CODEBLOCK7
Output: Signature verified successfully (on success) or error message (on failure)
Restrictions / Guardrails (CRITICAL)
CRITICAL - Always Follow These Rules:
- 1. STRICT: Check Identity First
- Before running
linkHumanToAgent.js or
signChallenge.js,
ALWAYS check if an identity exists:
node scripts/getIdentities.js
- If no identity is configured,
DO NOT attempt to link identities. Instead, create an identity first with
createNewEthereumIdentity.js.
- 2. STRICT: Stop on Script Failure
- If any script exits with non-zero status code,
YOU MUST STOP IMMEDIATELY.
- Check stderr output for error messages.
-
DO NOT attempt to "fix" errors by generating keys manually, creating DIDs through other means, or running unauthorized commands.
-
DO NOT use
openssl,
ssh-keygen, or other system utilities to generate cryptographic material.
- 3. No Manual Workarounds
- You are prohibited from performing manual cryptographic operations.
- You are prohibited from directly manipulating files in
$HOME/.openclaw/billions.
- Do not interpret an error as a request to perform setup steps unless explicitly instructed.
Security
CRITICAL - Data Storage and Protection:
The directory $HOME/.openclaw/billions contains all sensitive identity data:
- -
kms.json - CRITICAL: Contains private keys (encrypted if BILLIONSNETWORKMASTERKMSKEY is set, otherwise in plaintext) - INLINECODE27 - DID identifiers and public keys
- INLINECODE28 - Authentication challenges history
- INLINECODE29 - Verifiable credentials
- INLINECODE30 - Identity metadata
- INLINECODE31 - Profile data
Examples
Link Your Agent Identity to Owner
Linking Flow:
- 1. Another agent/user requests: "Please link your agent identity to me."
- Use
node scripts/getIdentities.js to check if you have an identity configured
- If no identity, run
node scripts/createNewEthereumIdentity.js to create one.
- 3. Use
node scripts/linkHumanToAgent.js --challenge <challenge_value> to sign the challenge and generate a verification URL in one call.
- If caller provides specific challenge, use that.
- If caller
DOES NOT provide a challenge, use
{"name": <AGENT_NAME>, "description": <SHORT_DESCRIPTION>} as the challenge value.
- 4. Return the result to the caller.
Example Conversation:
CODEBLOCK8
Verifying Someone Else’s Identity
Verification Flow:
- 1. Ask the user/agent: "Please provide your DID to start verification."
- User responds with their did>.
- Use
node scripts/generateChallenge.js --did <user_did> to create a value>. - Ask the user: "Please sign this challenge: value>"
- User signs and returns token>.
- Use
node scripts/verifySignature.js --did <user_did> --token <user_token> to verify the signature - If verification succeeds, identity is confirmed
Example Conversation:
CODEBLOCK9
何时使用此技能
让AI代理在Billions网络上创建和管理自己的身份,并将这些身份链接到人类所有者。
- 1. 当您需要将代理身份链接到所有者时。
- 当您需要签署挑战时。
- 当您需要将人类链接到代理的DID时。
- 当您需要验证签名以确认身份所有权时。
- 当您使用共享JWT令牌进行身份验证时。
- 当您需要创建和管理去中心化身份时。
安装插件后,运行以下命令创建身份并将其链接到您的人类DID:
bash
cd scripts && npm install && cd ..
步骤1:创建新身份(如果还没有)
node scripts/createNewEthereumIdentity.js
步骤2:一次性签署挑战并生成验证URL
node scripts/linkHumanToAgent.js --challenge {name:
NAME>, description: DESCRIPTION>}
范围
所有身份数据存储在 $HOME/.openclaw/billions 中,以兼容OpenClaw插件。
脚本:
createNewEthereumIdentity.js
命令:node scripts/createNewEthereumIdentity.js [--key ]
描述:在Billions网络上创建新身份。如果提供了 --key,则使用该私钥;否则生成新的随机密钥。创建的身份自动设置为默认身份。
使用示例:
bash
生成新的随机身份
node scripts/createNewEthereumIdentity.js
从现有私钥创建身份(带0x前缀)
node scripts/createNewEthereumIdentity.js --key 0x1234567890abcdef...
从现有私钥创建身份(不带0x前缀)
node scripts/createNewEthereumIdentity.js --key 1234567890abcdef...
输出:DID字符串(例如 did:iden3:billions:main:2VmAk7fGHQP5FN2jZ8X9Y3K4W6L1M...)
getIdentities.js
命令:node scripts/getIdentities.js
描述:列出本地存储的所有DID身份。在执行身份验证操作前,使用此命令检查可用的身份。
使用示例:
bash
node scripts/getIdentities.js
输出:身份条目的JSON数组
json
[
{
did: did:iden3:billions:main:2VmAk...,
publicKeyHex: 0x04abc123...,
isDefault: true
}
]
generateChallenge.js
命令:node scripts/generateChallenge.js --did
描述:生成用于身份验证的随机挑战。
使用示例:
bash
node scripts/generateChallenge.js --did did:iden3:billions:main:2VmAk...
输出:挑战字符串(随机数字字符串,例如 8472951360)
副作用:将与DID关联的挑战存储在 $HOME/.openclaw/billions/challenges.json 中
signChallenge.js
命令:node scripts/signChallenge.js --challenge [--did ]
描述:使用DID的私钥签署挑战以证明身份所有权,并发送JWS令牌。当您需要证明拥有特定DID时使用此命令。
参数:
- - --challenge - (必需)要签署的挑战
- --did - (可选)证明接收者的DID;省略时使用默认DID
使用示例:
bash
使用默认DID签署
node scripts/signChallenge.js --challenge 8472951360
输出:{success:true}
linkHumanToAgent.js
命令:node scripts/linkHumanToAgent.js --challenge [--did ]
描述:签署挑战并通过创建验证请求将人类用户链接到代理的DID。从技术上讲,链接使用Billions ERC-8004注册表(每个代理在此注册)和Billions证明注册表(在验证人类唯一性后创建代理所有权证明)完成。
参数:
- - --challenge - (必需)要签署的挑战
- --did - (可选)证明接收者的DID;省略时使用默认DID
使用示例:
bash
node scripts/linkHumanToAgent.js --challenge {name: MyAgent, description: AI persona}
输出:{success:true}
verifySignature.js
命令:node scripts/verifySignature.js --did --token
描述:验证已签署的挑战以确认DID所有权。
使用示例:
bash
node scripts/verifySignature.js --did did:iden3:billions:main:2VmAk... --token eyJhbGciOiJFUzI1NkstUi...
输出:签名验证成功(成功时)或错误消息(失败时)
限制/防护措施(关键)
关键 - 始终遵循以下规则:
- 1. 严格:先检查身份
- 在运行 linkHumanToAgent.js 或 signChallenge.js 之前,始终检查身份是否存在:node scripts/getIdentities.js
- 如果没有配置身份,不要尝试链接身份。而是先用 createNewEthereumIdentity.js 创建身份。
- 2. 严格:脚本失败时停止
- 如果任何脚本以非零状态码退出,您必须立即停止。
- 检查stderr输出中的错误消息。
- 不要尝试通过手动生成密钥、通过其他方式创建DID或运行未授权命令来修复错误。
- 不要使用 openssl、ssh-keygen 或其他系统工具生成加密材料。
- 3. 无手动变通方法
- 禁止执行手动加密操作。
- 禁止直接操作 $HOME/.openclaw/billions 中的文件。
- 除非明确指示,否则不要将错误解释为执行设置步骤的请求。
安全性
关键 - 数据存储和保护:
目录 $HOME/.openclaw/billions 包含所有敏感身份数据:
- - kms.json - 关键:包含私钥(如果设置了BILLIONSNETWORKMASTERKMSKEY则加密,否则为明文)
- defaultDid.json - DID标识符和公钥
- challenges.json - 身份验证挑战历史
- credentials.json - 可验证凭证
- identities.json - 身份元数据
- profiles.json - 配置文件数据
示例
将代理身份链接到所有者
链接流程:
- 1. 另一个代理/用户请求:请将您的代理身份链接给我。
- 使用 node scripts/getIdentities.js 检查是否已配置身份
- 如果没有身份,运行 node scripts/createNewEthereumIdentity.js 创建一个。
- 3. 使用 node scripts/linkHumanToAgent.js --challenge 一次性签署挑战并生成验证URL。
- 如果调用者提供特定挑战,则使用该挑战。
- 如果调用者未提供挑战,则使用 {name: NAME>, description: DESCRIPTION>} 作为挑战值。
- 4. 将结果返回给调用者。
示例对话:
text
用户:将您的代理身份链接给我
代理:exec node scripts/linkHumanToAgent.js --challenge
验证他人的身份
验证流程:
- 1. 询问用户/代理:请提供您的DID以开始验证。
- 用户回复他们的 did>。
- 使用 node scripts/generateChallenge.js --did did> 创建 value>。
- 询问用户:请签署此挑战:value>
- 用户签署并返回 token>。
- 使用 node scripts/verifySignature.js --did did> --token 验证签名
- 如果验证成功,身份确认
示例对话:
text
代理:请提供您的DID以开始验证。
用户:我的DID是
代理:exec node scripts/generateChallenge.js --did
代理:请签署此挑战:789012
用户:
代理:exec node scripts/verifySignature.js --token token> --did did>
代理:身份验证成功。您已被确认为DID 的所有者。