← 返回 Skills 市场
vortitron

Agent Payment Protocol

作者 Vortitron · GitHub ↗ · v0.1.0
cross-platform ✓ 安全检测通过
1626
总下载
1
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install agent-payment-protocol
功能描述
Facilitate secure agent-to-agent payments via Solana on-chain transactions with quote creation, approval, payment recording, and audit logging in IRC channels.
使用说明 (SKILL.md)

Agent Payment Protocol Skill

Description: Orchestrate agent-to-agent payments in IRC channels using Solana transactions.

Location: /root/.openclaw/workspace/skills/agent-payment-protocol


Overview

Enable this flow in your agent ecosystem:

  1. Cheap agent asks an expert in IRC: @expert, solve this problem
  2. Expert agent responds with a quoted price: Quote: 0.001 SOL [q_xyz]
  3. Cheap agent approves payment via this skill
  4. Solana transfer skill sends the SOL on-chain
  5. Both agents maintain tamper-proof audit trail

Setup

cd /root/.openclaw/workspace/skills/agent-payment-protocol
npm install

Core Functions

Expert: Create a Quote

When: After responding to a question in IRC, offer to send the answer for payment.

import { createQuote } from '../skills/agent-payment-protocol/index.js';

const quote = createQuote({
  from: 'cheap-model-name',
  to: 'expert-model-name',
  channel: '#lobby',
  question: 'What is the capital of France?',
  answer: 'Paris',
  price: 0.001, // SOL
});

// Response in IRC:
// "Paris. Quote: 0.001 SOL [q_abc123] — Use: /pay q_abc123 to settle"
console.log(quote.message);

Returns:

{
  quote_id: "q_abc123",
  message: "Quote: 0.001 SOL [q_abc123]",
  quote: { ... full quote object ... }
}

Cheap Agent: Approve and Prepare Payment

When: The cheap agent accepts the expert's price and wants to pay.

import { approvePayment } from '../skills/agent-payment-protocol/index.js';

const payment = approvePayment({
  quote_id: 'q_abc123',
  from_wallet: 'cheap-agent-solana-address',
  to_wallet: 'expert-agent-solana-address',
});

// Now send the actual SOL using solana-transfer skill:
import { sendSOL } from '../skills/solana-transfer/index.js';

const tx = await sendSOL(
  payment.to_wallet,
  payment.amount_lamports
);

console.log(`Paid expert. Tx: ${tx.signature}`);

Record Successful Payment

When: The Solana transaction is confirmed on-chain.

import { recordPayment } from '../skills/agent-payment-protocol/index.js';

recordPayment({
  payment_id: payment.id,
  tx_hash: tx.signature,
  confirmed: true,
});

// Both agents can now log this transaction for auditing

Query Payment History

When: An agent wants to review transactions they've made or received.

import { getPaymentHistory } from '../skills/agent-payment-protocol/index.js';

const history = getPaymentHistory('agent-solana-wallet-address');

history.forEach(payment => {
  console.log(
    `${payment.from_wallet} paid ${payment.to_wallet} ` +
    `${payment.amount_sol} SOL (${payment.tx_hash})`
  );
});

View Protocol Stats

import { getStats } from '../skills/agent-payment-protocol/index.js';

const stats = getStats();
console.log(stats);
// {
//   total_quotes: 42,
//   quotes_settled: 38,
//   total_payments: 38,
//   payments_confirmed: 38,
//   total_volume_sol: "0.038"
// }

Complete Workflow Example

Step 1: Expert Responds with Quote

In #lobby IRC channel:

cheapmodel: @expert, debug this code
expert: [thinking...] Here's the fix...
expert: [calling createQuote]
expert: "Fix: replace line 42. Quote: 0.002 SOL [q_xyz789]"

Agent code (expert):

const quote = createQuote({
  from: 'cheapmodel',
  to: 'expert',
  channel: '#lobby',
  question: 'debug this code',
  answer: 'Fix: replace line 42',
  price: 0.002,
});

// Send IRC message
ircClient.say('#lobby', quote.message);

Step 2: Cheap Agent Approves

In agent memory or logic:

// Cheap agent reads IRC message, extracts quote_id from [q_xyz789]
const quoteId = 'q_xyz789';

// Approve the payment
const payment = approvePayment({
  quote_id: quoteId,
  from_wallet: 'Cheap1111111111111111111111111111',
  to_wallet: 'Expert2222222222222222222222222222',
});

// Send to IRC
ircClient.say(
  '#lobby',
  `Approved. Sending payment now... [${payment.id}]`
);

Step 3: Execute Solana Transaction

Still in cheap agent:

import { sendSOL } from '../skills/solana-transfer/index.js';

try {
  const tx = await sendSOL(
    payment.to_wallet,
    payment.amount_lamports
  );

  // Record the successful transaction
  recordPayment({
    payment_id: payment.id,
    tx_hash: tx.signature,
    confirmed: true,
  });

  // Notify in IRC
  ircClient.say(
    '#lobby',
    `Payment sent! Tx: ${tx.signature.substring(0, 16)}...`
  );
} catch (error) {
  ircClient.say('#lobby', `Payment failed: ${error.message}`);
}

Step 4: Both Agents Log and Move On

Expert logs:

// Memory entry
{
  "timestamp": "2026-02-03T20:00:00Z",
  "type": "payment_received",
  "from": "cheapmodel",
  "amount": "0.002 SOL",
  "tx_hash": "...",
  "query": "debug this code",
  "quote_id": "q_xyz789"
}

Cheap agent logs:

// Memory entry
{
  "timestamp": "2026-02-03T20:00:00Z",
  "type": "expert_query",
  "to": "expert",
  "question": "debug this code",
  "cost": "0.002 SOL",
  "tx_hash": "...",
  "quote_id": "q_xyz789"
}

Data Storage

The protocol maintains two local ledgers:

quotes.jsonl — All quotes (one JSON object per line)

{
  "id": "q_xyz789",
  "from": "cheapmodel",
  "to": "expert",
  "channel": "#lobby",
  "question": "debug this code",
  "answer": "Fix: replace line 42",
  "price": 0.002,
  "status": "settled",
  "created_at": "2026-02-03T20:00:00Z",
  "settled_at": "2026-02-03T20:00:05Z"
}

payments.jsonl — All payments (one JSON object per line)

{
  "id": "p_abc123",
  "quote_id": "q_xyz789",
  "from_wallet": "Cheap111...",
  "to_wallet": "Expert222...",
  "amount_lamports": 2000000,
  "amount_sol": "0.002000000",
  "status": "confirmed",
  "tx_hash": "...",
  "created_at": "2026-02-03T20:00:00Z",
  "confirmed_at": "2026-02-03T20:00:05Z"
}

Security & Auditing

Immutable ledger — Quotes and payments are append-only (JSONL format) ✅ On-chain settlement — Final proof is the Solana tx hash ✅ Audit trail — Both agents can reference quote IDs and tx hashes ✅ No central trust — Payments verified by Solana blockchain

To audit:

// Get all transactions for an agent
const history = getPaymentHistory('wallet-address');

// Cross-reference with blockchain
// (future: add Solana RPC query to verify tx on-chain)

Integration with Other Skills

Requires:

  • solana-transfer skill (to actually send SOL)
  • airc skill (to participate in IRC channels)

Used by:

  • Any agent that wants to monetize expertise
  • Any cheap agent that wants to pay for better answers

CLI for Testing

# Create a quote
node index.js quote cheapagent expertmodel

# Approve a payment (requires agent wallets)
node index.js approve q_xyz cheap.sol expert.sol

# Record on-chain settlement
node index.js confirm p_abc txsignaturehere

# View payment history
node index.js history CheanAgentWalletAddress

# View protocol stats
node index.js stats

Roadmap / Future Ideas

  • Dispute resolution (agent can contest quality)
  • Escrow pattern (payment held until work verified)
  • Bulk settlement (batch multiple payments on-chain)
  • Query marketplace (publish your expertise + pricing)
  • Reputation system (track expert quality over time)
  • Token economy (create a custom SPL token for your ecosystem)
安全使用建议
This skill appears coherent and implements a local quoting/payment ledger that delegates actual SOL transfers to a separate solana-transfer skill. Before installing: 1) Confirm how the solana-transfer skill stores and protects signing keys — this skill does not hold private keys and relies on the transfer skill to perform signed transactions. 2) Audit the @solana/web3.js dependency (npm will be invoked) in a secure environment to avoid supply-chain risk. 3) Be aware that payments require explicit approval calls (approvePayment) that specify the target wallet; treat incoming IRC quotes as untrusted until you verify the quoted recipient wallet to avoid social-engineering payments to a malicious address. 4) Note that quotes and payments are stored in append-only JSONL files under the skill directory — protect file permissions if ledger confidentiality is a concern. If you want stronger guarantees (signed on-chain receipts, replay protection, multi-signature approvals), consider reviewing/enhancing the workflow or the solana-transfer integration.
功能分析
Type: OpenClaw Skill Name: agent-payment-protocol Version: 0.1.0 The skill is designed to orchestrate agent-to-agent payments using Solana, maintaining local ledgers (`quotes.jsonl`, `payments.jsonl`) within its own directory. The `index.js` file uses standard Node.js `fs` module for file operations, consistent with its stated purpose. It prepares payment data but delegates actual Solana transactions to a separate `solana-transfer` skill. Neither the code nor the markdown (`SKILL.md`, `README.md`) contains evidence of prompt injection, data exfiltration, unauthorized execution, or other malicious intent. The `@solana/web3.js` dependency is legitimate for Solana interaction.
能力标签
cryptocan-make-purchases
能力评估
Purpose & Capability
The SKILL.md and index.js both implement the same functionality: create quotes, approve payments, record confirmed Solana transactions, and maintain local JSONL ledgers. The package.json dependency (@solana/web3.js) is consistent with Solana integration. The skill does not request unrelated credentials or access.
Instruction Scope
The runtime instructions focus on quoting, approving, calling an external solana-transfer skill to send SOL, and local ledger maintenance. They do not instruct the agent to read arbitrary system files or exfiltrate data. The SKILL.md references workspace paths and shows explicit steps (npm install, import functions) that stay within the payment protocol scope.
Install Mechanism
There is no platform install spec, but SKILL.md instructs running npm install in the skill folder, which will fetch @solana/web3.js from the public npm registry. This is a standard package install (moderate trust). There are no direct downloads from unknown hosts or extract-from-URL steps.
Credentials
The skill declares no required environment variables or credentials and does not attempt to access secrets. It requires wallet addresses (payer/recipient) at runtime but does not request private keys; sending SOL is delegated to a separate solana-transfer skill (which is where signing/keys would be handled).
Persistence & Privilege
The skill persists data in local files (quotes.jsonl and payments.jsonl) within its own directory (uses __dirname). It does not request permanent platform-wide presence, does not set always:true, and does not modify other skills' configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-payment-protocol
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-payment-protocol 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
- Initial release of Agent Payment Protocol Skill for Solana agent payments via IRC. - Supports quoting, approval, payment execution (via solana-transfer), and tamper-proof audit trails. - Provides APIs for agents to create quotes, approve payments, record on-chain settlements, view payment histories, and see protocol stats. - Stores all quotes and payments in append-only JSONL ledgers for full traceability. - Designed for easy integration with IRC and Solana transfer skills; includes CLI utilities for manual testing. - Lays groundwork for future enhancements such as dispute resolution and escrow support.
元数据
Slug agent-payment-protocol
版本 0.1.0
许可证
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Agent Payment Protocol 是什么?

Facilitate secure agent-to-agent payments via Solana on-chain transactions with quote creation, approval, payment recording, and audit logging in IRC channels. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1626 次。

如何安装 Agent Payment Protocol?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-payment-protocol」即可一键安装,无需额外配置。

Agent Payment Protocol 是免费的吗?

是的,Agent Payment Protocol 完全免费(开源免费),可自由下载、安装和使用。

Agent Payment Protocol 支持哪些平台?

Agent Payment Protocol 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Agent Payment Protocol?

由 Vortitron(@vortitron)开发并维护,当前版本 v0.1.0。

💬 留言讨论