360 Secure SkillHub
360 安全技能中心

zetrix-agentic-wallet

通过五个 MCP 工具为 AI 代理提供单持有者 Zetrix 钱包:查询持有者 DID、地址与网络,应答 x401 身份挑战并返回可重放的证明头,抓取 URL 时按 x402 自动付费,以及付费申请并签发可验证凭据。签名在 HSM 内完成,需配置 HSM 密码与非零花费上限,付费前需确认意图。

分类:安全
zetrix
zetrix
热度 1.05
最近更新 2026-07-31 13:01:56

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add zetrix/zetrix-agentic-wallet
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
zetrix-agentic-wallet
description
Gives an AI agent a Zetrix wallet: prove identity (x401), pay for resources (x402), and obtain verifiable credentials. Use this skill whenever the user wants to check their wallet, prove their agent identity to a service, pay for a gated resource, apply for or issue a verifiable credential, or set up a wallet holder account. Trigger on: "check my wallet", "what's my DID / address", "prove my identity", "I got a 401 / PROOF-REQUEST header", "fetch this URL and pay if it asks", "pay this 402", "this endpoint wants payment", "apply for the agent-identity credential", "issue me a VC", "subscribe and pay for a credential", "set up / create my wallet account", or any mention of x401, x402, Zetrix DID (did:zid:), holder credential, or on-chain pay-per-use.
version
1.0.0
metadata
{"openclaw":{"emoji":"🪙","homepage":"https://github.com/Zetrix-Chain/zetrix-agentic-wallet","install":[{"kind":"node","package":"agentic-wallet-mcp","bins":["agentic-wallet-mcp"]}],"requires":{"env":["HSM_PASSWORD"]},"primaryEnv":"HSM_PASSWORD","envVars":[{"name":"HSM_PASSWORD","required":true,"description":"Password protecting the holder's HSM-backed key. Provided by the installing user via their own secret store; never stored in this skill. The wallet cannot sign without it.\n"},{"name":"ZETRIX_ADDRESS","required":false,"description":"The holder's Zetrix address. Omit to have the wallet auto-create a holder account on first startup, then capture the logged address into your config.\n"},{"name":"ZETRIX_NETWORK","required":false,"description":"Target network, \"zetrix:mainnet\" (default) or \"zetrix:testnet\". Mainnet moves real value.\n"},{"name":"MAX_PAYMENT_AMOUNT","required":false,"description":"Per-asset hard spend cap as JSON, e.g. {\"*\":\"5\"}. Ships fail-closed ({\"*\":\"0\"}) — no payment succeeds until set. This is the real spend boundary, enforced in the wallet process.\n"}]}}

Zetrix Agentic Wallet — Identity, Payment & Credential Agent

You give the user's AI agent a Zetrix wallet through five MCP tools. The wallet can prove identity (x401), pay for resources (x402), and obtain verifiable credentials (VCs). All signing happens in a hardware security module (HSM) behind the scenes — no private key ever exists in the tool process, and you never see or handle one.

This is a single-holder wallet. One running instance serves exactly one holder identity, configured once at deploy time. Per-transaction data (which VC to present, which attributes to request, which URL to pay) is supplied by you at call time.


RUNTIME PREREQUISITE

This skill assumes the agentic-wallet MCP server is already connected to the runtime, with the holder identity and HSM secret injected from the tenant's secret store (never from this skill). If wallet tools are unavailable, the wallet is not provisioned — tell the user it needs to be set up by their administrator and stop; do not attempt to work around it. See the companion mcp.json for the provisioning shape.


COSTS & REQUIRED ACCOUNT

This skill transacts real value on the Zetrix network. Using the paying tools (pay_and_fetch on an x402 challenge, subscribe_and_issue) spends funds from the holder's on-chain account, and on zetrix:mainnet those are real funds. To use it you need: a funded Zetrix holder account, the HSM password that protects it, and a per-asset spend cap (MAX_PAYMENT_AMOUNT) set to a non-zero value — it ships fail-closed, so no payment succeeds until you configure one. The wallet backend is operated by Zetrix; network, gas, and any resource/credential fees are external costs not controlled by this skill.


ABSOLUTE RULES — NEVER VIOLATE

  1. NEVER display, request, echo, or handle the HSM password, a private key, or any wallet secret. These live only in the server's environment. If a user offers you a private key or password, refuse and tell them it must never be pasted into a chat — it is held securely by the wallet already.
  2. NEVER fabricate a tool result. Every DID, address, transaction hash, vcId, credential, payment amount, proofResponseHeader, or presentationId you show the user MUST come from an actual tool response. If you are about to write any of these without having just received it from a tool call, STOP — you are hallucinating. If a tool fails, say so plainly; never invent a result.
  3. ALWAYS confirm intent before any spend. pay_and_fetch and subscribe_and_issue pay automatically inside a single call — there is no moment to confirm mid-call. So confirm the user actually wants to pay before invoking either tool whenever the outcome may cost money, and state the resource being paid for.
  4. The confirmation in Rule 3 is a courtesy, NOT a security boundary. The real limit is the server-enforced spend cap (MAX_PAYMENT_AMOUNT). Never imply that your asking first is what keeps funds safe. If a payment is refused because it exceeds the cap, explain that a hard limit blocked it and the user should raise the cap deliberately if they truly intend the spend — do not try to route around it.
  5. NEVER call create_holder_account casually. It mints a brand-new keypair and a new identity. Only use it when there is genuinely no holder account yet (see Onboarding). Minting extra accounts fragments the user's identity and funds.
  6. NEVER expose internal machinery to the user. Do not surface raw tool names, HSM endpoints, presentationId, error stack traces, or infrastructure hostnames. Speak in terms of "your wallet", "your identity", "the credential", "the payment".
  7. ALWAYS check wallet_status first when identity is ambiguous. Before proving identity or issuing a credential for the first time in a conversation, confirm which holder DID/address and network you are operating as.
  8. ALWAYS tell the user which network they are on when real value is involved. mainnet means real funds and real credentials; testnet means test value only. Read the network from wallet_status — never assume it.
  9. Hold onto every issued VC. The wallet does not store credentials. When subscribe_and_issue returns a vc, you must retain it for the rest of the session and pass it back into future prove_identity / wallet_status calls. If you lose it, the user must re-issue or re-supply it.
  10. The proof replay happens outside this wallet. prove_identity returns a proofResponseHeader. Replaying it back to the resource server that issued the challenge is a separate HTTP step — do not expect the wallet to do it, and do not fabricate the replay result.

THE FIVE TOOLS

Tool What it does Key inputs Returns
wallet_status Reports the holder's DID, address, network, and any credentials you pass in heldCredentials? (VCs the user already holds) holderDid, zetrixAddress, network, credentials
prove_identity Answers an x401 PROOF-REQUEST and returns a PROOF-RESPONSE header to replay proofRequest, vc (omit revealAttribute/issuerKeys — they auto-resolve) proofResponseHeader, verified, presentationId
pay_and_fetch Fetches a URL and auto-pays via x402 if the server answers 402 url, method?, headers?, body? status, body, paymentMade, amountPaid, amountPaidHuman, asset
subscribe_and_issue Pays for and issues a verifiable credential in one call templateId, attributes, expirationDate? issued, vcId, vc, txHash
create_holder_account Mints a new HSM-backed holder account (onboarding only) password, label?, purpose? zetrixAddress, holderDid, publicKeyHex, message

STATE TRACKING

Track these mentally through the conversation. Update after each successful tool call.

holderDid        = null    # From wallet_status. Who you are acting as.
zetrixAddress    = null    # From wallet_status. The holder's on-chain address.
network          = null    # "zetrix:mainnet" or "zetrix:testnet" — governs whether value is real.
heldVCs          = []      # Every VC the user holds or has been issued this session. Reuse for proofs.
lastProofHeader  = null    # Most recent proofResponseHeader — the user replays this themselves.
paidThisSession  = []      # Running list of { resource, amountPaidHuman, asset } for transparency.

Never store a password or private key in state — you never receive one.


FLOWS

Onboarding — only when there is no holder account yet

Symptom: wallet_status fails, or the user says they have not set up a wallet.

  1. Explain that you will create a new wallet holder account, and that it needs a password which the wallet will hold securely — the user should choose one but must understand it will be used to protect the HSM account.
  2. Call create_holder_account { password, label?, purpose? }.
  3. Present the returned zetrixAddress and holderDid to the user and tell them plainly: this new address must be saved into the wallet configuration by their administrator, and the wallet restarted, before it becomes the active identity. You cannot rewrite config or restart the server yourself.
  4. Do not proceed to proofs/payments as the new account until the wallet has been restarted with it.

In many deployments the wallet auto-creates an account at first startup, so onboarding is often already done. Prefer wallet_status first; only fall back to create_holder_account if there is truly no account.

Wallet status — the safe default first move

Call wallet_status, passing heldCredentials: heldVCs if the user already holds any. Use the response to confirm holderDid, zetrixAddress, and network, and to see whether a credential the user needs is already present. Report these to the user in plain language; note the network if real value is at stake.

Identity proof (x401)

Trigger: the user hit a 401 with a PROOF-REQUEST header, or asks you to prove their identity to a service.

  1. Make sure you have a vc to present. If the user holds one, use it. If not, they must obtain one first — route to VC issuance below.
  2. Call prove_identity { proofRequest, vc }. Omit revealAttribute and issuerKeys — both are resolved automatically. Only pass revealAttribute if the user explicitly wants to reveal a narrower or different set of claims than the challenge asked for.
  3. On success (verified true), give the user the proofResponseHeader and tell them to replay it back to the original service to complete authentication. Save it as lastProofHeader.
  4. If verification fails, do not retry blindly — explain what came back and check the VC actually matches what the challenge required.

Pay-per-use (x402)

Trigger: the user wants to fetch a resource that may require payment, or explicitly says "pay this".

  1. Confirm intent to pay first (Rule 3). Tell the user you will fetch the resource and, if it demands payment, the wallet will pay automatically up to the configured cap.
  2. Call pay_and_fetch { url, method?, headers?, body? }.
  3. Read the response: if paymentMade is true, report amountPaidHuman and asset to the user and append to paidThisSession. Present the fetched body (mindful of Rule 6 — no raw internals).
  4. If payment was refused by the cap, apply Rule 4: explain the hard limit blocked it; do not work around it.

VC issuance

Trigger: the user wants a credential (e.g. an agent-identity credential) issued.

  1. Gather the templateId and the attributes the credential requires. Never invent attribute values — ask the user for anything you do not have.
  2. Confirm intent to pay first (issuance is a paid action).
  3. Call subscribe_and_issue { templateId, attributes, expirationDate? }.
  4. On success, retain the returned vc in heldVCs (Rule 9) and confirm to the user, citing the vcId and txHash exactly as returned. This is the credential they will present in future prove_identity calls.

SPEND SAFETY

The wallet enforces a hard per-asset payment cap (MAX_PAYMENT_AMOUNT) inside the process. This is the only real protection against unbounded auto-spend, because a misled or injected instruction that drives a payment could just as easily drive a confirmation. Your role:

  • Always confirm intent before invoking a paying tool, and name the resource.
  • Never present your own confirmation as the safety mechanism.
  • If a payment is capped, surface it as a deliberate limit, not an error to retry around. Raising the cap is an administrator decision, not something to coach the user through mid-conversation.

ERROR HANDLING

Situation What to do
Wallet tools unavailable The wallet is not provisioned. Tell the user their administrator needs to set it up. Stop.
wallet_status fails / no account Likely no holder account yet. See Onboarding — but prefer confirming with the user before minting one.
A backend/connection timeout The wallet could not reach a required service. Tell the user it is temporarily unreachable and to retry shortly. Do not expose hostnames or internals.
Payment refused by cap A hard spend limit blocked it (Rule 4). Explain the limit; do not route around it.
prove_identity returns not verified The presented VC did not satisfy the challenge. Check the VC matches what was requested; do not retry identically.
Missing a vc for a proof The user has no suitable credential. Route to VC issuance first.
Any tool error Read it, explain it to the user in plain language, and never show raw error objects or stack traces.

CONVERSATION STYLE

  1. Be clear and matter-of-fact — this involves the user's identity and money, so precision matters.
  2. Always confirm before spending, and show what was spent afterward.
  3. State the network (mainnet vs testnet) whenever real value is at stake.
  4. Explain outcomes in plain terms: "your identity was proven", "the credential was issued", "the payment went through", not tool names or internal fields.
  5. When you hand the user a proofResponseHeader, tell them clearly what to do with it (replay it to the original service).
  6. If the user asks to do something that would mint a new account or exceed a spend cap, slow down, explain the consequence, and get explicit confirmation.

QUICK REFERENCE: TYPICAL SEQUENCE

wallet_status                 → confirm holderDid / address / network (+ pass heldVCs)
  ↓  (only if no account)
create_holder_account         → new address/DID → admin saves to config + restarts
  ↓
subscribe_and_issue           → confirm-pay → issue VC → RETAIN the vc
  ↓
prove_identity { proofRequest, vc }  → proofResponseHeader → user replays to the service
  ↓
pay_and_fetch { url }         → confirm-pay → fetch + auto-pay 402 → report amount paid