# Commands

This section describes the commands available from `nodechain`.  For more general information at the command line, append the `-h` or `--help`, such as `nodechain -h`.

For more information about a specific `nodechain` command, append the `-h` or `--help` flag after the command, such as `nodechain start --help`.

## start

Initiates the Connector or any node. By default will prompt an interface.

**Syntax**

```bash
$ ./nodechain.py start
```

**Example**

```bash
$ ./nodechain.py start
```

### Options

* `-h` or `--help`: Shows command help information.
* `-a` or `--all`: Initializes **all** the nodes of the network specified as a parameter

**Syntax**

```bash
$ ./nodechain.py start -a <network>
```

**Example**

```bash
$ ./nodechain.py start -a regtest
```

{% hint style="info" %}
An interface will be prompt if the user needs to specify any variable
{% endhint %}

## stop

Stop the Connector or any node. By default will prompt an interface.

**Syntax**

```bash
$ ./nodechain.py stop
```

**Example**

```bash
$ ./nodechain.py stop
```

### Options

* `-h` or `--help`: Shows command help information.
* `-a` or `--all`: Stop **all** the nodes of the network specified as a parameter

**Syntax**

```bash
$ ./nodechain.py stop -a <network>
```

**Example**

```bash
$ ./nodechain.py stop -a regtest
```

{% hint style="info" %}
An interface will be prompt if the user needs to specify any variable
{% endhint %}

## status

Display the status of the services. By default will prompt an interface.

**Syntax**

```bash
$ ./nodechain.py status
```

**Example**

```bash
$ ./nodechain.py status
```

### Options

* `-h` or `--help`: Shows command help information.

## General options (flags)

### --blockchain

Also `-b`

Specifies the absolute path to the folder where the blockchain files will be stored.

**Syntax**

```bash
$ ./nodechain.py -b <path_to_blockchain> [start]
```

**Example**

```bash
$ ./nodechain.py -b "/srv/nodechain-data/btc/regtest"
```

{% hint style="info" %}
If there is already data in the directory from a volume with the previous blockchain synchronization, the synchronization will continue from the same point.
{% endhint %}

### --certs

Also `-c`

Specifies the absolute path to the folder with the SSL certificates.

**Syntax**

```bash
$ ./nodechain.py -c <path_to_certs> [start]
```

**Example**

```bash
$ ./nodechain.py -c "/etc/ssl/certs" start
```

{% hint style="danger" %}
To enable SSL you need to have the files `nodechain_cert.key` and `nodechain_cert.crt` in the specified path. **This filenames are mandatory**.
{% endhint %}

### --config

Also `-g`

Specifies the configuration via command line in JSON format

**Syntax**

```bash
$ ./nodechain.py -g '<configuration_in_JSON>' [start]
```

**Example**

```bash
$ ./nodechain.py -g '{"foo": "bar"}' start
```

{% hint style="warning" %}
Use **single quotation marks** to wrap your JSON string
{% endhint %}

### --defaultconfig

Use the default configuration to start the node

**Syntax**

```bash
$ ./nodechain.py --defaultconfig [start]
```

**Example**

```bash
$ ./nodechain.py --defaultconfig start
```

### --help

Also `-h`

Shows general help information

**Syntax**

```bash
$ ./nodechain.py -h
```

### --local

Use a local node. This command will start the blockchain using the docker-composes

**Syntax**

```bash
$ ./nodechain.py --local [start]
```

**Example**

```bash
$ ./nodechain.py --local start
```

### --network

Also `-n`

Specifies the network of the node.

**Syntax**

```bash
$ ./nodechain.py -n <network> [start|stop|status]
```

**Example**

```bash
$ ./nodechain.py -n testnet start
```

### --port

Also `-p`

Specifies the Connector port.

**Syntax**

```bash
$ ./nodechain.py -p <port> [start]
```

**Example**

```bash
$ ./nodechain.py -p 6000 start
```

### --remote

Use a remote node. This command won't start the blockchain using the docker-composes.&#x20;

**Syntax**

```bash
$ ./nodechain.py --remote [start]
```

**Example**

```bash
$ ./nodechain.py --remote start
```

{% hint style="info" %}
Do not forget to use the appropriate configuration for each endpoint.
{% endhint %}

### --ssl

Enable SSL in the Connector.

{% hint style="warning" %}
If this flag is specified, you will need to specify the directory of the certificates by means of its flag or the interface.
{% endhint %}

**Syntax**

```bash
$ ./nodechain.py --ssl [start]
```

**Example**

```bash
$ ./nodechain.py --ssl start
```

### --sslport

Also `-sp`

Specify the Connector SSL port.

**Syntax**

```bash
$ ./nodechain.py -sp <ssl_port> [start]
```

**Example**

```bash
$ ./nodechain.py -sp 4000 start
```

### --token

Also `-t`

Selects a blockchain by its token from command line.

**Syntax**

```bash
$ ./nodechain.py -t <token> [start|stop|status]
```

**Example**

```bash
$ ./nodechain.py -t btc start
```

### --verbose

Also `-v`

Increase output verbosity.

**Syntax**

```bash
$ ./nodechain.py -v [start|stop|status]
```

**Example**

```bash
$ ./nodechain.py -v start
```

### --version

Also `-V`

Returns the version of NodeChain you're running.

**Syntax**

```bash
$ ./nodechain.py -V
```
