# Coordinator Setup

The Zkopru cli includes two executables: `zkopru-coordinator` and `zkopru-wallet`.

Both can be install using the following command:

```
npm install -g @zkopru/cli
```

Note: the Zkopru web wallet should be used instead of the command line wallet. You can access it [here](https://zkopru.network).

## Coordinator Config

Once you have installed the Zkopru cli use `zkopru-coordinator --generateConfig` to start an interactive config setup.

![](https://790000186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBKrJqCGjfj63_Y1Run-2349265369%2Fuploads%2Fgit-blob-0604dd32ecf63f425fa4b92731e26340d3aa1d18%2Fcoordinator-setup-1.png?alt=media)

By default the setup will create a new Ethereum wallet and store it's password in a file in the current working directory.

![](https://790000186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBKrJqCGjfj63_Y1Run-2349265369%2Fuploads%2Fgit-blob-e5e3307db526536bb3bd9c1c1570388a115b1686%2Fcoordinator-setup-2.png?alt=media)

The public urls need to be correct if you intend to run a staked coordinator that proposes blocks. If you are running a watcher node only these fields do not matter.

![](https://790000186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBKrJqCGjfj63_Y1Run-2349265369%2Fuploads%2Fgit-blob-04378af5e16b4fb159d795bccf0558429fdaed41%2Fcoordinator-setup-3.png?alt=media)

Next you need to supply an Ethereum websocket address for synchronizing the coordinator. You can supply your own or use the Zkopru node at `wss://goerli2.zkopru.network`.

![](https://790000186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBKrJqCGjfj63_Y1Run-2349265369%2Fuploads%2Fgit-blob-eaad4f41ca03c014ffc0324e45d0ecc7178b9d8f%2Fcoordinator-setup-4.png?alt=media)

Finally you need to select a data storage option. For most cases SQLite is simple and quick.

Once this is done you can run your node with the command: `zkopru-coordinator --config config.json --daemon`. The coordinator should start and begin synchronizing the layer 2 blockchain.

## Coordinator Operation

Once your coordinator is configured and operational you can run either a full coordinator or a watcher.

### Watcher

A watcher coordinator watches the layer 2 blockchain for invalid blocks and submits fraud proofs when necessary. A watcher does not need to be staked and can be operated with less Ether.

The coordinator wallet simply needs enough funds to submit a fraud proof transaction. A good amount of funds to store might be 0.5 Ether.

You can find your wallet address from the config file using the following command:

```
node -e "console.log('0x'+require('./config.json').keystore.address)"
```

Once your wallet is funded run a coordinator daemon like so:

```
zkopru-coordinator --config config.json --daemon
```

By default the daemon will submit fraud proofs whenever possible.

### Full Coordinator

A full coordinator needs to be staked in order to propose blocks. This can be done interactively by opening the coordinator user interface using the following command:

```
zkopru-coordinator --config config.json
```

Select the "Setup menu" option like so:

![](https://790000186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBKrJqCGjfj63_Y1Run-2349265369%2Fuploads%2Fgit-blob-68abb66d8e80a14eb9770ed1ba661ac1c4d52c1c%2Ffull-coordinator-1.png?alt=media)

Then select `Register as a coordinator`:

![](https://790000186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBKrJqCGjfj63_Y1Run-2349265369%2Fuploads%2Fgit-blob-ff0dd5b92d2d73d504a99e4f144236e4e837f90c%2Ffull-coordinator-2.png?alt=media)

This requires your wallet to have 32 Ether.

Once this is complete start your node as usual:

```
zkopru-coordinator --config config.json --daemon
```

#### Public URLs

Your full coordinator needs to be externally accessible for clients to submit transactions. You can update this url in the `Auction menu` in the coordinator interface, or in the `config.json`.

## Using Docker

A docker image is available at the tag `zkoprunet/coordinator:beta` containing the `zkopru-coordinator` executable. The image uses `/data` as the working directory, you can bind mount this to your local machine for storing data, config, etc. The entrypoint for this image is the `zkopru-coordinator` executable.

Use this command to generate a config and store it in the current working directory:

```
docker run -it --rm -v $(pwd):/data zkoprunet/coordinator:beta --generateConfig
```

Once this is done you can run like this:

```
docker run -it --rm -v $(pwd):/data zkoprunet/coordinator:beta --config config.json --daemon
```

A background process might be run like this:

```
docker run -it --rm -d --name zkopru_coordinator -v $(pwd):/data zkoprunet/coordinator:beta --config config.json --daemon
```
