nexus-xyz/nexus-cli
GitHub: nexus-xyz/nexus-cli
Nexus CLI 是一款用于向 Nexus 去中心化零知识证明网络贡献计算算力的高性能命令行工具。
Stars: 1136 | Forks: 665
[](https://github.com/nexus-xyz/nexus-cli/releases)
[](https://github.com/nexus-xyz/nexus-cli/actions)
[](https://github.com/nexus-xyz/nexus-cli/blob/main/LICENSE-APACHE)
[](https://github.com/nexus-xyz/nexus-cli/blob/main/LICENSE-MIT)
[](https://x.com/NexusLabs)
[](https://discord.com/invite/nexus-xyz)
# Nexus CLI
一个用于向 Nexus 网络贡献 proofs 的高性能命令行界面。
## Nexus 网络
[Nexus 网络](https://app.nexus.xyz/compute)将来自世界各地节点的计算能力统一到一个可验证的系统状态中。[了解更多](https://docs.nexus.xyz/network)。
到目前为止已经进行了几次测试网:
- Testnet 0:[2024年10月8日 – 28日](https://blog.nexus.xyz/nexus-launches-worlds-first-open-prover-network/)
- Testnet I:[2024年12月9日 – 13日](https://blog.nexus.xyz/the-new-nexus-testnet-is-live/)
- Testnet II:[2025年2月18日 – 22日](https://blog.nexus.xyz/testnet-ii-is-open/)
- Devnet:[2025年2月22日 - 6月20日](https://docs.nexus.xyz/network/proving-on-the-layer-1/nexus-layer-1-devnet)
- Testnet III:[进行中](https://blog.nexus.xyz/live-everywhere/)
## 快速开始
### 安装
#### 预编译二进制文件(推荐)
为了获得最简单且最可靠的安装体验:
```
curl https://cli.nexus.xyz/ | sh
```
这会下载最新的二进制文件,提示接受使用条款,并启动交互模式。
#### 非交互式安装
用于自动化安装(例如在 CI 中):
```
curl -sSf https://cli.nexus.xyz/ -o install.sh
chmod +x install.sh
NONINTERACTIVE=1 ./install.sh
```
### 证明
使用 CLI 进行 proving 的文档在[这里](https://docs.nexus.xyz/network/proving-on-the-layer-1/contribute-via-cli)。
要使用现有的 node ID 开始,请运行:
```
nexus-compute-cli start --node-id
```
或者,你可以使用 CLI 或在 [app.nexus.xyz](https://app.nexus.xyz) 注册你的钱包地址并创建 node ID。
```
nexus-compute-cli register-user --wallet-address
nexus-compute-cli register-node --node-id
nexus-compute-cli start
```
要以非交互方式运行 CLI,你也可以选择在 headless 模式下启动它。
```
nexus-compute-cli start --headless
```
#### 快速参考
`register-user` 和 `register-node` 命令会将你的凭证保存到 `~/.nexus/config.json` 中。要清除凭证,请运行:
```
nexus-compute-cli logout
```
要进行故障排除或查看可用的命令行选项,请运行:
```
nexus-compute-cli --help
```
### 自适应任务难度
Nexus CLI 具有一个**自适应难度系统**,可根据你的节点性能自动调整任务难度。这可确保最佳的资源利用率,同时防止系统过载。
#### 工作原理
- **启动于**:`small` 难度
- **自动提升**:如果任务在 < 7 分钟内完成
#### 何时覆盖难度
**较低难度**(例如 `Small` 或 `SmallMedium`):
- 资源受限的系统
- 与其他应用程序一起进行的后台处理
- 测试/开发环境
- 电池供电的设备
**较高难度**(例如 `Large`、`ExtraLarge` 或 `ExtraLarge2`):
- 高性能硬件(8+ 核心,16+ GB RAM)
- 专用 proving 机器
- 最大奖励优化
#### 使用难度覆盖
```
# 降低资源受限系统的难度
nexus-compute-cli start --max-difficulty small
nexus-compute-cli start --max-difficulty small_medium
# 提高强大硬件的难度
nexus-compute-cli start --max-difficulty medium
nexus-compute-cli start --max-difficulty large
nexus-compute-cli start --max-difficulty extra_large
nexus-compute-cli start --max-difficulty extra_large_2
nexus-compute-cli start --max-difficulty extra_large_3
nexus-compute-cli start --max-difficulty extra_large_4
# 如果没有 extra_large_5 任务可用,则等同于 extra_large_4
nexus-compute-cli start --max-difficulty extra_large_5
# 不区分大小写(全部等同)
nexus-compute-cli start --max-difficulty MEDIUM
nexus-compute-cli start --max-difficulty medium
nexus-compute-cli start --max-difficulty Medium
```
#### 难度指南
| 难度 | 用例 |
|------------|----------|
| `small` | 默认,起始任务 |
| `small_medium` | 建立声誉 |
| `medium` 和 `large` | 标准桌面/笔记本电脑 |
| `extra_large` 及以上 | 高性能系统,更多积分 |
#### 难度问题故障排除
**任务耗时过长:**
尝试降低难度。
```
nexus-compute-cli start --max-difficulty small_medium
```
**想要更具挑战性的任务:**
请求更高的难度。不过,积累声誉以达到所请求的难度仍需一定时间。
```
nexus-compute-cli start --max-difficulty extra_large_2
```
**不确定系统的性能:**
- 使用默认的自适应系统(不需要 `--max-difficulty`)
- 系统会自动为你的硬件找到最佳难度
- 仅在你想要微调性能时才进行覆盖
### Docker 安装
用于容器化部署:
1. 安装 [Docker](https://docs.docker.com/engine/install/) 和 [Docker Compose](https://docs.docker.com/compose/install/)
2. 更新 `docker-compose.yaml` 中的 node ID
3. 构建并运行:
```
docker compose build --no-cache
docker compose up -d
docker compose logs # Check logs
docker compose down # Shutdown
```
## 使用条款
使用 CLI 需遵守[使用条款](https://nexus.xyz/terms-of-use)。
首次运行交互模式的用户将被提示接受这些条款。
## Node ID
在 CLI 启动期间,系统会要求你提供 node ID。为了在非交互环境中跳过提示,请
手动创建一个如下格式的 `~/.nexus/config.json`:
```
{
"node_id": ""
}
```
## 获取帮助
- [网络常见问题](https://docs.nexus.xyz/network/proving-on-the-layer-1/faq)
- [Discord 社区](https://discord.gg/nexus-xyz)
- 遇到技术问题?[提交 issue](https://github.com/nexus-xyz/nexus-cli/issues)
- 要向网络提交程序以供 proving,请联系
[growth@nexus.xyz](mailto:growth@nexus.xyz)。
### 🛠 开发者指南
为了搭建一个为项目贡献代码的开发环境,可能需要执行以下步骤:
#### Linux
```
sudo apt update
sudo apt upgrade
sudo apt install build-essential pkg-config libssl-dev git-all
sudo apt install protobuf-compiler
```
#### macOS
```
# 使用 Homebrew 安装
brew install protobuf
# 验证安装
protoc --version
```
#### Windows
[安装 WSL](https://learn.microsoft.com/en-us/windows/wsl/install),
然后参考上面的 Linux 说明。
```
# 使用 Chocolatey 安装
choco install protobuf
```
## 许可证
Nexus CLI 是在 [MIT 许可证](./LICENSE-MIT)和 [Apache 许可证 (版本 2.0)](./LICENSE-APACHE) 双重条款下分发的。
标签:Rust, 分布式网络, 区块链, 可视化界面, 版权保护, 网络流量审计, 请求拦截, 通知系统, 零知识证明