network-api/clients/cli
2024-10-26 22:06:02 +07:00
..
src feat: increase precision of proving speed, release-only analytics (#19) 2024-10-23 12:04:17 -07:00
.gitignore feat: Initial check-in of prover CLI (#2) 2024-09-05 12:45:22 -07:00
build.rs feat!: Update README with latest naming, prompting for acceptance of terms, noninteractive mode, replace keep_proving with just_once (#5) 2024-10-03 15:31:23 -07:00
Cargo.lock feat!: Update README with latest naming, prompting for acceptance of terms, noninteractive mode, replace keep_proving with just_once (#5) 2024-10-03 15:31:23 -07:00
Cargo.toml docs: Update installation instructions with prerequisites, links (#18) 2024-10-23 11:47:15 -07:00
README.md update README file to support whoever runs with CLI 2024-10-26 22:06:02 +07:00

Network CLI

The command line interface (CLI) lets you run a Nexus prover node. It is the highest-performance option for proving.

Prerequisites

If you don't have these dependencies already, install them first.

Linux

sudo apt update
sudo apt upgrade
sudo apt install build-essential pkg-config libssl-dev git-all

macOS

If you have installed Homebrew to manage packages on OS X, run this command to install Git.

brew install git

Windows

Install WSL, then see Linux instructions above.

Quick start

curl https://cli.nexus.xyz/ | sh

If you do not already have Rust, you will be prompted to install it.

Terms of Use

Use of the CLI is subject to the Terms of Use. The first time you run it, it prompts you to accept the terms. To accept the terms noninteractively (for example, in a continuous integration environment), add NONINTERACTIVE=1 before sh.

Turning out the nexus process to run as a service (optional)

Note: This will help anyone who runs cli whose process is stopped after a period of time, will be automatically restarted by systemd and continue the process without having to do it manually again.

Update nexus.sh file

  • To accept the terms noninteractively
  • Specify absolute path of cargo and rustc
sed -i 's|rustc|/root/.cargo/bin/rustc|g' nexus.sh
sed -i 's|cargo|/root/.cargo/bin/cargo|g' nexus.sh

sed -i '5i NONINTERACTIVE=1' nexus.sh

Create a systemd service

nano /etc/systemd/system/nexus.service

and input this configuration

[Unit]
Description=Nexus Process
After=network.target

[Service]
ExecStart=/root/nexus.sh  # <==== make sure to change this file location to match where you put the file
Restart=on-failure
RestartSec=5
RestartPreventExitStatus=127
SuccessExitStatus=127
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

save and exit

ctrl + o (save)
ctrl + x (exit the editor)

Reload the systemd daemon

sudo systemctl daemon-reload

Start and Enable the Service

sudo systemctl start nexus.service
sudo systemctl enable nexus.service

Check the Status (waiting for a few minutes to let it build the code)

sudo systemctl status nexus.service

something like this, this is ok

● nexus.service - Nexus Process
     Loaded: loaded (/etc/systemd/system/nexus.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2024-10-26 16:23:13 CEST; 2min 16s ago
   Main PID: 951443 (nexus.sh)
      Tasks: 34 (limit: 77071)
     Memory: 1.2G
        CPU: 1min 14.009s
     CGroup: /system.slice/nexus.service
             ├─951443 /bin/sh /root/nexus/nexus.sh
             └─951458 target/release/prover beta.orchestrator.nexus.xyz

Oct 26 16:23:40 vmi2192653.contaboserver.net nexus.sh[951458]: Proved step 14 at 3.85 proof cycles/sec.
Oct 26 16:23:41 vmi2192653.contaboserver.net nexus.sh[951458]: Proved step 15 at 4.16 proof cycles/sec.
Oct 26 16:23:42 vmi2192653.contaboserver.net nexus.sh[951458]: Proved step 16 at 3.80 proof cycles/sec.

Monitor the Logs

journalctl -u nexus.service -f

ctrl + c to exit

Known issues

  • Only the latest version of the CLI is currently supported.
  • Prebuilt binaries are not yet available.
  • Counting cycles proved is not yet available in the CLI.
  • Only proving is supported. Submitting programs to the network is in private beta. To request an API key, contact us at growth@nexus.xyz.

Resources