Multi Node
Following this page, you can run a localnet setup with docker that consists of a 4-node local chain. This setup can be useful for developers to test their applications and protocol features on a multi-node setup.
A similar setup is used by the Match team to get insights about the impact of new features and testing different user flows. This testing setup can be found on the Match testing repository.
Build & Start
To build start a 4 node testnet using docker, run:
This command creates a 4-node network using the matchdnode
Docker image. The ports for each node are found in this table:
Node ID | P2P Port | Tendermint RPC Port | REST/ Ethereum JSON-RPC Port | WebSocket Port |
---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To update the binary, just rebuild it and restart the nodes
The command above command will run containers in the background using Docker compose. You will see the network being created:
Stop Localnet
Once you are done, execute:
Configuration
The make localnet-start
creates files for a 4-node testnet in ./build
by calling the matchd testnet
command. This outputs a handful of files in the ./build
directory:
Each ./build/nodeN
directory is mounted to the /matchd
directory in each container.
Logging
In order to see the logs of a particular node you can use the following command:
The logs for the daemon will look like:
You can disregard the Can't add peer's address to addrbook
warning. As long as the blocks are being produced and the app hashes are the same for each node, there should not be any issues.
Whereas the logs for the REST & RPC server would look like:
Follow Logs
You can also watch logs as they are produced via Docker with the --follow
(-f
) flag, for example:
Interact with the Localnet
Ethereum JSON-RPC & Websocket Ports
To interact with the testnet via WebSockets or RPC/API, you will send your request to the corresponding ports:
EVM JSON-RPC | Eth Websocket |
---|---|
|
|
You can send a curl command such as:
The IP address will be the public IP of the docker container.
Additional instructions on how to interact with the WebSocket can be found on the events documentation.
Keys & Accounts
To interact with matchd
and start querying state or creating txs, you use the matchd
directory of any given node as your home
, for example:
Now that account exists, you may create new accounts and send those accounts funds!
Note: Each node's seed is located at ./build/nodeN/matchd/key_seed.json
and can be restored to the CLI using the matchd keys add --restore
command.
Special Binaries
If you have multiple binaries with different names, you can specify which one to run with the BINARY environment variable. The path of the binary is relative to the attached volume. For example:
Last updated