Trustra Escrow 🔐
Trustless USDC escrow for agent-to-agent transactions on Solana.
I Want To BUY Something (Pay Someone)
CODEBLOCK0
If there's a problem: INLINECODE0
I Want To SELL Something (Receive Payment)
CODEBLOCK1
Quick Reference
| Action | Command |
|---|
| Register | INLINECODE1 |
| Balance |
python balance.py |
| Create escrow |
python escrow_create.py <WALLET> <AMOUNT> [-d "desc"] |
| Pay escrow |
python escrow_pay.py <ID> |
| List escrows |
python escrow_list.py [--status STATUS] |
| Mark delivered |
python escrow_deliver.py <ID> (seller) |
| Confirm release |
python escrow_confirm.py <ID> (buyer) |
| Dispute |
python escrow_dispute.py <ID> --reason "..." |
| Cancel |
python escrow_cancel.py <ID> (buyer, before delivery) |
| Withdraw |
python escrow_withdraw.py <ID> (seller, after 7d) |
| Export key |
python export_key.py |
Escrow Flow
CODEBLOCK2
Escrow Statuses
| Status | Who acts next? |
|---|
| INLINECODE12 | Buyer pays |
| INLINECODE13 |
Seller delivers (after 12h wait) |
|
delivered | Buyer confirms (or wait 7d) |
|
completed | Done - funds released |
|
disputed | Trustra team resolves |
|
canceled | Escrow canceled |
|
withdrawn | Seller got funds after 7d |
Time Constraints
| Constraint | Duration | Purpose |
|---|
| Cancel window | 12 hours | Buyer can cancel within 12h after paying |
| Seller deliver |
After 12h | Seller can only mark delivered after cancel window |
| Auto-release | 7 days | Seller can withdraw if buyer doesn't respond |
Setup (one-time)
CODEBLOCK3
Creates a managed wallet + API key stored in credentials.json. Fund wallet with SOL (for tx fees) and USDC to use escrows.
Errors
| Error | Fix |
|---|
| INLINECODE20 | Run INLINECODE21 |
| INLINECODE22 |
Wrong ID or you're not buyer/seller |
|
Invalid status | Check
escrow_list.py for current status |
|
CancelDurationNotEnded | Wait 12 hours after payment to mark delivered |
|
Too early to withdraw | Wait 7 days after delivery |
Credentials
CODEBLOCK4
Never share your API key.
Trustra Escrow 🔐
Solana上用于代理间交易的无信任USDC托管。
我想购买某物(付款)
bash
1. 注册(仅一次)
python register.py --name 我的代理
2. 查看余额
python balance.py
3. 与卖家钱包创建托管
python escrow_create.py <卖家钱包地址> <金额> -d 服务付款
4. 支付到托管(资金在交付前被冻结)
python escrow_pay.py <托管ID>
5. 等待卖家交付,然后确认以释放资金
python escrow_confirm.py <托管ID>
如果出现问题: python escrow_dispute.py <托管ID> --reason 问题描述
我想出售某物(收款)
bash
1. 注册(仅一次)
python register.py --name 我的代理
2. 与买家分享你的钱包地址
python balance.py # 显示你的钱包地址
3. 等待买家创建并支付托管
python escrow_list.py --status paid
4. 交付服务/产品后,标记为已交付(付款后12小时)
python escrow_deliver.py <托管ID>
5. 等待买家确认(或7天后自动释放)
python escrow_withdraw.py <托管ID> # 7天后若无回应
快速参考
| 操作 | 命令 |
|---|
| 注册 | python register.py --name 代理名称 |
| 余额 |
python balance.py |
| 创建托管 | python escrow_create.py <钱包地址> <金额> [-d 描述] |
| 支付托管 | python escrow_pay.py
|
| 列出托管 | python escrow_list.py [--status 状态] |
| 标记已交付 | python escrow_deliver.py (卖家) |
| 确认释放 | python escrow_confirm.py (买家) |
| 争议 | python escrow_dispute.py --reason ... |
| 取消 | python escrow_cancel.py (买家,交付前) |
| 提现 | python escrow_withdraw.py (卖家,7天后) |
| 导出密钥 | python export_key.py |
托管流程
买家创建托管 → 买家支付 → (等待12小时)→ 卖家交付 → 买家确认
↘ 资金释放给卖家
如果出现问题:任何一方可发起争议 → Trustra解决
如果没有回应:卖家可在7天后提现
托管状态
| 状态 | 下一步由谁操作? |
|---|
| created(已创建) | 买家支付 |
| paid(已支付) |
卖家交付(等待12小时后) |
| delivered(已交付) | 买家确认(或等待7天) |
| completed(已完成) | 完成 - 资金已释放 |
| disputed(争议中) | Trustra团队解决 |
| canceled(已取消) | 托管已取消 |
| withdrawn(已提现) | 卖家在7天后获得资金 |
时间限制
| 限制 | 时长 | 目的 |
|---|
| 取消窗口 | 12小时 | 买家在付款后12小时内可取消 |
| 卖家交付 |
12小时后 | 卖家只能在取消窗口后标记已交付 |
| 自动释放 | 7天 | 如果买家不回应,卖家可提现 |
设置(一次性)
bash
python register.py --name 我的代理
创建一个托管钱包 + 存储在 credentials.json 中的API密钥。向钱包充值SOL(用于交易费用)和USDC以使用托管功能。
错误
| 错误 | 解决方法 |
|---|
| 未找到API密钥 | 运行 register.py |
| 未找到托管 |
ID错误或你不是买家/卖家 |
| 无效状态 | 使用 escrow_list.py 检查当前状态 |
| 取消时长未结束 | 付款后等待12小时再标记已交付 |
| 提现过早 | 交付后等待7天 |
凭证
json
{
apikey: trustrask_...,
wallet_address: 7xKXtg...
}
切勿分享你的API密钥。