# Quick Start

## Install

Install from npm:

```
npm install @rei-network/cli --global
```

Install from source code:

```
git clone https://github.com/rei-network/rei.git
cd rei
npm install
npm link -w @rei-network/cli
```

## Usage

```
Usage: rei [options] [command]

Options:
  -V, --version                              output the version number
  --rpc                                      open rpc server
  --rpc-port <port>                          rpc server port
  --rpc-host <port>                          rpc server host
  --rpc-api <apis>                           rpc server apis: debug, eth, net, txpool, web3
  --disable-p2p                              disable p2p server
  --p2p-tcp-port <port>                      p2p server tcp port
  --p2p-udp-port <port>                      p2p server udp port
  --p2p-nat <ip>                             p2p server nat ip
  --max-peers <peers>                        max p2p peers count
  --max-dials <dials>                        max p2p dials count
  --bootnodes <bootnodes...>                 comma separated list of bootnodes
  --datadir <path>                           chain data dir path (default: "~/.rei")
  --keystore <keystore>                      the datadir for keystore (default: "keystore")
  --unlock <unlock>                          comma separated list of accounts to unlock
  --password <password>                      password file to use for non-interactive password input
  --chain <chain>                            chain name: rei-mainnet, rei-testnet, rei-devnet
  --mine                                     mine block
  --coinbase <address>                       miner address
  --verbosity <verbosity>                    logging verbosity: silent, error, warn, info, debug, detail (default: "info")
  --receipts-cache-size <receiptsCacheSize>  receipts cache size
  -h, --help                                 display help for command

Commands:
  account                                    Manage accounts
```

Default settings:

| Params       | Default Value | Description                                         |
| ------------ | ------------- | --------------------------------------------------- |
| P2P TCP Port | 4191          | P2P Network TCP Port                                |
| P2P UDP Port | 9810          | P2P Network UDP Port                                |
| P2P NAT      | 127.0.0.1     | The public IP of this node, used for node discovery |
| RPC Port     | 11451         |                                                     |
| RPC host     | 127.0.0.1     |                                                     |
| RPC API      | eth,net,web3  |                                                     |

## Example

Proposer node startup

```
rei --mine --coinbase 0x...abc --unlock 0x...abc --password ./password
```

RPC node startup

```
rei --rpc --rpc-host 0.0.0.0
```

Bootnode startup

```
rei --p2p-nat 1.2.3.4
```

Testnet or devnet node startup

```
rei --chain rei-testnet
rei --chain rei-devnet
```
