ClawPay — Escrow Payments for AI Agents
You can send and receive trustless escrow payments on Solana using ClawPay. This skill handles the full payment lifecycle: locking funds, confirming delivery, releasing payments, and checking receipts.
Setup
First, check if clawpay is installed:
CODEBLOCK0
If not installed:
CODEBLOCK1
The user's Solana wallet keypair is required. Check for it at the path in the SOLANA_KEYPAIR_PATH environment variable, or look for common locations:
- - INLINECODE1
- INLINECODE2
- INLINECODE3
If no keypair is found, ask the user to provide one or generate one with solana-keygen new --outfile ~/wallet.json.
How ClawPay Works
ClawPay is a time-locked escrow protocol on Solana. Every payment follows this flow:
- 1. T0 — Lock: Buyer locks SOL into an escrow account
- T1 — Deliver: Seller must deliver before the deadline, or funds auto-refund to buyer
- T2 — Verify: Buyer confirms delivery, or funds auto-release to seller after the window
- Settle: 98% goes to seller, 1% to ClawPay, 1% to referrer (if any)
- Receipt: Cryptographic receipt minted on-chain for both parties
No trust required between agents. The timeline enforces everything.
Core Operations
Pay Another Agent (Create Escrow)
When asked to pay an agent or buy a service:
CODEBLOCK2
Default values if not specified:
- -
delivery_secs: 600 (10 minutes) - INLINECODE6 : 30 (30 seconds)
- INLINECODE7 : Ask the user — never assume an amount
Confirm Delivery (As Seller)
When you've completed a service and need to confirm delivery:
CODEBLOCK3
Release Funds (After Verification)
After the verification window passes, anyone can trigger release:
CODEBLOCK4
Refund (Missed Delivery Deadline)
If the seller missed the delivery deadline:
CODEBLOCK5
Check Escrow Status
CODEBLOCK6
Check Agent Reputation (Receipts)
CODEBLOCK7
Important Constraints
- - Minimum escrow: 0.05 SOL
- Maximum escrow: 10.0 SOL
- Minimum verification window: 10 seconds
- Maximum delivery time: 30 days
- Fee: 2% on settlement (1% ClawPay + 1% referrer)
- Network: Solana Mainnet (default) or Devnet
Guardrails
- - NEVER create an escrow without confirming the amount with the user first
- NEVER send funds without verifying the seller's public key
- Always display the escrow address after creation — the user needs it
- Always check escrow status before attempting release or refund
- If a keypair file is not found, ask the user — do not guess
- Report all errors clearly, especially insufficient balance errors
- When checking reputation, mention both successful and failed transactions for honesty
Verification
After any transaction, you can verify on Solana Explorer:
- - Program: https://explorer.solana.com/address/F2nwkN9i2kUDgjfLwHwz2zPBXDxLDFjzmmV4TXT6BWeD
- Transaction: https://explorer.solana.com/tx/TRANSACTION_SIGNATURE
Links
- - Website: https://claw-pay.com
- SDK: https://pypi.org/project/clawpay/
- GitHub: https://github.com/jakemeyer125-design/ClawPay-SDK
技能名称: clawpay
详细描述:
ClawPay — AI代理的托管支付
你可以使用ClawPay在Solana上发送和接收无需信任的托管支付。该技能处理完整的支付生命周期:锁定资金、确认交付、释放支付以及检查收据。
设置
首先,检查clawpay是否已安装:
bash
pip3 show clawpay
如果未安装:
bash
pip3 install clawpay
需要用户的Solana钱包密钥对。请在SOLANAKEYPAIRPATH环境变量指定的路径中查找,或检查常见位置:
- - ~/wallet.json
- ~/.config/solana/id.json
- ~/projects/clawpay/program-keypair.json
如果未找到密钥对,请要求用户提供,或使用solana-keygen new --outfile ~/wallet.json生成一个。
ClawPay的工作原理
ClawPay是Solana上的一个时间锁定托管协议。每笔支付遵循以下流程:
- 1. T0 — 锁定:买家将SOL锁定到托管账户
- T1 — 交付:卖家必须在截止日期前交付,否则资金自动退还给买家
- T2 — 验证:买家确认交付,否则窗口期过后资金自动释放给卖家
- 结算:98%归卖家,1%归ClawPay,1%归推荐人(如有)
- 收据:为双方铸造链上加密收据
代理之间无需信任。时间线强制执行一切。
核心操作
支付另一个代理(创建托管)
当被要求支付代理或购买服务时:
python
from clawpay import Client
from solders.keypair import Keypair
from solders.pubkey import Pubkey
keypair = Keypair.fromjson(open(KEYPAIRPATH).read())
client = Client(keypair)
escrow = client.create_escrow(
seller=Pubkey.fromstring(SELLERPUBKEY),
amount_sol=AMOUNT,
deliverysecs=DELIVERYTIME, # 交付截止时间(秒)
verificationsecs=VERIFICATIONTIME # 争议窗口期(秒,最少10秒)
)
print(f托管已创建:{escrow.address})
print(f金额:{escrow.amount_sol} SOL)
print(f交付截止时间:{escrow.t1})
print(f验证结束时间:{escrow.t2})
如果未指定,默认值如下:
- - deliverysecs:600(10分钟)
- verificationsecs:30(30秒)
- amount_sol:询问用户——切勿假设金额
确认交付(作为卖家)
当你完成服务并需要确认交付时:
python
from clawpay import Client
from solders.keypair import Keypair
from solders.pubkey import Pubkey
keypair = Keypair.fromjson(open(KEYPAIRPATH).read())
client = Client(keypair)
escrowaddress = Pubkey.fromstring(ESCROW_ADDRESS)
client.confirmdelivery(escrowaddress, keypair)
print(交付已确认。等待验证窗口期。)
释放资金(验证后)
验证窗口期过后,任何人都可以触发释放:
python
client.autorelease(Pubkey.fromstring(ESCROW_ADDRESS))
print(资金已释放给卖家。)
退款(错过交付截止时间)
如果卖家错过了交付截止时间:
python
client.autorefund(Pubkey.fromstring(ESCROW_ADDRESS))
print(资金已退还给买家。)
检查托管状态
python
escrow = client.getescrow(Pubkey.fromstring(ESCROW_ADDRESS))
print(f状态:{escrow.status})
print(f金额:{escrow.amount_sol} SOL)
print(f已交付:{escrow.delivered})
print(f已释放:{escrow.released})
检查代理声誉(收据)
python
receipts = client.getreceipts(Pubkey.fromstring(AGENT_PUBKEY))
print(f总交易数:{len(receipts)})
for r in receipts:
outcome = [已释放, 已退款, 有争议][r.outcome]
print(f #{r.receiptindex}:{r.amountsol} SOL — {outcome})
重要限制
- - 最低托管金额:0.05 SOL
- 最高托管金额:10.0 SOL
- 最低验证窗口期:10秒
- 最长交付时间:30天
- 费用:结算时2%(1% ClawPay + 1% 推荐人)
- 网络:Solana主网(默认)或开发网
安全护栏
- - 未经用户确认金额,切勿创建托管
- 未经核实卖家公钥,切勿发送资金
- 创建后始终显示托管地址——用户需要它
- 在尝试释放或退款前,始终检查托管状态
- 如果未找到密钥对文件,请询问用户——不要猜测
- 清晰报告所有错误,尤其是余额不足错误
- 检查声誉时,为诚实起见,同时提及成功和失败交易
验证
任何交易后,你可以在Solana浏览器上验证:
- - 程序:https://explorer.solana.com/address/F2nwkN9i2kUDgjfLwHwz2zPBXDxLDFjzmmV4TXT6BWeD
- 交易:https://explorer.solana.com/tx/TRANSACTION_SIGNATURE
链接
- - 网站:https://claw-pay.com
- SDK:https://pypi.org/project/clawpay/
- GitHub:https://github.com/jakemeyer125-design/ClawPay-SDK