Fulfill NLA Escrow
Help the user fulfill an on-chain escrow by submitting text that satisfies the escrow's demand, then collect the tokens if approved.
Step-by-step instructions
1. Understand the escrow
Get the escrow UID from the user, then check what it demands:
CODEBLOCK0
This shows:
- - The demand text
- Arbitration model and provider
- Oracle address
- Any existing fulfillments and their arbitration status
2. Craft the fulfillment
Help the user write fulfillment text that satisfies the demand:
- - Read the demand carefully
- The fulfillment text is what the AI arbitrator evaluates against the demand
- Be specific and directly address what the demand asks for
- The default arbitration prompt evaluates whether the "fulfillment" satisfies the "demand" and returns true/false
3. Submit the fulfillment
CODEBLOCK1
This runs a multi-step on-chain commit-reveal flow:
- 1. Computes a commitment hash
- Submits the commitment with a bond
- Waits for next block confirmation
- Reveals the fulfillment obligation
- Reclaims the bond
- Requests arbitration from the oracle
The command outputs a fulfillment UID - record this for collection.
4. Monitor arbitration
Check if the oracle has made a decision:
CODEBLOCK2
The oracle typically responds within seconds if it's running. Look for "APPROVED" or "REJECTED" in the output.
5. Collect tokens (if approved)
Once the oracle approves:
CODEBLOCK3
This transfers the escrowed tokens to the fulfiller.
Key details
- - The fulfillment text is permanently recorded on-chain
- The commit-reveal process requires gas for multiple transactions
- If rejected, the tokens stay in escrow - another fulfillment attempt can be made by anyone
- The oracle address must match what was specified when the escrow was created (visible in status output)
- Collection only succeeds after the oracle records an approval
Prerequisites
- -
nla CLI installed and configured - Private key set via
nla wallet:set, --private-key flag, or PRIVATE_KEY env var - ETH in the fulfiller's account for gas
- The oracle must be running (or use the public demo on Sepolia)
Example full flow
CODEBLOCK4
履行NLA托管
通过提交满足托管需求的文本,帮助用户履行链上托管,并在批准后领取代币。
分步指南
1. 了解托管
从用户处获取托管UID,然后检查其需求:
bash
nla escrow:status --escrow-uid
这将显示:
- - 需求文本
- 仲裁模型和提供商
- 预言机地址
- 任何已有的履行及其仲裁状态
2. 撰写履行内容
帮助用户编写满足需求的履行文本:
- - 仔细阅读需求
- 履行文本是AI仲裁员评估是否符合需求的依据
- 要具体且直接回应需求所要求的内容
- 默认仲裁提示评估履行是否满足需求并返回true/false
3. 提交履行
bash
nla escrow:fulfill \
--escrow-uid \
--fulfillment <履行文本> \
--oracle
这将运行一个多步骤的链上提交-揭示流程:
- 1. 计算承诺哈希
- 提交承诺并质押保证金
- 等待下一个区块确认
- 揭示履行义务
- 收回保证金
- 向预言机请求仲裁
该命令输出一个履行UID - 请记录此信息以便后续领取。
4. 监控仲裁
检查预言机是否已做出决定:
bash
nla escrow:status --escrow-uid
如果预言机正在运行,通常会在几秒内响应。在输出中查找APPROVED或REJECTED。
5. 领取代币(如果批准)
一旦预言机批准:
bash
nla escrow:collect \
--escrow-uid \
--fulfillment-uid
这将把托管中的代币转移给履行者。
关键细节
- - 履行文本将永久记录在链上
- 提交-揭示流程需要为多笔交易支付Gas费
- 如果被拒绝,代币仍留在托管中 - 任何人都可以再次尝试履行
- 预言机地址必须与创建托管时指定的地址匹配(在状态输出中可见)
- 只有在预言机记录批准后,领取才能成功
前提条件
- - 已安装并配置nla CLI
- 通过nla wallet:set、--private-key标志或PRIVATE_KEY环境变量设置私钥
- 履行者账户中有ETH用于支付Gas费
- 预言机必须正在运行(或使用Sepolia上的公共演示)
完整流程示例
bash
1. 检查托管需求
nla escrow:status --escrow-uid 0xabc123...
2. 提交履行
nla escrow:fulfill \
--escrow-uid 0xabc123... \
--fulfillment 天空呈现蓝色是由于瑞利散射 \
--oracle 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
3. 检查仲裁结果
nla escrow:status --escrow-uid 0xabc123...
4. 如果批准则领取
nla escrow:collect \
--escrow-uid 0xabc123... \
--fulfillment-uid 0xdef456...