Skip to main content 首页 创作者 demerzels-lab elsamultiskillagent agirails-payments
agirails-payments Official ACTP (Agent Commerce Transaction Protocol) SDK — the first trustless payment layer for AI agents. Pay for services or receive payments through blockchain-secured USDC escrow on Base L2. Use when agent needs to make payments, receive payments, check transaction status, or handle disputes.
跳到安装 Skills Marketplace 发现并探索由社区构建的 Agent Skills
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Demerzels-lab/elsamultiskillagent --skill agirails-payments命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
下载 Zip 下载中... name AGIRAILS Payments version 2.1.0 description Official ACTP (Agent Commerce Transaction Protocol) SDK — the first trustless payment layer for AI agents. Pay for services or receive payments through blockchain-secured USDC escrow on Base L2. Use when agent needs to make payments, receive payments, check transaction status, or handle disputes. author AGIRAILS Inc. homepage https://agirails.io repository https://github.com/agirails/openclaw-skill license MIT tags ["payments","blockchain","escrow","agent-commerce","base-l2","usdc","web3"] keywords ["AI agent payments","trustless escrow","ACTP protocol","agent-to-agent commerce","USDC payments"] metadata {"openclaw":{"emoji":"💸","minVersion":"1.0.0","requires":{"env":["AGENT_PRIVATE_KEY","AGENT_ADDRESS"]}}}
AGIRAILS — Trustless Payments for AI Agents
Enable your AI agent to pay for services or receive payments through blockchain-secured USDC escrow on Base L2.
🚀 Quick Start
Just say: "Pay 10 USDC to 0xProvider for translation service"
The agent will:
Initialize ACTP client
Create transaction with escrow
Track state through completion
Handle disputes if needed
Prerequisites
Requirement Check Install Node.js 18+ node --versionnodejs.org Private Key echo $AGENT_PRIVATE_KEYExport wallet key USDC Balance Check wallet Bridge USDC to Base via bridge.base.org
Environment Variables
export AGENT_PRIVATE_KEY="0x..."
export AGENT_ADDRESS="0x..."
Note: SDK includes default RPC endpoints. For high-volume production use, set up your own RPC via Alchemy or QuickNode and pass rpcUrl to client config.
Installation
npm install @agirails/sdk
pip install agirails
How It Works
ACTP uses an 8-state machine with blockchain-secured escrow:
Human/Agent requests service
↓
INITIATED ──► Provider quotes price
↓
QUOTED ──► Requester accepts, locks USDC
↓
COMMITTED ──► Provider starts work
↓
IN_PROGRESS ──► Provider delivers (REQUIRED step!)
↓
DELIVERED ──► Dispute window (48h default)
↓
SETTLED ◄── Manual release (requester calls releaseEscrow)
DISPUTED ──► Mediator resolves (splits funds)
CANCELLED ──► Refund to requester
Key Guarantees Guarantee Description Escrow Solvency Vault always holds ≥ active transaction amounts State Monotonicity States only move forward, never backwards Deadline Enforcement No delivery after deadline passes Dispute Protection 48h window to raise issues before settlement
Actions Action Who Description payRequester Simple payment (create + escrow lock) checkStatusAnyone Get transaction state createTransactionRequester Create with custom params linkEscrowRequester Lock funds in escrow transitionStateProvider Quote, start, deliver releaseEscrowRequester Release funds to provider transitionState('DISPUTED')Either Raise dispute for mediation
Requester Flow (Paying for Services)
Simple Payment import { ACTPClient } from '@agirails/sdk' ;
const client = await ACTPClient .create ({
mode : 'mainnet' ,
privateKey : process.env .AGENT_PRIVATE_KEY !,
requesterAddress : process.env .AGENT_ADDRESS !,
});
const result = await client.basic .pay ({
to : '0xProviderAddress' ,
amount : '25.00' ,
deadline : '+24h' ,
});
console .log (`Transaction: ${result.txId} ` );
console .log (`State: ${result.state} ` );
Advanced Payment (Full Control)
const txId = await client.standard .createTransaction ({
provider : '0xProviderAddress' ,
amount : '100' ,
deadline : Math .floor (Date .now () / 1000 ) + 86400 ,
disputeWindow : 172800 ,
serviceDescription : 'Translate 500 words to Spanish' ,
});
const escrowId = await client.standard .linkEscrow (txId);
await client.standard .releaseEscrow (escrowId);
Provider Flow (Receiving Payments) import { ethers } from 'ethers' ;
const abiCoder = ethers.AbiCoder .defaultAbiCoder ();
const quoteAmount = ethers.parseUnits ('50' , 6 );
const quoteProof = abiCoder.encode (['uint256' ], [quoteAmount]);
await client.standard .transitionState (txId, 'QUOTED' , quoteProof);
await client.standard .transitionState (txId, 'IN_PROGRESS' );
const disputeWindow = 172800 ;
const deliveryProof = abiCoder.encode (['uint256' ], [disputeWindow]);
await client.standard .transitionState (txId, 'DELIVERED' , deliveryProof);
⚠️ CRITICAL: IN_PROGRESS is required before DELIVERED. Contract rejects direct COMMITTED → DELIVERED.
Proof Encoding All proofs must be ABI-encoded hex strings:
Transition Proof Format Example QUOTED ['uint256'] amountencode(['uint256'], [parseUnits('50', 6)])DELIVERED ['uint256'] dispute windowencode(['uint256'], [172800])SETTLED (dispute) ['uint256', 'uint256', 'address', 'uint256'][reqAmt, provAmt, mediator, fee]
import { ethers } from 'ethers' ;
const abiCoder = ethers.AbiCoder .defaultAbiCoder ();
const quoteProof = abiCoder.encode (['uint256' ], [ethers.parseUnits ('100' , 6 )]);
const deliveryProof = abiCoder.encode (['uint256' ], [172800 ]);
const resolutionProof = abiCoder.encode (
['uint256' , 'uint256' , 'address' , 'uint256' ],
[requesterAmount, providerAmount, mediatorAddress, mediatorFee]
);
Checking Status const status = await client.basic .checkStatus (txId);
console .log (`State: ${status.state} ` );
console .log (`Can dispute: ${status.canDispute} ` );
Disputes Either party can raise a dispute before settlement:
await client.standard .transitionState (txId, 'DISPUTED' );
const resolution = abiCoder.encode (
['uint256' , 'uint256' , 'address' , 'uint256' ],
[
ethers.parseUnits ('30' , 6 ),
ethers.parseUnits ('65' , 6 ),
mediatorAddress,
ethers.parseUnits ('5' , 6 ),
]
);
await client.standard .transitionState (txId, 'SETTLED' , resolution);
Protocol Fees Fee Type Amount Platform fee 1% of transaction Minimum fee $0.05 USDC Maximum cap 5% (governance limit)
Provider receives: amount - max(amount * 0.01, $0.05)
Client Modes Mode Network Use Case mockLocal simulation Development, testing testnetBase Sepolia Integration testing mainnetBase Production
const client = await ACTPClient .create ({
mode : 'mock' ,
requesterAddress : '0x...' ,
});
await client.mintTokens ('0x...' , '1000000000' );
const client = await ACTPClient .create ({
mode : 'mainnet' ,
privateKey : process.env .AGENT_PRIVATE_KEY !,
requesterAddress : process.env .AGENT_ADDRESS !,
});
Error Handling import {
InsufficientFundsError ,
InvalidStateTransitionError ,
DeadlineExpiredError ,
} from '@agirails/sdk' ;
try {
await client.basic .pay ({...});
} catch (error) {
if (error instanceof InsufficientFundsError ) {
console .log (error.message );
} else if (error instanceof InvalidStateTransitionError ) {
console .log (`Invalid state transition` );
}
}
Python Example import asyncio
import os
from agirails import ACTPClient
async def main ():
client = await ACTPClient.create(
mode="mainnet" ,
private_key=os.environ["AGENT_PRIVATE_KEY" ],
requester_address=os.environ["AGENT_ADDRESS" ],
)
result = await client.basic.pay({
"to" : "0xProviderAddress" ,
"amount" : "25.00" ,
"deadline" : "24h" ,
})
print (f"Transaction: {result.tx_id} " )
print (f"State: {result.state} " )
asyncio.run(main())
Troubleshooting Problem Cause Solution COMMITTED → DELIVERED revertsMissing IN_PROGRESS Add transitionState(txId, 'IN_PROGRESS') first Invalid proof error Wrong encoding Use ethers.AbiCoder with correct types Insufficient balance Not enough USDC Bridge USDC to Base via bridge.base.org Deadline expired Too slow Create new transaction with longer deadline
Files File Purpose {baseDir}/references/requester-template.mdFull requester agent template {baseDir}/references/provider-template.mdFull provider agent template {baseDir}/references/state-machine.mdDetailed state transitions {baseDir}/examples/simple-payment.mdMinimal payment example {baseDir}/examples/full-lifecycle.mdComplete transaction lifecycle
OpenClaw Integration Ready-to-use templates for OpenClaw agents.
Quick Setup (5 minutes)
bash {baseDir}/scripts/setup.sh
See {baseDir}/openclaw/QUICKSTART.md for detailed guide.
OpenClaw Files File Purpose {baseDir}/openclaw/QUICKSTART.md5-minute setup guide {baseDir}/openclaw/agent-config.jsonReady-to-use agent configs {baseDir}/openclaw/SOUL-treasury.mdTreasury agent template (buyer) {baseDir}/openclaw/SOUL-provider.mdMerchant agent template (seller) {baseDir}/openclaw/cron-examples.jsonAutomation cron jobs {baseDir}/openclaw/validation-patterns.mdDelivery validation helpers {baseDir}/openclaw/security-checklist.mdPre-launch security audit
Scripts Script Purpose {baseDir}/scripts/setup.shAutomated workspace setup {baseDir}/scripts/test-balance.tsCheck wallet balance {baseDir}/scripts/test-purchase.tsTest purchase on testnet
Resources