Create NLA Escrow
Help the user create a blockchain escrow backed by a natural language demand using the nla CLI.
Overview
An NLA escrow locks ERC20 tokens on-chain. Anyone can attempt to fulfill the escrow's natural language demand. An AI oracle evaluates fulfillments and releases the tokens if the demand is satisfied.
Step-by-step instructions
1. Gather requirements
Collect the following from the user conversationally:
Required:
- - Demand: The natural language condition that must be fulfilled. Help the user craft something clear and unambiguous.
- Amount: Number of tokens to escrow (in the token's smallest unit - no automatic decimal conversion).
- Token address: ERC20 token contract address (
0x...). - Oracle address: Address of the oracle that will arbitrate.
Optional:
- - Arbitration provider:
OpenAI (default), Anthropic, or OpenRouter. - Arbitration model: e.g.
gpt-4o-mini (default), claude-3-5-sonnet-20241022, openai/gpt-4o. - Arbitration prompt: Custom prompt template with
{{demand}} and {{obligation}} placeholders.
2. Check prerequisites
CODEBLOCK0
If no wallet is configured, the user must either:
- - Run INLINECODE10
- Pass
--private-key <key> to the command - Set the
PRIVATE_KEY environment variable
3. Help craft the demand
Guide the user to write an effective demand:
- - Be specific and evaluable by an LLM
- Consider: what counts as valid fulfillment? Is the condition verifiable?
- For claims requiring real-world knowledge, suggest models with search (Perplexity search is available if the oracle has it configured)
- The demand, provider, model, and prompt are all encoded on-chain and publicly visible - never include secrets
4. Execute escrow creation
CODEBLOCK1
5. Record output
The command outputs an escrow UID (0x...). This UID is needed for fulfillment and collection. Present it clearly to the user and explain next steps.
Key details
- - Available networks:
anvil (local), sepolia, base-sepolia, mainnet. Switch with nla switch <network>. - For local dev,
nla dev starts Anvil, deploys contracts, creates mock tokens, and starts the oracle. - Public demo oracle on Sepolia:
0xc5c132B69f57dAAAb75d9ebA86cab504b272Ccbc. - Default arbitration prompt:
CODEBLOCK2
Example
CODEBLOCK3
创建NLA托管
帮助用户使用nla CLI创建由自然语言需求支持的区块链托管。
概述
NLA托管在链上锁定ERC20代币。任何人都可以尝试满足托管的自然语言需求。AI预言机评估履行情况,并在需求得到满足时释放代币。
分步说明
1. 收集需求
通过对话方式向用户收集以下信息:
必填项:
- - 需求:必须满足的自然语言条件。帮助用户制定清晰明确的表述。
- 数量:托管代币数量(以代币最小单位计 - 不自动进行小数转换)。
- 代币地址:ERC20代币合约地址(0x...)。
- 预言机地址:负责仲裁的预言机地址。
可选项:
- - 仲裁提供商:OpenAI(默认)、Anthropic或OpenRouter。
- 仲裁模型:例如gpt-4o-mini(默认)、claude-3-5-sonnet-20241022、openai/gpt-4o。
- 仲裁提示词:自定义提示词模板,包含{{demand}}和{{obligation}}占位符。
2. 检查前置条件
bash
验证CLI是否可用
which nla
检查当前网络
nla network
检查钱包配置
nla wallet:show
如果未配置钱包,用户必须:
- - 运行nla wallet:set --private-key
- 或在命令中传入--private-key
- 或设置PRIVATE_KEY环境变量
3. 帮助制定需求
引导用户编写有效的需求:
- - 具体明确且可由LLM评估
- 考虑:什么算有效履行?条件是否可验证?
- 对于需要现实世界知识的声明,建议使用带搜索功能的模型(如果预言机配置了Perplexity搜索)
- 需求、提供商、模型和提示词均编码在链上且公开可见 - 切勿包含机密信息
4. 执行托管创建
bash
nla escrow:create \
--demand <需求文本> \
--amount <数量> \
--token <代币地址> \
--oracle <预言机地址> \
[--arbitration-provider <提供商>] \
[--arbitration-model <模型>] \
[--arbitration-prompt <提示词>]
5. 记录输出
命令输出托管UID(0x...)。该UID用于履行和收款。向用户清晰展示并说明后续步骤。
关键信息
- - 可用网络:anvil(本地)、sepolia、base-sepolia、mainnet。使用nla switch 切换。
- 本地开发时,nla dev启动Anvil、部署合约、创建模拟代币并启动预言机。
- Sepolia上的公共演示预言机:0xc5c132B69f57dAAAb75d9ebA86cab504b272Ccbc。
- 默认仲裁提示词:
根据需求评估履行情况,并判断需求是否得到有效满足
需求:{{demand}}
履行:{{obligation}}
示例
bash
nla escrow:create \
--demand 提供P不等于NP的有效证明 \
--amount 1000000 \
--token 0xa513e6e4b8f2a923d98304ec87f64353c4d5c853 \
--oracle 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
--arbitration-provider Anthropic \
--arbitration-model claude-3-5-sonnet-20241022