Now that the release v0.16 of the MESG Engine is available, you can connect multiple Engines running on different computers together on a network and share services!

Follow this brief guide to learn how to do it.

You need to install the latest version of the Engine and CLI by running:
npm install -g mesg-cli
Check out the installation guide for more information.


First of all, at least one Engine needs to be a validator of the network in order to create new blocks that contain the services and maintain the security of the network.

If you start the Engine on a fresh install (no ~/.mesg folder) it will automatically create a network with the Engine as the only validator.

Start the validator

Execute the following commands to remove any ~/.mesg folder, start the Engine and display its logs:

rm -rf ~/.mesg
mesg-cli daemon:start
mesg-cli daemon:logs

Close to the beginning of the logs, you should see:

time="2019-10-30T05:17:42Z" level=info msg="This node is a validator" addr=CBD19993A790DD2D5D47BCB606DEF2BE8EA36F0F module=consensus pubKey="PubKeyEd25519{490743F31967911C9338B381FCF4705B1C56B05331AB04DA3B81CA7E4A1AB8D6}"

Followed by:

time="2019-10-30T05:17:42Z" level=info msg="P2P Node ID" ID=d6b4fff8981a5b3b3dc1ecd54551a762058fc938 file=/root/.mesg/tendermint/config/node_key.json module=p2p

⚠️ Copy the node ID as we need it later ⚠️

Genesis file

The Engine is now using a genesis file to start the blockchain. This file is located by default in ~/.mesg/tendermint/config/genesis.json. It is generated automatically by the Engine if none exists.
To create a network with multiple Engines, you will need to start the Engines with the same genesis file.

Copy the genesis file to the second computer.

Prepare config for the second Engine

We now have all the info needed to start a new Engine and connect it to the first one.

Let’s switch to the second computer and set up the second Engine.

Prepare mesg folder

We need to create the mesg in advance in order to put 2 files: genesis.json and config.yml.
Let’s create it:

mkdir -p ~/.mesg/tendermint/config

Copy genesis

Copy the genesis from the first engine to the second:

scp user@firstComputer:~/.mesg/tendermint/config/genesis.json ~/.mesg/tendermint/config

Create config file

Let’s create a config file for the second Engine to set the address of the first Engine:

touch ~/.mesg/config.yml
open ~/.mesg/config.yml

and in the file, put the following config:

      persistentpeers: NODE_ID@IP_OF_FIRST_ENGINE:26656

Make sure to replace NODE_ID with the node ID you get from the logs on the first Engine and replace IP_OF_FIRST_ENGINE with the IP of the first Engine.

Start the second Engine

It’s finally time to start the second Engine! We need to set a different name, path, port and p2p port:

mesg-cli daemon:start
mesg-cli daemon:logs

You should see at the beginning of the logs:

time="2019-10-30T06:14:22Z" level=info msg="This node is not a validator" addr=D061A71EE4845C93C7F8F77702EFDAEF3DD3150F module=consensus pubKey="PubKeyEd25519{615219C3DED1C0B0F1DBC68E00A23EAE6EBBAFA72D7C0BB122328A17FA1714D2}"

A lot of Executed block logs until the second node is synchronised with the first one:

time="2019-10-30T06:16:04Z" level=info msg="Executed block" height=2279 invalidTxs=0 module=state validTxs=0time="2019-10-30T06:16:04Z" level=info msg="Committed state" appHash=04ABB4D7DEB7059D55EDD8D30E5A7B48D26829EB89D283AAB8D4FDE4DDB5843E height=2279 module=state txs=0

Once synchronized, new logs every second to show the new block:

Create a service

Let’s create a service on the first Engine and display it on the second.

On the first computer, run:

mesg-cli service:create "$(mesg-cli service:compile" --account dev --passphrase pass

Wait for the command to succeed.
On the second computer, run:

mesg-cli service:list

You should see the email-sendgrid service in the list 🎊

Let’s start the service still on the second computer:

mesg-cli service:start email-sendgrid --env SENDGRID_API_KEY=__CHANGE_WITH_YOUR_SENDGRID_API_KEY__

Congratulations, you created your first decentralized MESG Service!

To learn more about MESG and the Engine check out and