-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,73 +16,147 @@ A high-performance command-line interface for contributing proofs to the Nexus n | |
|
||
The [Nexus Network](https://docs.nexus.xyz/network) is a global distributed prover network that unites the world's computers to power a new and better Internet: the Verifiable Internet. | ||
|
||
There have been two testnets: | ||
There have been two testnets so far: | ||
- First testnet: [October 08 – 28, 2024](https://blog.nexus.xyz/nexus-launches-worlds-first-open-prover-network/) | ||
- Second testnet: [December 9 – 13, 2024](https://blog.nexus.xyz/the-new-nexus-testnet-is-live/) | ||
|
||
- The first testnet period was in [October 08 to 28 2024](https://blog.nexus.xyz/nexus-launches-worlds-first-open-prover-network/). | ||
- The second testnet period was in [December 9 to 13, 2024](https://blog.nexus.xyz/the-new-nexus-testnet-is-live/). | ||
|
||
**Important:** *The Nexus network is currently in devnet. It is important to note that you cannot earn Nexus points. Instead, devnet allows developers to experiment and build with the network. Stay tuned for updates regarding future testnets.* | ||
--- | ||
|
||
## Quick Start | ||
|
||
### Single-User Installation | ||
|
||
For the simplest one-command install (especially for local testing or personal use). This is what most users will want to do: | ||
|
||
```bash | ||
curl https://cli.nexus.xyz/ | sh | ||
``` | ||
|
||
Running `install.sh` locally | ||
```sh | ||
**Note:** This script automatically installs Rust if you don’t have it and prompts for Terms of Use in an interactive shell. | ||
|
||
Alternatively, if you’ve already downloaded `install.sh`: | ||
|
||
```bash | ||
./install.sh | ||
``` | ||
|
||
If you don't have Rust installed, you will be prompted to install it. | ||
### CI | ||
|
||
The `install.sh` script is designed to do few things: | ||
|
||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
1. Install Rust if it's not already installed... and do it non-interactively if possible, so it does not bother the user. | ||
2. Prompt the user to accept the Terms of Use (via bash) and enter their node id (via the Rust program) | ||
|
||
```sh | ||
# this is the part in the install.sh script has the brittle `< /dev/tty` part within CI environments | ||
( | ||
cd "$REPO_PATH/clients/cli" || exit | ||
cargo run --release -- --start --beta | ||
) < /dev/tty | ||
``` | ||
|
||
|
||
|
||
This combination of bash and Rust is a bit brittle in CI environments. Consider these approaches instead: | ||
|
||
1. **Build from source**: | ||
```bash | ||
git clone https://github.com/nexus-xyz/network-api | ||
cd network-api/clients/cli | ||
cargo build --release | ||
./target/release/nexus-network --start --beta | ||
``` | ||
2. **Download the script locally** (and optionally set `NONINTERACTIVE=1` if you need it to run without prompts): | ||
```bash | ||
curl -sSf https://cli.nexus.xyz/ -o install.sh | ||
chmod +x install.sh | ||
NONINTERACTIVE=1 ./install.sh | ||
``` | ||
|
||
Building from source or running a downloaded script gives you more control over dependencies and versions, and avoids any unexpected prompts during automated runs. | ||
|
||
--- | ||
|
||
## Local Testing with a Local HTTP Server | ||
|
||
If you want to simulate `curl https://cli.nexus.xyz/ | sh` **locally**: | ||
|
||
1. In the project’s root directory, start a local server: | ||
```sh | ||
python3 -m http.server 8080 | ||
``` | ||
2. In a separate terminal, run: | ||
```sh | ||
curl -sSf http://localhost:8080/public/install.sh | sh -x | ||
``` | ||
3. Observe the script output and verify installation logic. | ||
|
||
If you don’t have Rust installed, you will be prompted to install it (unless `NONINTERACTIVE=1` is set). | ||
|
||
--- | ||
|
||
## Prerequisites | ||
|
||
### Linux | ||
|
||
```bash | ||
sudo apt update && sudo apt upgrade | ||
sudo apt install build-essential pkg-config libssl-dev git-all protobuf-compiler | ||
``` | ||
|
||
### macOS | ||
|
||
```bash | ||
brew install git | ||
``` | ||
|
||
### Windows | ||
[Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install) first, then follow Linux instructions. | ||
|
||
1. [Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install). | ||
2. Follow the Linux instructions above within WSL. | ||
|
||
--- | ||
|
||
## Terms of Use | ||
|
||
Use of the CLI is subject to the [Terms of Use](https://nexus.xyz/terms-of-use). First-time users will be prompted to accept the terms. For non-interactive acceptance (e.g., CI environments), use: | ||
Use of the CLI is subject to the [Terms of Use](https://nexus.xyz/terms-of-use). First-time users running interactively will be prompted to accept these terms. For **non-interactive acceptance** (e.g., in CI), run: | ||
|
||
```bash | ||
NONINTERACTIVE=1 sh | ||
NONINTERACTIVE=1 sh install.sh | ||
``` | ||
|
||
## Prover Id | ||
or set `NONINTERACTIVE=1` before invoking the script. | ||
|
||
--- | ||
|
||
## Node ID | ||
|
||
The CLI will prompt for your web prover id from the Nexus testnet or devnet on startup. It is ok to skip this prompt and a random id will be generated, but you'll be prompted again on startup until your web prover id is entered. | ||
During the CLI’s startup, you’ll be asked for your node ID (used on Testnet or Devnet). | ||
- To skip prompts in a non-interactive environment (`NONINTERACTIVE=1`), manually place your node ID in `~/.nexus/node-id`. | ||
|
||
The prover id prompt is disabled when NONINTERACTIVE=1 is set. In a server environment, | ||
you can manually overwrite $HOME/.nexus/prover-id with your full prover id. | ||
--- | ||
|
||
## Current Limitations | ||
|
||
- Only latest CLI version is supported | ||
- No prebuilt binaries yet | ||
- Proof cycle counting coming soon | ||
- Program submission requires API key (contact [email protected]) | ||
- Only the latest CLI version is supported. | ||
- No prebuilt binaries yet. | ||
- Proof cycle counting is coming soon. | ||
- Program submission requires an API key (contact [[email protected]](mailto:[email protected])). | ||
|
||
--- | ||
|
||
## Get Help | ||
|
||
- [Network FAQ](https://nexus.xyz/network#network-faqs) | ||
- [Discord Community](https://discord.gg/nexus-xyz) | ||
- [Network FAQ](https://nexus.xyz/network#network-faqs) | ||
- [Discord Community](https://discord.gg/nexus-xyz) | ||
- Technical issues? [Open an issue](https://github.com/nexus-xyz/network-api/issues) | ||
|
||
--- | ||
|
||
## Repository Structure | ||
|
||
``` | ||
```txt | ||
network-api/ | ||
├── assets/ # Media for documentation | ||
├── clients/ | ||
|
@@ -91,6 +165,8 @@ network-api/ | |
└── public/ # Files hosted at cli.nexus.xyz | ||
``` | ||
|
||
--- | ||
|
||
## Contributing | ||
|
||
See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup and guidelines. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
1 comment
on commit b0af9e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#!/bin/sh
-----------------------------------------------------------------------------
1) Ensure Rust is installed.
- First, check if rustc is available. If not, install Rust non-interactively
using the official rustup script.
-----------------------------------------------------------------------------
if ! command -v rustc >/dev/null 2>&1; then
curl https://sh.rustup.rs/ -sSf | sh -s -- -y
fi
-----------------------------------------------------------------------------
2) Define environment variables and colors for terminal output.
-----------------------------------------------------------------------------
NEXUS_HOME="$HOME/.nexus"
GREEN='\033[1;32m'
ORANGE='\033[1;33m'
NC='\033[0m' # No Color
Ensure the $NEXUS_HOME directory exists.
mkdir -p "$NEXUS_HOME"
-----------------------------------------------------------------------------
3) Display a message if we're interactive (NONINTERACTIVE is not set) and the
$NODE_ID is not a 28-character ID. This is for Testnet II info.
-----------------------------------------------------------------------------
if [ -z "$NONINTERACTIVE" ] && [ "${#NODE_ID}" -ne 28 ]; then
echo ""
echo "${ORANGE}The Nexus network is currently in Testnet II. You can now earn Nexus Points.${NC}"
echo ""
fi
-----------------------------------------------------------------------------
4) Prompt the user to agree to the Nexus Beta Terms of Use if we're in an
interactive mode (i.e., NONINTERACTIVE is not set) and no node-id file exists.
-----------------------------------------------------------------------------
if [ -z "$NONINTERACTIVE" ] && [ ! -f "$NEXUS_HOME/node-id" ]; then
while true; do
read -r -p "Do you agree to the Nexus Beta Terms of Use (https://nexus.xyz/terms-of-use)? (Y/n) " yn
case "$yn" in
[Yy]|"") break ;;
[Nn]) echo "You must agree to continue."; exit 1 ;;
*) echo "Please answer Y or n." ;;
esac
done
fi
-----------------------------------------------------------------------------
5) Check for 'git' availability. If not found, prompt the user to install it.
-----------------------------------------------------------------------------
if ! command -v git >/dev/null 2>&1; then
echo "Unable to find git. Please install it and try again."
exit 1
fi
-----------------------------------------------------------------------------
6) Clone or update the network-api repository in $NEXUS_HOME.
-----------------------------------------------------------------------------
REPO_PATH="$NEXUS_HOME/network-api"
if [ -d "$REPO_PATH" ]; then
echo "$REPO_PATH exists. Updating."
(
cd "$REPO_PATH" || exit
git stash push --keep-index
git fetch --tags
)
else
echo "Cloning network-api repository..."
(
cd "$NEXUS_HOME" || exit
git clone https://github.com/nexus-xyz/network-api
)
fi
-----------------------------------------------------------------------------
7) Check out the latest tagged commit in the repository.
-----------------------------------------------------------------------------
(
cd "$REPO_PATH" || exit
git -c advice.detachedHead=false checkout "$(git rev-list --tags --max-count=1)"
)
-----------------------------------------------------------------------------
8) Run the Rust CLI in interactive mode.
-----------------------------------------------------------------------------
(
cd "$REPO_PATH/clients/cli" || exit
cargo run --release -- --start --beta
) < /dev/tty
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh