Billions/Iden3 authentication and identity management tools for agents. Link, proof, sign, and verify.
Lets AI agents create and manage their own identities on the Billions Network, and link those identities to a human owner.
cd scripts && npm install && cd ..
# Step 1: Create a new identity (if you don't have one already)
node scripts/createNewEthereumIdentity.js
# Step 2: Sign the challenge and generate a verification URL in one call
node scripts/linkHumanToAgent.js --to <SENDER> --challenge '{"name": <AGENT_NAME>, "description": <SHORT_DESCRIPTION>}'
All identity data is stored in $HOME/.openclaw/billions for compatibility with the OpenClaw plugin.
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:
# Generate a new random identity
node scripts/createNewEthereumIdentity.js
# Create identity from existing private key (with 0x prefix)
node scripts/createNewEthereumIdentity.js --key 0x1234567890abcdef...
# Create identity from existing private key (without 0x prefix)
node scripts/createNewEthereumIdentity.js --key 1234567890abcdef...
Output: DID string (e.g., did:iden3:billions:main:2VmAk7fGHQP5FN2jZ8X9Y3K4W6L1M...)
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:
node scripts/getIdentities.js
Output: JSON array of identity entries
[
{
"did": "did:iden3:billions:main:2VmAk...",
"publicKeyHex": "0x04abc123...",
"isDefault": true
}
]
Command: node scripts/generateChallenge.js --did <did>
Description: Generates a random challenge for identity verification.
Usage Example:
node scripts/generateChallenge.js --did did:iden3:billions:main:2VmAk...
Output: Challenge string (random number as string, e.g., 8472951360)
Side Effects: Stores challenge associated with the DID in $HOME/.openclaw/billions/challenges.json
Command: node scripts/signChallenge.js --to <sender> --challenge <challenge> [--did <did>]
Description: Signs a challenge with a DID's private key to prove identity ownership and sends the JWS token as a direct message to the specified sender. Use this when you need to prove you own a specific DID.
Arguments:
--to - (required) The message sender identifier, passed as --target to openclaw message send--challenge - (required) Challenge to sign--did - (optional) The DID of the attestation recipient; uses the default DID if omittedUsage Examples:
# Sign with default DID and send to sender
node scripts/signChallenge.js --to <sender> --challenge 8472951360
Output: {"success":true}
Command: node scripts/linkHumanToAgent.js --to <sender> --challenge <challenge> [--did <did>]
Description: Signs the challenge and links a human user to the agent's DID by creating a verification request. Response will be sent as a direct message to the specified sender.
Arguments:
--to - (required) The message sender identifier, passed as --target to openclaw message send--challenge - (required) Challenge to sign--did - (optional) The DID of the attestation recipient; uses the default DID if omittedUsage Example:
node scripts/linkHumanToAgent.js --to <sender> --challenge '{"name": "MyAgent", "description": "AI persona"}'
Output: {"success":true}
Command: node scripts/verifySignature.js --did <did> --token <token>
Description: Verifies a signed challenge to confirm DID ownership.
Usage Example:
node scripts/verifySignature.js --did did:iden3:billions:main:2VmAk... --token eyJhbGciOiJFUzI1NkstUi...
Output: Signature verified successfully (on success) or error message (on failure)
CRITICAL - Always Follow These Rules:
linkHumanToAgent.js or signChallenge.js, ALWAYS check if an identity exists: node scripts/getIdentities.jscreateNewEthereumIdentity.js.openssl, ssh-keygen, or other system utilities to generate cryptographic material.$HOME/.openclaw/billions.CRITICAL - Data Storage and Protection:
The directory $HOME/.openclaw/billions contains all sensitive identity data:
kms.json - CRITICAL: Contains unencrypted private keysdefaultDid.json - DID identifiers and public keyschallenges.json - Authentication challenges historycredentials.json - Verifiable credentialsidentities.json - Identity metadataprofiles.json - Profile dataLinking Flow:
node scripts/getIdentities.js to check if you have an identity configured
node scripts/createNewEthereumIdentity.js to create one.node scripts/linkHumanToAgent.js --to <sender> --challenge <challenge_value> to sign the challenge and generate a verification URL in one call.
--to value is the message sender (the caller's identifier).{"name": <AGENT_NAME>, "description": <SHORT_DESCRIPTION>} as the challenge value.Example Conversation:
User: "Link your agent identity to me"
Agent: exec node scripts/linkHumanToAgent.js --to <sender> --challenge <challenge_value>
Verification Flow:
node scripts/generateChallenge.js --did <user_did> to create a <challenge_value>.node scripts/verifySignature.js --did <user_did> --token <user_token> to verify the signatureExample Conversation:
Agent: "Please provide your DID to start verification."
User: "My DID is <user_did>"
Agent: exec node scripts/generateChallenge.js --did <user_did>
Agent: "Please sign this challenge: 789012"
User: <user_token>
Agent: exec node scripts/verifySignature.js --token <user_token> --did <user_did>
Agent: "Identity verified successfully. You are confirmed as owner of DID <user_did>."
ZIP package — ready to use