本地网

其他 社区

技能解读

当前原文的自动摘译,尚未人工审校。

先决条件

在开始之前,请确保: Docker 正在运行 合约并且已构建来宾二进制文件: forge build && cargo check 来宾 ELF 二进制文件存在于 target/riscv-guest/(由 cargo check 构建)

开发模式(默认,快速——假证明)

使用RISC0_DEV_MODE=1。证据是伪造的,所以一切都是即时的。代理作为 docker compose 集群的一部分运行——不需要单独的终端。最适合测试请求流、合约交互和集成。

完整证明模式(真实证明,需要 GPU 或 Bento 集群)

使用RISC0_DEV_MODE=false。代理不包含在 localnet 集群中。使用just prover(便当+经纪人)单独启动它。需要一个证明后端(本地 GPU 或 Bento 集群)。

开发模式

在前台运行just localnet(不是作为后台任务)。它负责部署合约并启动所有服务 - 在提交请求之前等待其完成。这避免了在部署程序运行时需要轮询容器状态。在 just localnet 命令上显式设置 RISC0_DEV_MODE 以避免从终端环境继承过时的值。其他命令不需要它 - source .env.localnet 设置它。

完整验证模式

在 just localnet 命令上显式设置 RISC0_DEV_MODE=false 以避免从终端环境继承过时的值。其他命令不需要它 - source .env.localnet 设置它。

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
通用
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@tomevault-io · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需简单配置
是否需要外部接口密钥
不需要
兼容的系统
Docker
运行环境要求
Docker
检测到的文件与系统行为
  • 只读
  • 读取环境变量
网络行为
允许外网请求
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Boundless Localnet

Guide the user through starting and using the docker compose-based localnet.

## Prerequisites

Before starting, ensure:

- Docker is running
- Contracts and guest binaries are built: `forge build && cargo check`
- Guest ELF binaries exist at `target/riscv-guest/` (built by `cargo check`)

## Choose Mode

Ask the user which mode they want (default to dev mode):

### Dev Mode (default, fast — fake proofs)

Uses `RISC0_DEV_MODE=1`. Proofs are faked so everything is instant. The broker runs as part of the docker compose cluster — no separate terminal needed. Best for testing request flow, contract interactions, and integration.

### Full Proving Mode (real proofs, requires GPU or Bento cluster)

Uses `RISC0_DEV_MODE=false`. The broker is NOT included in the localnet cluster. Start it separately with `just prover` (Bento + broker). Requires a proving backend (local GPU or Bento cluster).

## Starting Localnet

### Dev Mode

**Run `just localnet` in the foreground** (not as a background task). It handles deploying contracts and starting all services — wait for it to complete before submitting requests. This avoids needing to poll container status while the deployer runs.

**Explicitly set `RISC0_DEV_MODE` on the `just localnet` command** to avoid inheriting a stale value from the terminal environment. Other commands don't need it — `source .env.localnet` sets it.

```bash
# Start the full localnet (anvil + postgres + minio + order-stream + broker)
# Run in foreground — wait for it to finish before proceeding
RISC0_DEV_MODE=1 just localnet
```

#### Submitting a test request

Submit in a **background task**, then monitor status through order-stream, on-chain, and broker logs while it waits for fulfillment.

For **immediate broker acceptance**, the offer's `min-price` must exceed the broker's minimum profitable price (gas costs + min_mcycle_price). On anvil, gas costs are ~0.00003 ETH, so `0.0001 ETH` is safely above the threshold. The price starts at `min-price` before `rampUpStart` (defaults to `now() + 30s`), so setting `min-price` high enough means the broker accepts before the ramp even begins.

```bash
source .env.localnet && cargo run --example submit_echo -- \
  --bidding-start "$(date +%s)" \
  --min-price "0.0001 ETH" \
  --max-price "0.0004 ETH"
```

**Why these values:**

- `--bidding-start "$(date +%s)"`: Sets `rampUpStart` to now. Without this, the default is `now() + 30s` (`DEFAULT_BASE_RAMP_UP_DELAY`), which delays when the auction begins.
- `--min-price "0.0001 ETH"`: Above broker's minimum profitable price (~0.00003 ETH gas on anvil). If min-price is too low, the broker schedules a delayed lock attempt and waits for the auction price to ramp up past its threshold.
- `--max-price "0.0004 ETH"`: ~4x min-price, reasonable ceiling

### Full Proving Mode

**Explicitly set `RISC0_DEV_MODE=false` on the `just localnet` command** to avoid inheriting a stale value from the terminal environment. Other commands don't need it — `source .env.localnet` sets it.

```bash
# Terminal 1: Start the localnet (anvil + postgres + minio + order-stream, NO broker)
RISC0_DEV_MODE=false just localnet

# Terminal 2: Start the prover cluster (Bento + broker)
source .env.localnet && just prover

# Terminal 3: Submit a test request
source .env.localnet && cargo run --example submit_echo -- \
  --bidding-start "$(date +%s)" \
  --min-price "0.0001 ETH" \
  --max-price "0.0004 ETH"
```

## Checking Order Status

After submitting a request, you'll see a request ID like:

```
Submitted request: 90f79bf6eb2c4f870365e785982e1f101e93b9061d289271
```

### Query the order-stream

Note: the `limit` query parameter is required.

```bash
# List recent orders
curl -s "http://localhost:8585/api/v1/orders?limit=10" | jq .

# Query a specific order by request ID
curl -s "http://localhost:8585/api/v1/orders?request_id=<REQUEST_ID>&limit=10" | jq .
```

### Check request status from broker logs

Use broker logs to extract the requestor-relevant milestones. The user cares about **when** the request was submitted, locked, and fulfilled, plus the **fulfilled price** — not the internal proving pipeline steps.

```bash
# Dev mode: broker runs in compose
docker compose -f dockerfiles/compose.localnet.yml --profile dev-broker logs broker 2>&1 | grep <REQUEST_ID>
```

Key log lines to look for:

- `Locked request <ID>` — when the broker locked it
- `Completed order: <ID> eth_reward: <PRICE>` — when it was fulfilled and at what price
- The order's `created_at` field from the order-stream query shows submission time

Present status to the user as:

| Event     | Time                                |
| --------- | ----------------------------------- |
| Submitted | (from order-stream `created_at`)    |
| Locked    | (from broker log "Locked request")  |
| Fulfilled | (from broker log "Completed order") |

**Fulfilled price:** (from `eth_reward` in the "Completed order" log line)

### Check order-stream logs

```bash
docker compose -f dockerfiles/compose.localnet.yml logs order-stream

# Watch live
docker compose -f dockerfiles/compose.localnet.yml logs -f order-stream
```

## Stopping

```bash
# Stop localnet (preserves anvil state for restart)
just localnet down

# Stop and wipe all state (fresh start)
just localnet clean
```

## Troubleshooting

### Request stuck at "Unknown"

- Check order-stream logs — did it receive the order?
- If `Broadcasted order ... to 0 clients`, the broker isn't connected to the WebSocket
- In dev mode, check broker container is running: `docker compose -f dockerfiles/compose.localnet.yml --profile dev-broker ps`

### Broker delays lock ("scheduled for lock attempt in Ns")

The broker waits until the auction price exceeds its minimum profitable price (gas costs + min_mcycle_price). To avoid this delay, set `--min-price` above the broker's gas cost threshold (~0.0001 ETH on anvil). The price sits at `min-price` before `rampUpStart` (default `now() + 30s`), so a sufficiently high `min-price` means instant acceptance.

### Broker not picking up orders

- Check that `--min-price` is high enough to cover gas + min_mcycle_price
- Check broker's `min_mcycle_price` in `broker.toml` vs the offer price

### Price oracle errors on anvil

- Ensure `broker.toml` has the `[price_oracle]` section with static prices and chainlink disabled. `just localnet` adds this automatically.

### Port conflicts

- Localnet uses ports: 8545 (anvil), 8585 (order-stream), 5435 (postgres), 9100/9101 (minio)
- Check for conflicts: `ss -tlnp | grep -E '8545|8585|5435|9100'`

---
> Source: [boundless-xyz/boundless](https://github.com/boundless-xyz/boundless) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。