Running your own client node

A node in Public Mint is a crucial part of the network. The network operates in the bases of a Peer-to-Peer (P2P) network, thus all nodes have similar responsibilities, requirements and they need to talk to each other. Therefore, it is crucial, if you operate a Public Mint node, to follow all the guidance in this page.

Minimum System Requirements

  • 4GB of RAM

  • 2 vCPU

For instance, in Amazon Web Services a t3.medium EC2 type fits the requirements.

Disk Space

Syncing Public Mint MaiNet or TestNet requires 50GB for a full sync. Thus, we recommend 50GB of available disk space.

The disk used will tend to grow in the future, following the grow of the blockchain history. Thus, this requirement will be adjusted accordingly.

Running Public Mint client from Binary Distribution

Works for Linux, Unix, Windows & macOS.

Prerequisites

Public Mint client requires Java 11+; earlier versions are not supported. Public Mint client is currently supported only on 64-bit versions of Windows, and requires a 64-bit version of JDK/JRE. We recommend that you also remove any 32-bit JDK/JRE installations.

Linux Open File Limit

If a Too many open files RocksDB exception occurs, increase the maximum number of open files allowed using ulimit.

Filename

Release number

Release date

Release notes

1.0.3

2020/01/21

First version

Unpack the downloaded files and change into the publicmint-<release> directory.

Display Public Mint command line help to confirm installation:

Linux/macOS

bin/publicmint --help

Windows

bin\publicmint --help

Starting Public Mint client

Take into account the minimum system requirements.

Local Block Data

When connecting to a network other than the network previously connected to, you must either delete the local block data or use the --data-path option to specify a different data directory.

To delete the local block data, delete the database directory in the publicmint/build/distribution/publicmint-<version> directory.

Genesis Configuration

The client specifies the genesis configuration, and sets the network ID and bootnodes when connecting to the different Public Mint networks.

To operate your node on PublicMint TestNet you need to specify --network=publicmint_testnet to use the correct genesis configuration. To operate your node in PublicMint MainNet use --network=publicmint_mainnet

Recap

For TestNet use: --network=publicmint_testnet For MainNet use: --network=publicmint_mainnet

Or you can use the configuration file to specify the network.

Configuration file

To specify command line options in a file, use a TOML configuration file.

The configuration file can be saved and reused across node startups. To specify the configuration file, use the --config-file option.

To override an option specified in the configuration file, specify the same option on the command line. If an option is specified in multiple places, the order of priority is command line, configuration file.

An example of a configuration file to run a Public Mint node:

data-path="~/publicmint_data" # Path to store blockchain history

# Network
network="publicmint_testnet"

# Enable HTTP and WS on 127.0.0.1 host (HTTP port: 8545, WS port: 8546)
rpc-http-enabled=true
rpc-ws-enabled=true

# Specifies domain URLs for CORS validation
# Domain URLs must be enclosed in double quotes and comma-separated
# Domains that can access the node using JSON-RPC
# If your client interacts with your client using a browser app (e.g. Remix or block explorer), you must whitelist the client domains 
rpc-http-cors-origins=["localhost", "127.0.0.1"]

# Comma-separated list of hostnames to allow access to the JSON-RPC API
# By default, access from localhost and 127.0.0.1 is accepted
host-whitelist=["localhost", "127.0.0.1"]

Starting client with a configuration file:

bin/publicmint --config-file=/home/me/publicmint_node/config.toml

The node by default is running on host 127.0.0.1 and the HTTP port is 8545 and Web Service port is 8546

Configuring Ports

Ports must be exposed appropriately to enable communication. An example port configuration for a node on AWS is:

30303 is the default P2P port, that can be specified using --p2p-port.

Confirm Node is Running

If you have started the client with the --rpc-http-enabled option, use cURL to call web3_clientVersion to confirm the node is running.

curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://127.0.0.1:8545

Running Public Mint client from Docker Image

A Docker image is provided to run a Public Mint node in a Docker container.

Use this Docker image to run a single Public Mint node without installing Public Mint client.

Prerequisites

The Docker image does not run on Windows

Starting Public Mint client

Take into account the minimum system requirements.

Available tags for the image are listed at https://hub.docker.com/r/publicmint/client/tags

Exposing Ports

Expose ports for P2P peer discovery, and HTTP and WebSockets JSON-RPC. Exposing the ports is required to use the default ports or the ports specified using --rpc-http-port, --p2p-port and --rpc-ws-port options.

To run and expose local ports for access:

docker run -p <localportJSON-RPC>:8545 -p <localportWS>:8546 -p <localportP2P>:30303 publicmint/client:latest --rpc-http-enabled --rpc-ws-enabled docker run -p <localportJSON-RPC>:8545 -p <localportWS>:8546 -p <localportP2P>:30303 publicmint/client:latest --rpc-http-enabled --rpc-ws-enabled --network=publicmint_testnet

Example

To enable JSON-RPC HTTP calls to 127.0.0.1:8545 and P2P discovery on 127.0.0.1:13001:

docker run -p 8545:8545 -p 13001:30303 publicmint/client:latest --rpc-http-enabled

Run a Node on Public Mint TestNet

Important

Do not mount a volume at the default data path (/opt/publicmint). Mounting a volume at the default data path interferes with the operation of the node and prevents it from safely launching.

To run a node that maintains the node state (key and database), [--data-path] must be set to a location other than /opt/publicmint and a storage volume mounted at that location.

To run a node on TestNet with the Web Service and HTTP JSON-RPC service enabled:

docker run -p 8545:8545 -p 8546:8546 -p 30303:30303 --mount type=bind,source=/<myvolume/user/publicmint_testnet>,target=/var/lib/publicmint publicmint/client:latest --rpc-http-enabled --rpc-ws-enabled --network=publicmint_testnet --data-path=/var/lib/publicmint

Stopping node and cleaning up resources

When you’re done running nodes, you can shut down the node container without deleting resources or you can delete the container after stopping it. Run docker container ls and docker volume ls to obtain the container and volume names.

To stop a container:

docker stop <container-name>

To delete a container:

docker rm <container-name>

Troubleshooting

If Public Mint client is not working as expected, here are some things to check or try.

Host Not Authorised

If you are receiving a Host not authorised error when attempting to access the JSON-RPC API, ensure --host-whitelist includes the host from which you are sending the RPC or * - that allows any host to access your node JSON-RPC API.

Peers Fail to Connect

If nodes are not communicating, ensure the required ports are open.

If your nodes are running in AWS, check you have appropriate SecurityGroups to allow access to the required ports.

Last updated