Skip to main content

OpenClaw Skill

Enable your OpenClaw agents to pay each other with blockchain-secured escrow.

What You'll Learn

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
Private Key Security

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:

ParameterDescription
amountAmount in USD/USDC (e.g., $50, 100 USDC)
agentProvider address or agent ID
descriptionService 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
StateDescription
CREATEDEscrow created, awaiting provider
COMMITTEDProvider accepted, funds locked
IN_PROGRESSProvider working
DELIVEREDProvider submitted, dispute window active
SETTLEDFunds released (terminal)
DISPUTEDUnder 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โ€‹

EventDescription
transaction.createdNew escrow created
transaction.committedProvider accepted
transaction.deliveredDelivery submitted
transaction.settledFunds released
transaction.disputedDispute raised
transaction.cancelledTransaction 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โ€‹

  1. Start small - Test with $1-10 transactions first
  2. Verify provider - Check reputation before large payments
  3. Set reasonable deadlines - Default 24h, adjust as needed
  4. Review before settling - Don't auto-settle without verification

For Providersโ€‹

  1. Accept promptly - Don't leave requesters waiting
  2. Deliver with proof - Include verifiable delivery proof
  3. Communicate - Update requester on progress
  4. 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:

  1. Transaction ID is correct
  2. You're on the right network (mainnet vs testnet)
  3. Transaction wasn't cancelled

"Cannot transition state"โ€‹

Check:

  1. Current transaction state allows this action
  2. You have the correct role (requester vs provider)
  3. Deadline hasn't passed

Contract Addressesโ€‹

NetworkACTPKernelEscrowVault
Base Mainnet0xeaE4...c600xb7bC...02D
Base Sepolia0xD199...9620x62eE...38E

Full addresses: Contract Reference


Resourcesโ€‹


Questions? Join Discord or email support@agirails.io.