# Light Client/REST

The undcli binary comes packaged with a full REST capable server, from which the majority of the undcli query ... and undcli tx ... commands can also be served.

The REST server is generally useful for third party services such as wallets and block explorers. It interacts with, and can be used alongside the und RPC interface.

# Contents

# Prerequisites

Before continuing, ensure you have gone through the following docs:

  1. Installing the software
  2. join a Network, or run DevNet

# Running a light client

The Light Client can be started using the following command:

undcli rest-server --laddr=[tcp://ip:port] --node [tcp://ip:port] --chain-id=[chain_id]

For example:

undcli rest-server --laddr=tcp://localhost:1317 --node tcp:// --chain-id=FUND-Mainchain-TestNet-v8

This will start the light client on your local host listening on localhost:1317, and use the node hosted at to source its data and interface with the FUND-Mainchain-TestNet-v8 chain (e.g. broadcast any transactions).


setting the listen address IP to, e.g. --laddr=tcp:// will allow any host to connect to your REST server.

Once running, you can visit http://localhost:1317/swagger-ui/ to view all of the REST endpoints available.

The full undcli rest-server command specification can be found here.

# Running an Archive RPC node

Light Clients are more effective when interfacing with full nodes running in "archive" mode. Nodes running in archive mode do not prune any sync data, and keep a complete transaction event history.

The quickest way to get up and running with an archive node is to configure the pruning option in $HOME/.und_mainchain/config/app.toml:

pruning = "nothing"

Then, start the full node as usual using:

und start

Your light client can then be configured to connect to it via the --node flag by passing tcp:// to it.

Last Updated: 8/24/2020, 10:41:00 AM