Skip to content

Run a light client to join MTHN Chain

Light client is a program that connects to a full node to help users access and interact with MTHN Chain in a secure and decentralized manner without having to sync the full blockchain.

Light Client Versus Full Node

  • Light client does not store blocks or states,this way it needs less disk space (50 megabytes will be enough).
  • Light client does not join p2p network and it does not produce any network cost when it is idle. The network overhead depends on how many requests the light client handles concurrently.
  • Light client does not replay state of the chain so that there is not CPU cost when idle. The CPU cost also depends on how many requests the light client handles concurrently.
  • Light client is faster than a full node even if it lagged behind the core network for a few months. It only needs a few seconds to catch up with core network.

Platforms and System Requirement

Platforms

We support running light client node on Mac OS X, Windows and Linux.
The light client will soon be open sourced, afterwards you can cross compile light client binary and run it on other platforms.

Requirements

  • 50 megabytes of free disk space.
  • 2 CPU cores, 50 megabytes of memory (RAM).

Run a light client node

Download:

git clonehttps://github.com/githubusername/githubrepo/node-binary.git

Go to directory according to the network you want to join in.
Replace the network variable with testnet or prod in the following command:

cd node-binary/lightd/{network}/{version}

Help info:

./lightd --help
This node will run a secure proxy to a shree rpc server.

All calls that can be tracked back to a block header by a proof
will be verified before passing them back to the caller. Other that
that it will present the same interface as a full shree node,
just with added trust and running locally.

Usage:
  lite [flags]

Flags:
      --cache-size int             Specify the memory trust store cache size (default 10)
      --chain-id string            Specify the shree chain ID (default "bnbchain")
  -h, --help                       help for lite
      --home-dir string            Specify the home directory (default ".shree-lite")
      --laddr string               Serve the proxy on the given address (default "tcp://localhost:27147")
      --max-open-connections int   Maximum number of simultaneous connections (including WebSocket). (default 900)
      --node string                Connect to a shree node at this address (default "tcp://localhost:27147")

You can specify all the parameters above.

Start the light client node according to the Platform. Replace the platform variable with mac, windows or linux in the following command:

./{{platform}}/lightd --chain-id "{chain-id}" --node tcp://{full node addr}:80 > node.log  &

There are two required parameters to start a light client node: chain id and full node addr.
The chain id of the network that you want join in.
You can find chain id at genesis file in test network or genesis file in prod network.
The full node addr field can be an address of any full node that you have deployed.
You can refer to Run a MTHN Chain full node to get more details.

We supply a bunch of full nodes that you can connect to for both mainnet and testnet.
You cat get full nodes info through a simple python script(notice to replace domain according to different network):

import requests, json
d = requests.get('https://dex.evokescan.org/api/v1/peers').text # replace dex.evokescan.org with testnet-dex.evokescan.org for testnet
l = json.loads(d)
seeds = ",".join([ (seed["id"]+"@"+seed["original_listen_addr"]) for seed in l if seed["accelerated"] == False])
print (seeds)

Example for Mainnet:

./lightd --chain-id "MTHN-Chain-Tigris" --node tcp://dataseed1.evokescan.org:80 > node.log  &

Example for Testnet:

./lightd --chain-id "MTHN-Chain-Ganges" --node tcp://data-seed-pre-0-s1.evokescan.org:80 > node.log  &

Working with the light client

The default port of light client is 27147.