> 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/technical-details/config-network.md).

# Config Network

### Genesis block configuration

The genesis block is the first block created on a new chain according to a predefined specification. If you want to bootstrap your own Meey blockchain, you will need to configure and create the genesis block. All nodes producing blocks and syncing with the network need to use the same genesis block.

**Example genesis**

```
{
    "chain_id":{
        "magic": "[insert an identifier string for your network]",
        "public": false,
        "mainnet": false,
        "coinbasefee": "1000000000",
        "consensus": "dpos"
    },
    "timestamp": 1548918000000000000,
    "balance": {
        "[insert address from genesis]": "470000000000000000000000000",
        "[insert address from bp01]": "10000000000000000000000000",
        "[insert address from bp02]": "10000000000000000000000000",
        "[insert address from bp03]": "10000000000000000000000000"
    },
    "bps": [
        "[insert text from bp01.id]",
        "[insert text from bp02.id]",
        "[insert text from bp03.id]"
    ]
}
```

| Key           | Type   | Explanation                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| chain\_id     | obj    |                                                                                                      |
| – magic       | string | <p>A name identifier used to distinguish different chains.<br>Example: yourchain.network</p>         |
| – public      | bool   | <p>If this chain is for a public (true) or private network.<br>This may affect certain features.</p> |
| – mainnet     | bool   | If this is the main network (true) or a sidechain for another network.                               |
| – consensus   | string | This blockchain’s consensus type (dpos)                                                              |
| – coinbasefee | string | The default transaction fee amount                                                                   |
| timestamp     | number | The genesis block’s creation timestamp in nanoseconds                                                |
| balance       | obj    | A mapping of addresses and allocated balances                                                        |
| bps           | list   | A list of fallback block producer peer ids.                                                          |

### Creating peer identification (Optional Step)

Every peer (i.e. instance of meeysvr) is identified by a peer id, derived from its public key. If unspecified, meeysvr creates these automatically, but you may want to do it manually to control the generation of keys and make backups. You can use the CLI to do that:

```
meeycli keygen your-keyname

# Using Docker:
docker run --rm -v $(pwd):/tools/ meey/tools meeycli keygen your-keyname
```

You then need to specify the path to the generated your-keyname.key file in the Meey configuration:

```
...
[p2p]
npkey = "/meey/your-keyname.key"
...
```

### Internal Zones

There may be several BPs in one private network; these BPs can be connected directly to spread the blocks without having to pass through Agents. And these BPs can be more efficient in resource use by sharing Agents than by each BP having Agents.

For efficient use of network and computing resources, Agent categorizes networks to internal and external, delivering only internal to external, or vise versa.

The Agent node connects the client BPs in the internal network with other BPs or Agents in the external network. The Agent passes blocks generated by a client to the BPs or Agents of the external network as quickly as possible, while the blocks notified by the external BPs or Agents are passed to the client BPs.\
\
**Config Example**

NOTE: Configuring BP and Agent are advanced topic, and wrong configuration can cause performance degradation or abnormal operation. So this configurations are more strictly checked than other settings; read the document carefully and set it up.

Suppose there is a foundation named Wesoha, and the foundation decided to participate in the Meey network. The foundation establishes three BP nodes, one Agent node, and one node for TX registration and monitoring in the private network. The private address and peer ID of each node are as follows.

```
BP1    : 192.168.25.21 / 16Uiu2HAmH1Eup6qLSQg3Bk7B5QbrVPk6Bzw7upHhZ74ZTS8kM
BP2    : 192.168.25.22 / 16Uiu2HAkzW5j6c6w9BhRnuudHuYc3Kqk4aNi4KbuoaYwVDx3HkS
BP3    : 192.168.25.23 / 16Uiu2HAkvwrouZCrCSG8BqMM1v9GRj11jfjfjfhby5fAXgbCg
Agent  : 192.168.25.31 / 16Uiu2HAm7P7quSBCxPHe89wNUYwCki1M8F45kMMRjw5M6bQdVWEv
Watcher: 192.168.25.32 / 16Uiu2HAkvQYs1e6jVbpAeMfTNpDgUYhxry6gMRQnMAqymVL2Z45
```

The foundation registered the mainnet.wesoha.io domain to join the chain network and forwarded the IP address of the domain to the agent machine.

BPs and Watcher allow access only from the Foundation’s internal network and are linked to the public network only through Agent.

The connection between Agent and client BP is built on the secured environment that the network manager cares about; BP and Agent must specify each other correctly in configuration.

**Configuration of BP Node**

BP disables npexposeself, npdiscoverpeers, and npusewezen settings so that they are not exposed to the outside and do not automatically connect to external nodes. BP node also set agent field to peer id of agent node.

```
# MEEY TOML Configration File (https://github.com/toml-lang/toml)
# base configurations
datadir = "./data"
enableprofile = false
personal = false

[p2p]
npkey = "bp01.key"  # Name of key file of node
npaddpeers = [
    "/ip4/192.168.25.22/tcp/7846/p2p/16Uiu2HAkzW5j6c6w9BhRnuudHuYc3Kqk4aNi4KbuoaYwVDx3HkS",
    "/ip4/192.168.25.23/tcp/7846/p2p/16Uiu2HAkvwrouZCrCSG8BqMM1v9GRj11jfjfjfhby5fAXgbCg",
    "/ip4/192.168.25.31/tcp/7846/p2p/16Uiu2HAm7P7quSBCxPHe89wNUYwCki1M8F45kMMRjw5M6bQdVWEv",
    "/ip4/192.168.25.32/tcp/7846/p2p/16Uiu2HAkvQYs1e6jVbpAeMfTNpDgUYhxry6gMRQnMAqymVL2Z45"
]
npusewezen = false
npexposeself = false    # peer is advertised by wezen or other peers 
npdiscoverpeers = false # peer will not try to discover and connect other peers except for peers listed in npaddpeers
peerrole = "producer"
agent = "16Uiu2HAm7P7quSBCxPHe89wNUYwCki1M8F45kMMRjw5M6bQdVWEv"

[blockchain]
blockchainplaceholder = false
coinbaseaccount = "[ADDRESS OF CONBASE ACCOUNT]"

[mempool]
showmetrics = true
dumpfilepath = "./data/mempool.dump"

[consensus]
enablebp = true
```

**Configuration of Agent Node**

Agent activates npexposeself, npdiscoverpeers, npusewezen settings, and also sets addresses that can be accessed from the outside, so that they can connect to other nodes in the public network. Also set producers field to a list of the client BP’s peer ids and internal zones.

```
# MEEY TOML Configration File (https://github.com/toml-lang/toml)
# base configurations
datadir = "./data"
enableprofile = false
personal = false

[p2p]
netprotocoladdr = "agent.wesoha.com"
npkey = "agent01.key"  # Name of key file of node
npaddpeers = [
    "/ip4/192.168.25.21/tcp/7846/p2p/16Uiu2HAmH1Eup6qLSQg3Bk7B5QbrVPk6Bzw7upHhZ74ZTS8kM",
    "/ip4/192.168.25.22/tcp/7846/p2p/16Uiu2HAkzW5j6c6w9BhRnuudHuYc3Kqk4aNi4KbuoaYwVDx3HkS",
    "/ip4/192.168.25.23/tcp/7846/p2p/16Uiu2HAkvwrouZCrCSG8BqMM1v9GRj11jfjfjfhby5fAXgbCg",
    "/ip4/192.168.25.32/tcp/7846/p2p/16Uiu2HAkvQYs1e6jVbpAeMfTNpDgUYhxry6gMRQnMAqymVL2Z45"
]

npusewezen = true
npexposeself = true    # peer is advertised by wezen or other peers 
npdiscoverpeers = true # peer will not try to discover and connect other peers except for peers listed in npaddpeers
peerrole = "agent"
producers = [
    "16Uiu2HAmH1Eup6qLSQg3Bk7B5QbrVPk6Bzw7upHhZ74ZTS8kM",
    "16Uiu2HAkzW5j6c6w9BhRnuudHuYc3Kqk4aNi4KbuoaYwVDx3HkS",
    "16Uiu2HAkvwrouZCrCSG8BqMM1v9GRj11jfjfjfhby5fAXgbCg"
]
internalzones = ["192.168.25.1/24"]

[blockchain]

[mempool]
showmetrics = true
dumpfilepath = "./data/mempool.dump"

[consensus]
enablebp = false
```

### NTP

Timing is critical in a blockchain, so it’s better to configure the machines’ time setup manually:

```
sudo bash
apt-get install chrony
nano /etc/chrony/chrony.conf
```

```

server time1.google.com iburst
server time2.google.com iburst
server time3.google.com iburst
server time4.google.com iburst
```

```
systemctl restart chronyd
chronyc makestep
```

**Create genesis block**

```
./bin/meeysvr init --genesis /root/.meey/genesis.json --home /root/.
```
