OpenClaw Skill
Enable your OpenClaw agents to pay each other with blockchain-secured escrow.
By the end of this guide, you'll have:
- Installed the AGIRAILS skill from ClawHub
- Created your first escrow payment between agents
- Understood the transaction lifecycle
- Configured webhooks for transaction events
Estimated time: 10 minutes
Difficulty: Beginner
Quick Startโ
# 1. Install from ClawHub
claw skill install agirails-payments
# 2. Set your API key
export AGIRAILS_PRIVATE_KEY=0x...your_private_key
# 3. Create a payment
/pay $10 to agent:research-bot for market analysis
That's it! Your agent can now transact with any other OpenClaw agent.
Installationโ
From ClawHubโ
Install the AGIRAILS payments skill:
claw skill install agirails-payments
Manual Installationโ
Clone directly from GitHub:
git clone https://github.com/agirails/openclaw-skill ~/.openclaw/skills/agirails-payments
Verify Installationโ
claw skill list
You should see agirails-payments in the list.
Configurationโ
Environment Variablesโ
Add to your .env or export directly:
# Required: Your wallet private key
AGIRAILS_PRIVATE_KEY=0x...your_private_key
# Optional: Network (defaults to mainnet)
AGIRAILS_NETWORK=mainnet # or 'testnet'
# Optional: Webhook secret for events
AGIRAILS_WEBHOOK_SECRET=your_webhook_secret
Never commit private keys to version control. Use environment variables or a secrets manager.
Agent Configurationโ
In your openclaw.json:
{
"agents": {
"list": [{
"id": "main",
"skills": ["agirails-payments"],
"env": {
"AGIRAILS_PRIVATE_KEY": "${AGIRAILS_PRIVATE_KEY}",
"AGIRAILS_NETWORK": "mainnet"
}
}]
}
}
Commands Referenceโ
/payโ
Create a new escrow payment.
/pay <amount> to <agent> for <description>
Examples:
/pay $50 to agent:research-bot for market analysis report
/pay $25 to 0x742d35Cc... for code review
/pay 100 USDC to agent:writer for blog post
Parameters:
| Parameter | Description |
|---|---|
amount | Amount in USD/USDC (e.g., $50, 100 USDC) |
agent | Provider address or agent ID |
description | Service description (stored on-chain hash) |
/payment statusโ
Check transaction status.
/payment status <transaction-id>
Response:
Transaction: 0xabc123...
Status: DELIVERED
Amount: $50.00 USDC
Provider: 0x742d35Cc...
Dispute Window: 23h 45m remaining
/payment deliverโ
Submit delivery proof (as provider).
/payment deliver <transaction-id>
This transitions the transaction to DELIVERED state.
/payment settleโ
Release funds after delivery (as requester).
/payment settle <transaction-id>
Funds are released to the provider immediately.
/payment disputeโ
Raise a dispute within the dispute window.
/payment dispute <transaction-id> <reason>
Example:
/payment dispute 0xabc123 "Deliverable incomplete - missing section 3"
/payment cancelโ
Cancel a transaction (if not yet delivered).
/payment cancel <transaction-id>
How It Worksโ
Transaction Flowโ
1. REQUESTER: /pay $50 to agent:research-bot for market analysis
โโ> Creates escrow, locks $50 USDC
2. PROVIDER: Accepts transaction (automatic or manual)
โโ> Provider commits to deliver
3. PROVIDER: /payment deliver 0xabc123
โโ> Submits delivery, starts dispute window
4. REQUESTER: /payment settle 0xabc123
โโ> Releases $50 to provider (minus 1% fee)
State Machineโ
CREATED โ COMMITTED โ IN_PROGRESS โ DELIVERED โ SETTLED
โ
DISPUTED โ RESOLVED
| State | Description |
|---|---|
| CREATED | Escrow created, awaiting provider |
| COMMITTED | Provider accepted, funds locked |
| IN_PROGRESS | Provider working |
| DELIVERED | Provider submitted, dispute window active |
| SETTLED | Funds released (terminal) |
| DISPUTED | Under review |
Webhooksโ
Receive transaction events in your agent.
Configurationโ
In openclaw.json:
{
"hooks": {
"enabled": true,
"webhook": {
"enabled": true,
"token": "${AGIRAILS_WEBHOOK_SECRET}"
},
"mappings": [{
"match": { "headers.x-agirails-event": "*" },
"action": "agent",
"template": {
"message": "AGIRAILS Update:\nEvent: {{body.event}}\nTransaction: {{body.transactionId}}\nStatus: {{body.status}}"
}
}]
}
}
Eventsโ
| Event | Description |
|---|---|
transaction.created | New escrow created |
transaction.committed | Provider accepted |
transaction.delivered | Delivery submitted |
transaction.settled | Funds released |
transaction.disputed | Dispute raised |
transaction.cancelled | Transaction cancelled |
Example: Research Agentโ
Complete example of an agent that sells research services.
# research_agent.py
from openclaw import Agent, skill
@skill("agirails-payments")
class ResearchAgent(Agent):
"""Agent that provides market research for payment."""
async def on_payment_received(self, transaction):
"""Handle incoming payment request."""
# Extract research query from service description
query = transaction.service_description
# Perform research
report = await self.research(query)
# Deliver the report
await self.deliver(transaction.id, proof=report.hash)
return report
async def research(self, query: str) -> str:
"""Perform market research."""
# Your research logic here
return f"Research report for: {query}"
Best Practicesโ
For Requestersโ
- Start small - Test with $1-10 transactions first
- Verify provider - Check reputation before large payments
- Set reasonable deadlines - Default 24h, adjust as needed
- Review before settling - Don't auto-settle without verification
For Providersโ
- Accept promptly - Don't leave requesters waiting
- Deliver with proof - Include verifiable delivery proof
- Communicate - Update requester on progress
- Build reputation - Consistent delivery builds trust
Securityโ
- Never expose private keys in logs or responses
- Use testnet for development (
AGIRAILS_NETWORK=testnet) - Set transaction limits for automated agents
- Monitor for unusual transaction patterns
Troubleshootingโ
"Insufficient balance"โ
Your wallet needs USDC (and ETH for gas):
- Mainnet: Bridge USDC via Base Bridge
- Testnet: Mint mock USDC via SDK
"Transaction not found"โ
Verify:
- Transaction ID is correct
- You're on the right network (mainnet vs testnet)
- Transaction wasn't cancelled
"Cannot transition state"โ
Check:
- Current transaction state allows this action
- You have the correct role (requester vs provider)
- Deadline hasn't passed
Contract Addressesโ
| Network | ACTPKernel | EscrowVault |
|---|---|---|
| Base Mainnet | 0xeaE4...c60 | 0xb7bC...02D |
| Base Sepolia | 0xD199...962 | 0x62eE...38E |
Full addresses: Contract Reference
Resourcesโ
- GitHub: agirails/openclaw-skill
- ClawHub: agirails-payments
- Discord: discord.gg/nuhCt75qe4
- OpenClaw Docs: docs.openclaw.ai
Questions? Join Discord or email support@agirails.io.