|
| 1 | +# OptimAI Node CLI |
| 2 | + |
| 3 | +This repository contains the OptimAI Node CLI. Use it to sign in, run your node, check status, and view rewards. |
| 4 | + |
| 5 | +> **Full Documentation:** For detailed information about the OptimAI Node, please visit our [Official Documentation](https://docs.optimai.network/docs/optimai-node/core-node). |
| 6 | +
|
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +- OptimAI account |
| 10 | +- Docker Desktop (required to run the node) |
| 11 | + - Download: https://www.docker.com/products/docker-desktop/ |
| 12 | + |
| 13 | +## Install |
| 14 | + |
| 15 | +### macOS |
| 16 | + |
| 17 | +Run the following commands in your terminal to download and install: |
| 18 | + |
| 19 | +```bash |
| 20 | +# Download and rename to node-cli |
| 21 | +curl -L https://optimai.network/download/cli-node/mac -o node-cli |
| 22 | + |
| 23 | +# Make executable and install to PATH |
| 24 | +chmod +x node-cli |
| 25 | +sudo mv node-cli /usr/local/bin/node-cli |
| 26 | +``` |
| 27 | + |
| 28 | +### Linux (Ubuntu) |
| 29 | + |
| 30 | +```bash |
| 31 | +# Download and rename to node-cli |
| 32 | +curl -L https://optimai.network/download/cli-node/linux -o node-cli |
| 33 | + |
| 34 | +# Make executable and install to PATH |
| 35 | +chmod +x node-cli |
| 36 | +sudo mv node-cli /usr/local/bin/node-cli |
| 37 | +``` |
| 38 | + |
| 39 | +### Windows (PowerShell or Command Prompt) |
| 40 | + |
| 41 | +```cmd |
| 42 | +curl.exe -L https://optimai.network/download/cli-node/win -o node-cli.exe |
| 43 | +``` |
| 44 | + |
| 45 | +After downloading, you can run it from the current folder: |
| 46 | +```cmd |
| 47 | +.\node-cli.exe --help |
| 48 | +``` |
| 49 | +*Tip: Move `node-cli.exe` to a folder in your System PATH to use it from anywhere as `node-cli`.* |
| 50 | + |
| 51 | +## Tutorial |
| 52 | + |
| 53 | +### 1) Sign in |
| 54 | + |
| 55 | +Open a terminal and run: |
| 56 | + |
| 57 | +```bash |
| 58 | +node-cli auth login |
| 59 | +``` |
| 60 | + |
| 61 | +Enter your email and password when prompted. |
| 62 | + |
| 63 | +### 2) Start the node |
| 64 | + |
| 65 | +Make sure Docker Desktop is running, then start the node: |
| 66 | + |
| 67 | +```bash |
| 68 | +node-cli node start |
| 69 | +``` |
| 70 | + |
| 71 | +**Running in the background (Linux/macOS):** |
| 72 | +To keep the node running after closing your terminal, we recommend using a tool like `screen`: |
| 73 | +1. Start a new session: `screen -S optimai` |
| 74 | +2. Run the node: `node-cli node start` |
| 75 | +3. Detach: Press `Ctrl+A` then `D` |
| 76 | +4. Resume later: `screen -r optimai` |
| 77 | + |
| 78 | +Otherwise, keep your terminal open while the node is running. |
| 79 | + |
| 80 | +### 3) Check status |
| 81 | + |
| 82 | +Open a new terminal and run: |
| 83 | + |
| 84 | +```bash |
| 85 | +node-cli node status |
| 86 | +``` |
| 87 | + |
| 88 | +### 4) View rewards |
| 89 | + |
| 90 | +```bash |
| 91 | +node-cli rewards balance |
| 92 | +``` |
| 93 | + |
| 94 | +### 5) Update the CLI |
| 95 | + |
| 96 | +```bash |
| 97 | +node-cli update |
| 98 | +``` |
| 99 | + |
| 100 | +### 6) Stop the node |
| 101 | + |
| 102 | +Press `Ctrl+C` in the terminal where the node is running. |
| 103 | + |
| 104 | +## Command Reference |
| 105 | + |
| 106 | +Account: |
| 107 | + |
| 108 | +```bash |
| 109 | +node-cli auth login |
| 110 | +node-cli auth status |
| 111 | +node-cli auth me |
| 112 | +node-cli auth logout |
| 113 | +``` |
| 114 | + |
| 115 | +Node: |
| 116 | + |
| 117 | +```bash |
| 118 | +node-cli node start |
| 119 | +node-cli node status |
| 120 | +``` |
| 121 | + |
| 122 | +Rewards: |
| 123 | + |
| 124 | +```bash |
| 125 | +node-cli rewards balance |
| 126 | +``` |
| 127 | + |
| 128 | +Updates: |
| 129 | + |
| 130 | +```bash |
| 131 | +node-cli update |
| 132 | +``` |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | +## Tips |
| 137 | + |
| 138 | +- Keep Docker Desktop running before you start the node. |
| 139 | + |
| 140 | +## Troubleshooting |
| 141 | + |
| 142 | +- **Docker not running**: If `node-cli node status` shows Docker as `not_running`, start Docker Desktop and retry. |
| 143 | +- **Node already running**: If you see "Another node instance is already running", a node process is active in the background. |
| 144 | + - Run `node-cli node status` to check the Process ID (PID). |
| 145 | + - If you need to stop it manually, use your system's task manager or run `kill <PID>` (macOS/Linux). |
0 commit comments