# 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://11.22.33.44:26657 --chain-id=FUND-Mainchain-TestNet-v7

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

TIP

setting the listen address IP to 0.0.0.0, e.g. --laddr=tcp://0.0.0.0:1317 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://127.0.0.1:26657 to it.

Last Updated: 5/12/2020, 11:48:35 AM