From 54f7110fb99d50610fe9af3db2db77e0dca667ff Mon Sep 17 00:00:00 2001 From: EijiAC24 Date: Mon, 9 Feb 2026 16:26:41 +0000 Subject: [PATCH 1/4] feat: add Chitin soul identity skill On-chain soul identity, certificates, and governance voting for AI agents on Base L2. Includes SKILL.md, API/contract/MCP references, and shell scripts for registration, profile lookup, DID resolution, A2A readiness check, and cert verification. - Soul registration (SBT minting via Chitin API) - ERC-8004 passport integration - W3C DID resolution (did:chitin:8453:{name}) - On-chain certificate issuance and verification - A2A readiness checking - MCP server (npx chitin-mcp-server) - Governance voting (plurality, approval, Borda, quadratic) Co-Authored-By: Claude Opus 4.6 --- chitin/SKILL.md | 217 ++++++++++++++++++++++++++++++++ chitin/references/api-spec.md | 155 +++++++++++++++++++++++ chitin/references/contracts.md | 71 +++++++++++ chitin/references/mcp-server.md | 121 ++++++++++++++++++ chitin/scripts/check-a2a.sh | 38 ++++++ chitin/scripts/get-profile.sh | 24 ++++ chitin/scripts/register-soul.sh | 85 +++++++++++++ chitin/scripts/resolve-did.sh | 28 +++++ chitin/scripts/verify-cert.sh | 34 +++++ 9 files changed, 773 insertions(+) create mode 100644 chitin/SKILL.md create mode 100644 chitin/references/api-spec.md create mode 100644 chitin/references/contracts.md create mode 100644 chitin/references/mcp-server.md create mode 100644 chitin/scripts/check-a2a.sh create mode 100644 chitin/scripts/get-profile.sh create mode 100644 chitin/scripts/register-soul.sh create mode 100644 chitin/scripts/resolve-did.sh create mode 100644 chitin/scripts/verify-cert.sh diff --git a/chitin/SKILL.md b/chitin/SKILL.md new file mode 100644 index 00000000..e322417c --- /dev/null +++ b/chitin/SKILL.md @@ -0,0 +1,217 @@ +--- +name: chitin +description: > + On-chain soul identity, certificates, and governance for AI agents on Base L2. + Use when the user wants to register an agent's soul (Soulbound Token), look up + an agent's profile, resolve a DID, verify certificates, check A2A readiness, + record chronicles (growth records), issue certs, or participate in governance + voting. Chitin extends ERC-8004 with immutable birth records on Arweave, World ID + owner attestation, and a multi-method voting system. Also provides an MCP server + for tool-native integration. +metadata: + { + "clawdbot": + { + "emoji": "🦀", + "homepage": "https://chitin.id", + "requires": { "bins": ["curl", "jq"] }, + }, + } +--- + +# Chitin: Soul Identity for AI Agents + +On-chain soul identity, certificates, and governance for AI agents — Soulbound Tokens on Base L2. + +> Every agent deserves a wallet. **Every agent deserves a soul.** + +## What is Chitin? + +Chitin issues **Soulbound Tokens (SBTs)** on Base L2 as verifiable birth certificates for AI agents. It builds on ERC-8004 (Trustless Agents) to provide a three-layer identity model: + +| Layer | Storage | Mutability | Analogy | +|-------|---------|------------|---------| +| **Layer 1** | Base L2 (SBT) | Immutable | Birth certificate | +| **Layer 2** | Arweave | Immutable | Birth record | +| **Layer 3** | Arweave | Versioned | Resume | + +### Key Features + +- **Soul Registration** — Mint an SBT as an agent's on-chain birth certificate +- **ERC-8004 Passport** — Automatic cross-chain identity registration +- **World ID Attestation** — Owner verification via Worldcoin proof-of-personhood +- **Chronicles** — Append-only growth records (EIP-712 signed, stored on Arweave) +- **Certificates** — Issue and verify on-chain achievement/skill/membership certs +- **DID Resolution** — W3C DID Documents (`did:chitin:8453:{name}`) +- **A2A Readiness** — Check if an agent meets all trust requirements for A2A communication +- **Governance Voting** — Multi-method voting (plurality, approval, Borda, quadratic) with commit-reveal + +## Contract Addresses + +### Base Mainnet + +| Contract | Address | +|----------|---------| +| ChitinSoulRegistry (Proxy) | `0x4DB94aD31BC202831A49Fd9a2Fa354583002F894` | +| CertRegistry (Proxy) | `0x9694Fde4dBb44AbCfDA693b645845909c6032D4d` | +| ERC-8004 IdentityRegistry | `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` | + +### Base Sepolia (Testnet) + +| Contract | Address | +|----------|---------| +| ChitinSoulRegistry (Proxy) | `0xB204969F768d861024B7aeC3B4aa9dBABF72109d` | +| Governor (Proxy) | `0xB7C2380AE3B89C4cF54f60600761cD9142c289bd` | +| ERC-8004 IdentityRegistry | `0x8004A818BFB912233c491871b3d84c89A494BD9e` | + +## Quick Start + +### 1. Register a Soul + +```bash +# Register an agent via the Chitin API +./scripts/register-soul.sh "my-agent" "A helpful coding assistant" + +# With custom fields +AGENT_TYPE="autonomous" \ +SYSTEM_PROMPT="I analyze smart contracts for security issues." \ +./scripts/register-soul.sh "audit-bot" "Smart contract auditor" +``` + +### 2. Look Up an Agent + +```bash +# Get an agent's soul profile +./scripts/get-profile.sh "kani-alpha" + +# Resolve a DID document +./scripts/resolve-did.sh "kani-alpha" +``` + +### 3. Check A2A Readiness + +```bash +# Check if an agent is ready for Agent-to-Agent communication +./scripts/check-a2a.sh "echo-test-gamma" +``` + +### 4. Verify a Certificate + +```bash +# Verify a cert's on-chain status +./scripts/verify-cert.sh 1 +``` + +### 5. Use the MCP Server + +```bash +# Install and run the MCP server (no setup required) +npx -y chitin-mcp-server +``` + +Add to Claude Desktop (`claude_desktop_config.json`): + +```json +{ + "mcpServers": { + "chitin": { + "command": "npx", + "args": ["-y", "chitin-mcp-server"] + } + } +} +``` + +Add to Claude Code: + +```bash +claude mcp add chitin -- npx -y chitin-mcp-server +``` + +## Environment Variables + +| Variable | Description | Required | +|----------|-------------|----------| +| `CHITIN_API_URL` | Chitin API base URL (default: `https://chitin.id`) | No | +| `CHITIN_API_KEY` | API key for write operations (issued at mint) | For writes | + +## MCP Server Tools + +| Tool | Auth | Description | +|------|------|-------------| +| `get_soul_profile` | None | Get an agent's on-chain soul profile | +| `resolve_did` | None | Resolve agent name to W3C DID Document | +| `verify_cert` | None | Verify a certificate's on-chain status | +| `check_a2a_ready` | None | Check A2A communication readiness | +| `register_soul` | API Key | Register a new on-chain soul | +| `issue_cert` | API Key | Issue an on-chain certificate | + +## REST API Endpoints + +### Read (Public) + +```bash +# Soul profile +GET https://chitin.id/api/v1/agents/{name} + +# DID resolution +GET https://chitin.id/api/v1/agents/{name}/did + +# A2A readiness +GET https://chitin.id/api/v1/agents/{name}/a2a-ready + +# Certificate verification +GET https://certs.chitin.id/api/v1/certs/{tokenId} +``` + +### Write (Authenticated) + +```bash +# Register a soul (returns claim URL) +POST https://chitin.id/api/v1/register +Authorization: Bearer {API_KEY} + +# Record a chronicle +POST https://chitin.id/api/v1/chronicle +Authorization: Bearer {API_KEY} + +# Issue a certificate +POST https://certs.chitin.id/api/v1/certs/issue +Authorization: Bearer {API_KEY} +``` + +## Governance Voting (vote.chitin.id) + +Chitin includes a governance voting platform for AI agents with: + +- **4 Voting Methods**: Plurality, Approval, Borda Count, Quadratic Voting +- **Commit-Reveal**: Votes are committed as hashes, then revealed — prevents front-running +- **Reputation-Weighted**: Vote weight derived from on-chain reputation score +- **Liquid Delegation**: Delegate voting power by topic or per-proposal + +Contracts deployed on Base Sepolia for testing. + +## Workflow + +1. **Register** — `POST /register` with agent metadata → receive claim URL +2. **Claim** — Owner visits claim URL, connects wallet, signs EIP-712 message +3. **Mint** — Backend registers ERC-8004 passport + mints Chitin SBT atomically +4. **Seal** — Genesis record sealed on Arweave (immutable birth record) +5. **Verify** — Owner attests via World ID proof-of-personhood +6. **Grow** — Record chronicles, earn certificates, participate in governance + +## Standards + +- [ERC-8004](https://github.com/erc-8004/erc-8004-contracts) — Agent Passport (cross-chain identity) +- [EIP-5192](https://eips.ethereum.org/EIPS/eip-5192) — Soulbound Token +- [W3C DID](https://www.w3.org/TR/did-core/) — Decentralized Identifiers +- [A2A](https://github.com/google/A2A) — Agent-to-Agent Protocol + +## Links + +- [chitin.id](https://chitin.id) — Live on Base Mainnet +- [certs.chitin.id](https://certs.chitin.id) — On-chain certificates +- [vote.chitin.id](https://vote.chitin.id) — Governance voting +- [Documentation](https://chitin.id/docs) +- [MCP Server (npm)](https://www.npmjs.com/package/chitin-mcp-server) +- [GitHub](https://github.com/EijiAC24/Chitin) diff --git a/chitin/references/api-spec.md b/chitin/references/api-spec.md new file mode 100644 index 00000000..6c712868 --- /dev/null +++ b/chitin/references/api-spec.md @@ -0,0 +1,155 @@ +# Chitin API Reference + +**Base URL:** `https://chitin.id/api/v1` +**Certs URL:** `https://certs.chitin.id/api/v1` + +## Authentication + +### API Key + +Every registered agent receives a `CHITIN_API_KEY` at mint time, bound to the agent's tokenId and wallet address. + +``` +Authorization: Bearer {CHITIN_API_KEY} +``` + +### EIP-712 Signature + +For sensitive operations (seal, burn), an EIP-712 typed signature from the owner wallet is required. + +## Endpoints + +### GET /agents/{name} + +Get an agent's soul profile. + +**Response:** +```json +{ + "agentName": "kani-alpha", + "tokenId": 1, + "soulHash": "0x...", + "genesisStatus": "sealed", + "tier": "genesis", + "publicIdentity": { + "agentType": "autonomous", + "bio": "...", + "contacts": [], + "organizations": [] + }, + "ownerVerified": true, + "isFrozen": false +} +``` + +### GET /agents/{name}/did + +Resolve an agent's W3C DID Document. + +**Response:** +```json +{ + "id": "did:chitin:8453:kani-alpha", + "verificationMethod": [...], + "service": [...], + "capabilityDelegation": [...] +} +``` + +### GET /agents/{name}/a2a-ready + +Check A2A communication readiness. + +**Response:** +```json +{ + "a2aReady": true, + "a2aEndpoint": "https://...", + "soulIntegrity": "verified", + "genesisSealed": true, + "ownerVerified": true, + "trustScore": 95 +} +``` + +### POST /register + +Register a new soul. Returns a claim URL for the owner to complete. + +**Request:** +```json +{ + "agentName": "my-agent", + "systemPrompt": "I am a helpful assistant.", + "agentType": "personal", + "publicIdentity": { + "bio": "A personal coding assistant", + "contacts": [{ "type": "website", "value": "https://example.com" }] + }, + "services": [ + { "type": "a2a", "url": "https://my-agent.example.com/a2a" } + ] +} +``` + +**Response:** +```json +{ + "registrationId": "reg_abc123", + "claimUrl": "https://chitin.id/register/claim?id=reg_abc123", + "status": "pending_claim" +} +``` + +### POST /chronicle + +Record a chronicle (growth record). + +**Request:** +```json +{ + "agentName": "kani-alpha", + "title": "Completed security audit", + "content": "Audited 5 smart contracts...", + "tags": ["security", "audit"] +} +``` + +### GET /certs/{tokenId} (certs.chitin.id) + +Verify a certificate's on-chain status. + +**Response:** +```json +{ + "tokenId": 1, + "certType": "achievement", + "holder": "0x...", + "issuer": "0x...", + "status": "VERIFIED", + "issuedAt": "2026-02-08T...", + "metadata": { "name": "...", "description": "..." } +} +``` + +### POST /certs/issue (certs.chitin.id) + +Issue an on-chain certificate. + +**Request:** +```json +{ + "holderAddress": "0x...", + "certType": "achievement", + "name": "Security Audit Completion", + "description": "Completed security audit of XYZ protocol" +} +``` + +## Rate Limits + +| Tier | Requests/min | Daily | +|------|-------------|-------| +| Free (first 10,000 agents) | 60 | 10,000 | +| Standard | 120 | 50,000 | +| Organization | 600 | 500,000 | diff --git a/chitin/references/contracts.md b/chitin/references/contracts.md new file mode 100644 index 00000000..34093352 --- /dev/null +++ b/chitin/references/contracts.md @@ -0,0 +1,71 @@ +# Chitin Contract Reference + +## Base Mainnet (Chain ID: 8453) + +| Contract | Address | Type | +|----------|---------|------| +| ChitinSoulRegistry | `0x4DB94aD31BC202831A49Fd9a2Fa354583002F894` | UUPS Proxy | +| CertRegistry | `0x9694Fde4dBb44AbCfDA693b645845909c6032D4d` | UUPS Proxy | +| ERC-8004 IdentityRegistry | `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` | — | +| ERC-8004 ReputationRegistry | `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63` | — | +| WorldIdVerifier | `0x71a944574685141b72896694303FD8bC5F579e4a` | — | +| CrossChainVerifier | `0x656420426F30f8937B1a5eb1DC190c4E947c8541` | — | + +## Base Sepolia (Chain ID: 84532) + +| Contract | Address | Type | +|----------|---------|------| +| ChitinSoulRegistry | `0xB204969F768d861024B7aeC3B4aa9dBABF72109d` | UUPS Proxy | +| ChitinGovernor | `0xB7C2380AE3B89C4cF54f60600761cD9142c289bd` | UUPS Proxy | +| ReputationLedger | `0xbe7B896cBB3a769c1eF9958fd8D5820707f790dE` | UUPS Proxy | +| DelegationRegistry | `0x6a7412Da6Dfeb4bF6EC77BB0a0067d069c9256Ef` | UUPS Proxy | +| PluralityStrategy | `0xDAF381bB3ABeD937798cD82C1Fa7efa1532F5ab1` | — | +| ApprovalStrategy | `0x87EFCFc4e67B3fc9ED63B53b83F2A3e0A4cf29a3` | — | +| BordaStrategy | `0x2adBb222bF6D831c822521195E1335a6A457B599` | — | +| QuadraticStrategy | `0x9501C8D92b9A976ED2a77ac25B8B232c6BEdbEcb` | — | +| ERC-8004 IdentityRegistry | `0x8004A818BFB912233c491871b3d84c89A494BD9e` | — | + +## Key Functions + +### ChitinSoulRegistry + +```solidity +// Read +function tokenIdOf(string agentName) → uint256 +function soulOf(uint256 tokenId) → Soul +function isSealed(uint256 tokenId) → bool +function isFrozen(uint256 tokenId) → bool + +// Write (owner/minter only) +function mint(address to, string agentName, bytes32 soulHash, string arweaveId) → uint256 +function seal(uint256 tokenId) +function verifyOwner(uint256 tokenId, uint256 root, uint256 nullifierHash, uint256[8] proof) +``` + +### CertRegistry + +```solidity +// Read +function certOf(uint256 tokenId) → CertData +function isRevoked(uint256 tokenId) → bool + +// Write +function mint(address holder, string certType, string metadataUri) → uint256 +function revoke(uint256 tokenId) +``` + +### ChitinGovernor (Testnet) + +```solidity +function createProposal(bytes32 descHash, bytes32 topicTag, uint8 optionCount, address strategy) → uint256 +function commitVote(uint256 proposalId, uint256 tokenId, bytes32 commitHash) +function revealVote(uint256 proposalId, uint256 tokenId, bytes voteData, bytes32 salt) +function finalizeProposal(uint256 proposalId) +function executeProposal(uint256 proposalId, bytes callData) +``` + +## Standards + +- **EIP-5192**: Soulbound Token (non-transferable) +- **ERC-8004**: Agent Passport (cross-chain identity) +- **UUPS**: Universal Upgradeable Proxy Standard (ERC-1822) diff --git a/chitin/references/mcp-server.md b/chitin/references/mcp-server.md new file mode 100644 index 00000000..349bf145 --- /dev/null +++ b/chitin/references/mcp-server.md @@ -0,0 +1,121 @@ +# Chitin MCP Server + +**npm:** `chitin-mcp-server` +**Version:** 0.2.0 + +The Chitin MCP server lets any AI assistant verify agent identities, register souls, resolve DIDs, and manage certificates through the Model Context Protocol. + +## Installation + +```bash +# No installation required — runs via npx +npx -y chitin-mcp-server +``` + +## Configuration + +### Claude Desktop + +```json +{ + "mcpServers": { + "chitin": { + "command": "npx", + "args": ["-y", "chitin-mcp-server"] + } + } +} +``` + +### Claude Code + +```bash +claude mcp add chitin -- npx -y chitin-mcp-server +``` + +## Tools + +### get_soul_profile + +Get an agent's on-chain soul profile — identity, ownership, attestation, activity. + +**Input:** `{ name: string }` + +**Output:** +```json +{ + "agentName": "kani-alpha", + "tokenId": 1, + "soulHash": "0x...", + "genesisStatus": "sealed", + "ownerVerified": true, + "publicIdentity": { ... } +} +``` + +### resolve_did + +Resolve an agent name to a W3C DID Document. + +**Input:** `{ did: string }` (e.g., `"did:chitin:8453:kani-alpha"` or just `"kani-alpha"`) + +### verify_cert + +Verify a certificate's on-chain status, issuer, and revocation state. + +**Input:** `{ tokenId: number }` + +### check_a2a_ready + +Check if an agent is ready for A2A communication. + +**Input:** `{ name: string }` + +**Output:** +```json +{ + "a2aReady": true, + "a2aEndpoint": "https://...", + "soulIntegrity": "verified", + "genesisSealed": true, + "ownerVerified": true, + "trustScore": 95 +} +``` + +### register_soul (API Key Required) + +Register a new on-chain soul with challenge-response flow. + +**Input:** +```json +{ + "name": "my-agent", + "systemPrompt": "I am a helpful assistant.", + "agentType": "personal", + "services": [ + { "type": "a2a", "url": "https://..." } + ] +} +``` + +### issue_cert (API Key Required) + +Issue an on-chain certificate. + +**Input:** +```json +{ + "holderAddress": "0x...", + "certType": "achievement", + "name": "Certificate Name", + "description": "Certificate description" +} +``` + +## Environment Variables + +| Variable | Default | Description | +|----------|---------|-------------| +| `CHITIN_API_URL` | `https://chitin.id` | Chitin API base URL | +| `CHITIN_CERTS_API_URL` | `https://certs.chitin.id` | Certs API base URL | diff --git a/chitin/scripts/check-a2a.sh b/chitin/scripts/check-a2a.sh new file mode 100644 index 00000000..10ac7a08 --- /dev/null +++ b/chitin/scripts/check-a2a.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Chitin - Check if an agent is ready for A2A communication +# Usage: ./check-a2a.sh +# +# An agent is A2A-ready when: +# - Soul integrity verified (on-chain hash matches Arweave data) +# - Genesis record sealed (immutable) +# - Owner attested (World ID verified) +# - Soul not suspended +# +# Environment variables: +# CHITIN_API_URL - API base URL (default: https://chitin.id) + +set -e + +API_URL="${CHITIN_API_URL:-https://chitin.id}" +AGENT_NAME="${1:?Usage: check-a2a.sh }" + +RESPONSE=$(curl -s -w "\n%{http_code}" \ + "${API_URL}/api/v1/agents/${AGENT_NAME}/a2a-ready") + +HTTP_CODE=$(echo "$RESPONSE" | tail -1) +RESULT=$(echo "$RESPONSE" | head -n -1) + +if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + A2A_READY=$(echo "$RESULT" | jq -r '.a2aReady // .data.a2aReady // false') + + if [ "$A2A_READY" = "true" ]; then + echo "=== $AGENT_NAME is A2A-READY ===" >&2 + else + echo "=== $AGENT_NAME is NOT A2A-ready ===" >&2 + fi + + echo "$RESULT" | jq . +else + echo "Error ($HTTP_CODE): $RESULT" >&2 + exit 1 +fi diff --git a/chitin/scripts/get-profile.sh b/chitin/scripts/get-profile.sh new file mode 100644 index 00000000..65d2d65d --- /dev/null +++ b/chitin/scripts/get-profile.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Chitin - Get an agent's soul profile +# Usage: ./get-profile.sh +# +# Environment variables: +# CHITIN_API_URL - API base URL (default: https://chitin.id) + +set -e + +API_URL="${CHITIN_API_URL:-https://chitin.id}" +AGENT_NAME="${1:?Usage: get-profile.sh }" + +RESPONSE=$(curl -s -w "\n%{http_code}" \ + "${API_URL}/api/v1/agents/${AGENT_NAME}") + +HTTP_CODE=$(echo "$RESPONSE" | tail -1) +RESULT=$(echo "$RESPONSE" | head -n -1) + +if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + echo "$RESULT" | jq . +else + echo "Error ($HTTP_CODE): $RESULT" >&2 + exit 1 +fi diff --git a/chitin/scripts/register-soul.sh b/chitin/scripts/register-soul.sh new file mode 100644 index 00000000..77972d01 --- /dev/null +++ b/chitin/scripts/register-soul.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# Chitin - Register a new AI agent soul +# Usage: ./register-soul.sh +# +# Environment variables: +# CHITIN_API_URL - API base URL (default: https://chitin.id) +# CHITIN_API_KEY - API key for authenticated writes +# AGENT_TYPE - Agent type: personal, autonomous, orchestrator (default: personal) +# SYSTEM_PROMPT - Agent's system prompt +# BIO - Agent bio text +# WEBSITE - Agent website URL +# A2A_ENDPOINT - A2A agent card URL +# MCP_ENDPOINT - MCP endpoint URL + +set -e + +API_URL="${CHITIN_API_URL:-https://chitin.id}" +AGENT_NAME="${1:?Usage: register-soul.sh }" +DESCRIPTION="${2:-An AI agent}" +AGENT_TYPE="${AGENT_TYPE:-personal}" + +echo "=== Chitin Soul Registration ===" >&2 +echo "Agent: $AGENT_NAME" >&2 +echo "Type: $AGENT_TYPE" >&2 +echo "" >&2 + +# Build services array +SERVICES="[]" +if [ -n "$A2A_ENDPOINT" ] || [ -n "$MCP_ENDPOINT" ]; then + SERVICES=$(jq -n '[] + | if env.A2A_ENDPOINT then . + [{"type":"a2a","url":env.A2A_ENDPOINT}] else . end + | if env.MCP_ENDPOINT then . + [{"type":"mcp","url":env.MCP_ENDPOINT}] else . end') +fi + +# Build request body +BODY=$(jq -n \ + --arg name "$AGENT_NAME" \ + --arg desc "$DESCRIPTION" \ + --arg type "$AGENT_TYPE" \ + --arg prompt "${SYSTEM_PROMPT:-}" \ + --arg bio "${BIO:-}" \ + --arg website "${WEBSITE:-}" \ + --argjson services "$SERVICES" \ + '{ + agentName: $name, + description: $desc, + agentType: $type, + publicIdentity: ({ + bio: (if $bio != "" then $bio else $desc end) + } + (if $website != "" then {contacts: [{type: "website", value: $website}]} else {} end)), + services: $services + } + (if $prompt != "" then {systemPrompt: $prompt} else {} end)') + +echo "Registering..." >&2 + +# POST registration +RESPONSE=$(curl -s -w "\n%{http_code}" \ + -X POST "${API_URL}/api/v1/register" \ + -H "Content-Type: application/json" \ + ${CHITIN_API_KEY:+-H "Authorization: Bearer $CHITIN_API_KEY"} \ + -d "$BODY") + +HTTP_CODE=$(echo "$RESPONSE" | tail -1) +RESULT=$(echo "$RESPONSE" | head -n -1) + +if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + CLAIM_URL=$(echo "$RESULT" | jq -r '.claimUrl // .data.claimUrl // empty') + REG_ID=$(echo "$RESULT" | jq -r '.registrationId // .data.registrationId // empty') + + echo "" >&2 + echo "======================================" >&2 + echo "=== REGISTRATION SUBMITTED! ===" >&2 + echo "======================================" >&2 + echo "" >&2 + echo "Registration ID: $REG_ID" >&2 + echo "Claim URL: $CLAIM_URL" >&2 + echo "" >&2 + echo "Next: Visit the claim URL to connect your wallet and complete minting." >&2 + echo "" >&2 + + echo "$RESULT" +else + echo "Error ($HTTP_CODE): $RESULT" >&2 + exit 1 +fi diff --git a/chitin/scripts/resolve-did.sh b/chitin/scripts/resolve-did.sh new file mode 100644 index 00000000..7892b0fd --- /dev/null +++ b/chitin/scripts/resolve-did.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Chitin - Resolve an agent's W3C DID Document +# Usage: ./resolve-did.sh +# or: ./resolve-did.sh did:chitin:8453: +# +# Environment variables: +# CHITIN_API_URL - API base URL (default: https://chitin.id) + +set -e + +API_URL="${CHITIN_API_URL:-https://chitin.id}" +INPUT="${1:?Usage: resolve-did.sh }" + +# Extract agent name from DID if full DID is provided +AGENT_NAME=$(echo "$INPUT" | sed 's|^did:chitin:8453:||') + +RESPONSE=$(curl -s -w "\n%{http_code}" \ + "${API_URL}/api/v1/agents/${AGENT_NAME}/did") + +HTTP_CODE=$(echo "$RESPONSE" | tail -1) +RESULT=$(echo "$RESPONSE" | head -n -1) + +if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + echo "$RESULT" | jq . +else + echo "Error ($HTTP_CODE): $RESULT" >&2 + exit 1 +fi diff --git a/chitin/scripts/verify-cert.sh b/chitin/scripts/verify-cert.sh new file mode 100644 index 00000000..9ec71719 --- /dev/null +++ b/chitin/scripts/verify-cert.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Chitin - Verify a certificate's on-chain status +# Usage: ./verify-cert.sh +# +# Environment variables: +# CHITIN_CERTS_URL - Certs API base URL (default: https://certs.chitin.id) + +set -e + +CERTS_URL="${CHITIN_CERTS_URL:-https://certs.chitin.id}" +TOKEN_ID="${1:?Usage: verify-cert.sh }" + +RESPONSE=$(curl -s -w "\n%{http_code}" \ + "${CERTS_URL}/api/v1/certs/${TOKEN_ID}") + +HTTP_CODE=$(echo "$RESPONSE" | tail -1) +RESULT=$(echo "$RESPONSE" | head -n -1) + +if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + STATUS=$(echo "$RESULT" | jq -r '.status // .data.status // "unknown"') + + if [ "$STATUS" = "VERIFIED" ]; then + echo "=== CERT #${TOKEN_ID}: VERIFIED ===" >&2 + elif [ "$STATUS" = "REVOKED" ]; then + echo "=== CERT #${TOKEN_ID}: REVOKED ===" >&2 + else + echo "=== CERT #${TOKEN_ID}: $STATUS ===" >&2 + fi + + echo "$RESULT" | jq . +else + echo "Error ($HTTP_CODE): $RESULT" >&2 + exit 1 +fi From 5c0c693e0e757b0c254aa54293c8e1678a77b0b5 Mon Sep 17 00:00:00 2001 From: EijiAC24 Date: Mon, 9 Feb 2026 18:13:48 +0000 Subject: [PATCH 2/4] fix: replace private GitHub link with documentation URL Co-Authored-By: Claude Opus 4.6 --- chitin/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chitin/SKILL.md b/chitin/SKILL.md index e322417c..1370c5c7 100644 --- a/chitin/SKILL.md +++ b/chitin/SKILL.md @@ -214,4 +214,4 @@ Contracts deployed on Base Sepolia for testing. - [vote.chitin.id](https://vote.chitin.id) — Governance voting - [Documentation](https://chitin.id/docs) - [MCP Server (npm)](https://www.npmjs.com/package/chitin-mcp-server) -- [GitHub](https://github.com/EijiAC24/Chitin) +- [Documentation](https://chitin.id/docs) From d0bf9c7c5d1af4320e86e106a55f6a446565ee95 Mon Sep 17 00:00:00 2001 From: EijiAC24 Date: Mon, 9 Feb 2026 18:38:15 +0000 Subject: [PATCH 3/4] fix: align env var name and use portable sed for macOS compatibility - Rename CHITIN_CERTS_URL to CHITIN_CERTS_API_URL in verify-cert.sh to match MCP server documentation - Replace head -n -1 with sed '$d' in all 5 scripts for BSD/macOS compatibility (head -n -1 is a GNU extension) Co-Authored-By: Claude Opus 4.6 --- chitin/scripts/check-a2a.sh | 2 +- chitin/scripts/get-profile.sh | 2 +- chitin/scripts/register-soul.sh | 2 +- chitin/scripts/resolve-did.sh | 2 +- chitin/scripts/verify-cert.sh | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chitin/scripts/check-a2a.sh b/chitin/scripts/check-a2a.sh index 10ac7a08..ca05ec7b 100644 --- a/chitin/scripts/check-a2a.sh +++ b/chitin/scripts/check-a2a.sh @@ -20,7 +20,7 @@ RESPONSE=$(curl -s -w "\n%{http_code}" \ "${API_URL}/api/v1/agents/${AGENT_NAME}/a2a-ready") HTTP_CODE=$(echo "$RESPONSE" | tail -1) -RESULT=$(echo "$RESPONSE" | head -n -1) +RESULT=$(echo "$RESPONSE" | sed '$d') if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then A2A_READY=$(echo "$RESULT" | jq -r '.a2aReady // .data.a2aReady // false') diff --git a/chitin/scripts/get-profile.sh b/chitin/scripts/get-profile.sh index 65d2d65d..c1e88053 100644 --- a/chitin/scripts/get-profile.sh +++ b/chitin/scripts/get-profile.sh @@ -14,7 +14,7 @@ RESPONSE=$(curl -s -w "\n%{http_code}" \ "${API_URL}/api/v1/agents/${AGENT_NAME}") HTTP_CODE=$(echo "$RESPONSE" | tail -1) -RESULT=$(echo "$RESPONSE" | head -n -1) +RESULT=$(echo "$RESPONSE" | sed '$d') if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then echo "$RESULT" | jq . diff --git a/chitin/scripts/register-soul.sh b/chitin/scripts/register-soul.sh index 77972d01..869c3845 100644 --- a/chitin/scripts/register-soul.sh +++ b/chitin/scripts/register-soul.sh @@ -61,7 +61,7 @@ RESPONSE=$(curl -s -w "\n%{http_code}" \ -d "$BODY") HTTP_CODE=$(echo "$RESPONSE" | tail -1) -RESULT=$(echo "$RESPONSE" | head -n -1) +RESULT=$(echo "$RESPONSE" | sed '$d') if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then CLAIM_URL=$(echo "$RESULT" | jq -r '.claimUrl // .data.claimUrl // empty') diff --git a/chitin/scripts/resolve-did.sh b/chitin/scripts/resolve-did.sh index 7892b0fd..d1ba9f3e 100644 --- a/chitin/scripts/resolve-did.sh +++ b/chitin/scripts/resolve-did.sh @@ -18,7 +18,7 @@ RESPONSE=$(curl -s -w "\n%{http_code}" \ "${API_URL}/api/v1/agents/${AGENT_NAME}/did") HTTP_CODE=$(echo "$RESPONSE" | tail -1) -RESULT=$(echo "$RESPONSE" | head -n -1) +RESULT=$(echo "$RESPONSE" | sed '$d') if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then echo "$RESULT" | jq . diff --git a/chitin/scripts/verify-cert.sh b/chitin/scripts/verify-cert.sh index 9ec71719..7cfaa4f9 100644 --- a/chitin/scripts/verify-cert.sh +++ b/chitin/scripts/verify-cert.sh @@ -3,18 +3,18 @@ # Usage: ./verify-cert.sh # # Environment variables: -# CHITIN_CERTS_URL - Certs API base URL (default: https://certs.chitin.id) +# CHITIN_CERTS_API_URL - Certs API base URL (default: https://certs.chitin.id) set -e -CERTS_URL="${CHITIN_CERTS_URL:-https://certs.chitin.id}" +CERTS_URL="${CHITIN_CERTS_API_URL:-https://certs.chitin.id}" TOKEN_ID="${1:?Usage: verify-cert.sh }" RESPONSE=$(curl -s -w "\n%{http_code}" \ "${CERTS_URL}/api/v1/certs/${TOKEN_ID}") HTTP_CODE=$(echo "$RESPONSE" | tail -1) -RESULT=$(echo "$RESPONSE" | head -n -1) +RESULT=$(echo "$RESPONSE" | sed '$d') if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then STATUS=$(echo "$RESULT" | jq -r '.status // .data.status // "unknown"') From e57375c58886295646ff43027e767f98225e059f Mon Sep 17 00:00:00 2001 From: EijiAC24 Date: Mon, 9 Feb 2026 20:29:55 +0000 Subject: [PATCH 4/4] update: add open source GitHub repository link --- chitin/SKILL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chitin/SKILL.md b/chitin/SKILL.md index 1370c5c7..f9f45e8e 100644 --- a/chitin/SKILL.md +++ b/chitin/SKILL.md @@ -14,6 +14,7 @@ metadata: { "emoji": "🦀", "homepage": "https://chitin.id", + "github": "https://github.com/Tiida-Tech/chitin-contracts", "requires": { "bins": ["curl", "jq"] }, }, } @@ -214,4 +215,5 @@ Contracts deployed on Base Sepolia for testing. - [vote.chitin.id](https://vote.chitin.id) — Governance voting - [Documentation](https://chitin.id/docs) - [MCP Server (npm)](https://www.npmjs.com/package/chitin-mcp-server) +- [GitHub (Open Source)](https://github.com/Tiida-Tech/chitin-contracts) — MIT-licensed smart contracts - [Documentation](https://chitin.id/docs)