> For the complete documentation index, see [llms.txt](https://docs.meycoin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.meycoin.com/platform/wezen-server.md).

# Wezen Server

## Features

* MeyServer nodes can query addresses of other MeyServer nodes. In this case, the chain of the MeyServer node and the chain of Wezen must be the same.
* MeyServer nodes can register itself with Wezen. Wezen checks to see if it can connect to the MeyServer node and adds it to the node list.
* One Wezen server per designated block chain

## Building WEZEN Server

This section describes how to build Wezen from source without using the Docker. Wezen is available as a sub-module in the MEYCOIN project.

1. Get the source from github.com/meeypioneer/meycoin.
2. Build the wezen executable with `make wezen`.

## Configuration

Four files are used to set Wezen behavior.

1. Private key file: PK file to use for Wezen communication. It uses the same format as meycoinsvr private key file.
2. Genesis file: Contains the chain information of nodes to be provided by Wezen. Use the same format as the genesis file used to initialize meycoinsvr.
3. Wezen configuration file: Determines the overall operation of Wezen. It also specifies the path to other configuration related files.
4. Log configuration file: The file name is meeylog.toml, and it uses the same format as the file used by meycoinsvr.

#### Create private key file

It can be generated by meycoincli using the keygen command

```
meycoinocli keygen mychain-wezen
Wrote files mychain-wezen.{key,pub,id}.
```

#### Create genesis file

```
{
    "chain_id":{
        "magic": "mychain.test",
        "public": false,
        "mainnet": false,
        "coinbasefee": "1000000000",
        "consensus": "dpos"
    },
    "timestamp": 1548918000000000000,
    "balance": {
    },
    "bps": [
    ]
}
```

**Wezen configuration file**

```
authdir = "/blockchain/wezen/auth"              # base directory for files about authentication and authorization

[rpc]
netserviceaddr = "127.0.0.1"                # RPC access address. The default setting is 127.0.0.1, which allows RPC access only on the local machine and blocks RPC connections remotely.
netserviceport = 8915

[p2p]
netprotocoladdr = "[real IP address]"      # An externally accessible IP address or domain name
netprotocolport = 8916
npbindaddr = ""
npkey = "mychain-wezen.key"              # Location of private key file

[wezen]
allowprivate = true                        # Whether to allow the private address of the node's access address. Used when building Wezen for private chains operated within a test or private network.
genesisfile = "[location of genesis file]" # Genesis file location
enableblacklist = false                    # Whether to turn on blacklist or not. blacklist entries will be saved in <authdir>
```

**Logging options**

It is possible to customize the log output format of all Meey CLI tools using a file called meeylog.toml placed in the current working directory

```
level = "info"  # default log level
formatter = "json"  # format: console, console_no_color, json
caller = true  # enabling source file and line printer
timefieldformat = "RFC3339"

[chain]
level = "info"  # optional, log level for 'chain' module

[dpos]
level = "info"

[p2p]
level = "info"

[consensus]
level = "info"

[mempool]
level = "info"

[contract]
level = "info"

[syncer]
level = "info"

[bp]
level = "info"
```

## Running Wezen

**Using Docker**

```
docker run -d -w /tools -v /blockchain/wezen:/tools -p 8916:8916 -p 8915:8915 --restart="always" --name wezen-node meey/wezen wezen --home /tools --config /tools/wezen-conf.toml
```

**Manually**

```
./wezen --config wezen-conf.toml
```
