> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skale.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Node CLI - v2.0

> The Node CLI offers a command line option for setting up, registering, and maintaining SKALE nodes.

## Installation

<Note>
  Ensure that the following packages are installed:

  * **docker**
  * **docker-compose** (1.27.4+)
</Note>

<Steps>
  1. Download the executable
     ```shell theme={null}
     VERSION_NUM={put the version number here} && sudo -E bash -c "curl -L https://github.com/skalenetwork/node-cli/releases/download/$VERSION_NUM/skale-$VERSION_NUM-`uname -s`-`uname -m` >  /usr/local/bin/skale"
     ```

  2. Apply executable permissions to the downloaded binary
     ```shell theme={null}
     chmod +x /usr/local/bin/skale
     ```

  3. Test the Installation
     ```shell theme={null}
     skale --help
     ```
</Steps>

## Top Level Commands

### Info

Prints build info.

```shell theme={null}
skale info
```

### Version

Prints version number.

```shell theme={null}
skale version
```

**Optional Arguments**

* `--short` prints the version only without additional text.

## Node Commands

### Node Information

Retrieves the base info about SKALE node.

```shell theme={null}
skale node info
```

**Optional Arguments**

* `-f/--format` accepts either **json** or **text** as valid input which formats the output accordingly

### Node Initialization

Initialize a SKALE node on current machine.

<Warning>
  **Please avoid re-initialization**: First run `skale node info` to confirm current state of initialization.
</Warning>

```shell theme={null}
skale node init [ENV_FILEPATH]
```

**Required Parameters**

1. `ENV_FILEPATH` is a path to the .env file (required parameters are listed in the `skale init` command)

<Code lang="yaml" title=".env">
  SGX\_SERVER\_URL=

  DISK\_MOUNTPOINT=

  DOCKER\_LVMPY\_STREAM=

  CONTAINER\_CONFIGS\_STREAM=

  ENDPOINT=

  IMA\_ENDPOINT=

  MANAGER\_CONTRACTS\_ABI\_URL=

  IMA\_CONTRACTS\_ABI\_URL=

  FILEBEAT\_URL=

  TG\_API\_KEY=

  TG\_CHAT\_ID=

  MONITORING\_CONTAINERS=
</Code>

### Node Initialization from Backup

Restores a SKALE node on another machine.

```shell theme={null}
skale node restore [BACKUP_PATH] [ENV_FILEPATH]
```

**Required Parameters**

1. `BACKUP_PATH` is the path to the archive with backup data generated by `skale node backup` command
2. `ENV_FILEPATH` is the path to .env file (required parameters are listed in the `skale init` command)

### Node Backup

Generates a backup file to restore SKALE node on another machine.

```shell theme={null}
skale node backup [BACKUP_FOLDER_PATH]
```

**Required Parameters**

1. `BACKUP_FOLDER_PATH` is the path to the folder where the backup tarball will be saved

### Node Signature

Generates a node signature that is used to link node to a specific validator.

```shell theme={null}
skale node signature [VALIDATOR_ID]
```

**Required Parameters**

1. `VALIDATOR_ID` - id of the validator

### Node Registration

```shell theme={null}
skale node register
```

**Required Arguments**

* `--ip` is the public IP for RPC connections and consensus
* `--domain`/`-d` is the SKALE node domain name
* `--name` is the SKALE node name

**Optional Arguments**

* `--port` is a public port, the beginning of the port range for node SKALE Chains (default: *10000*)

### Node Update

Updates a SKALE node on the current machine.

```shell theme={null}
skale node update [ENV_FILEPATH]
```

**Required Arguments**

* `ENV_FILEPATH` is the path to env file where parameters are defined

**Optional Arguments**

* `--yes` executes without additional confirmation

<Note>
  You can also specify a file with environment variables which will update parameters in env file used during skale node init.
</Note>

### Node Turn-off

Turns off the SKALE node on current machine and optionally sets it to maintenance mode.

```shell theme={null}
skale node turn-off
```

**Optional Arguments**

* `--maintenance-on` sets the SKALE node into maintenance mode before turning off
* `--yes` executes without additional confirmation

### Node Turn-on

Turns on SKALE node on current machine and optionally disables maintenance mode.

```shell theme={null}
skale node turn-on [ENV_FILEPATH]
```

**Optional Arguments**

**Required Parameters**

1. `ENV_FILEPATH` is the path to env file where parameters are defined

**Optional Arguments**

* `--maintenance-off` turns off maintenance mode after turning on the node
* `--yes` executes without additional confirmation

<Note>
  You can also specify a file with environment variables
  which will update parameters in env file used during skale node init.
</Note>

### Enable Maintenance Mode

Enables maintenance mode on the node.

```shell theme={null}
skale node maintenance-on
```

**Optional Arguments**

* `--yes` executes without additional confirmation

### Disable Maintenance Mode

```shell theme={null}
skale node maintenance-off
```

### Domain name

Set SKALE node domain name

```shell theme={null}
skale node set-domain
```

**Optional Arguments**

* `--domain`/`-d` the SKALE node domain name
* `--yes` executes without additional confirmation

## Wallet commands

Commands related to Ethereum wallet associated with SKALE node

### Wallet information

```shell theme={null}
skale wallet info
```

**Optional Arguments**

* `-f/--format` formats the output. Valid inputs are **json** and **text**

### Send ETH tokens

Sends ETH tokens from the SKALE node wallet to a specific address.

```shell theme={null}
skale wallet send [ADDRESS] [AMOUNT]
```

**Required Parameters**

1. `ADDRESS` is the Ethereum receiver address
2. `AMOUNT` is the Amount of ETH tokens to send

**Optional Arguments**

* `--yes` executes without additional confirmation

## SKALE Chain commands

### List SKALE Chains on Node

Lists the SKALE Chains served by the connected node.

```shell theme={null}
skale SKALE Chains ls
```

### Get SKALE Chain Config

```shell theme={null}
skale SKALE Chains config SCHAIN_NAME
```

### Get SKALE Chain DKG Status

Lists the DKG status for each SKALE Chain on the node.

```shell theme={null}
skale SKALE Chains dkg
```

### Get SKALE Chain Info

Shows information about a specified SKALE Chain on the node.

```shell theme={null}
skale SKALE Chains info SCHAIN_NAME
```

**Required Parameters**

1. `SCHAIN_NAME` is a valid SKALE Chain on the node

**Optional Arguments**

* `--json` shows info in JSON format

### Repair SKALE Chain

Turn on repair mode for SKALE Chain

```shell theme={null}
skale SKALE Chains repair SCHAIN_NAME
```

**Required Parameters**

1. `SCHAIN_NAME` is a valid SKALE Chain on the node

**Optional Arguments**

* `--yes` executes repair without additional confirmation

## Health commands

### List Containers

Lists all SKALE containers running on the connected node.

```shell theme={null}
skale health containers
```

**Optional Arguments**

* `-a/--all` lists all containers (by default - only running)

### Healthcheck for SKALE Chains

Shows health check results for all SKALE Chains on the node.

```shell theme={null}
skale health SKALE Chains
```

**Optional Arguments**

* `--json` shows info in JSON format

### SGX Commands

Checks status of the SGX server. Returns the SGX server URL and connection status.

```shell theme={null}
$ skale health sgx
```

#### Example Output

```shell theme={null}
SGX server status:
┌────────────────┬────────────────────────────┐
│ SGX server URL │ https://0.0.0.0:1026/      │
├────────────────┼────────────────────────────┤
│ Status         │ CONNECTED                  │
└────────────────┴────────────────────────────┘
```

## SSL Commands

### SSL Status

Retrieves the status of the SSL certificates on the node.

```shell theme={null}
skale ssl status
```

### Upload Certificates

Uploads new SSL certificates.

```shell theme={null}
skale ssl upload
```

**Required Arguments**

* `-c/--cert-path` is the path to the certificate file
* `-k/--key-path` is the path to the key file

**Optional Arguments**

* `-f/--force` overwrites the existing certificates

## Logs Commands

### CLI Logs

Fetch Node CLI logs.

```shell theme={null}
skale logs cli
```

**Optional Arguments**

* `--debug` shows debug logs with a more verbose output

### Dump Logs

Dumps all logs from the connected node.

```shell theme={null}
skale logs dump [PATH]
```

**Required Parameters**

1. `PATH` is the required path to dump the logs to

**Optional Arguments**

* `--container`, `-c` - Dump logs only from specified container

## Resources Allocation Commands

### Show Allocation File

Show the resources allocation file.

```shell theme={null}
skale resources-allocation show
```

### Generate/Update

Generate (or updates if already exists) the allocation file.

```shell theme={null}
skale resources-allocation generate [ENV_FILEPATH]
```

**Required Parameters**

1. `ENV_FILEPATH` is the path to .env file (required parameters are listed in the `skale init` command)

**Optional Arguments**

* `--yes` generates without additional confirmation
* `-f/--force` rewrites allocation file if it exists

## Validate commands

### Validate ABI

Checks whether ABI files contain valid JSON data.

```shell theme={null}
skale validate abi
```

**Optional Argument**

* `--json` shows the validation result in json format

## Exit codes

Exit codes conventions for SKALE CLI tools.

| Code | Description             |
| ---- | ----------------------- |
| 0    | Everything is OK        |
| 1    | General error exit code |
| 3    | Bad API response        |
| 4    | Script execution error  |
| 7    | Bad user error          |
| 8    | Node state error        |
