PintSwap Docs
Search
K

Basic Usage

Describes how to setup the appropriate envionment variables for the daemon process and how to generally use the pintswap CLI once a daemon process is started.

Environment Variables

All these environment variables are optional.

Wallet

Wallet can be mnemonic or private key format, and it can also be provided with environment variable PINTSWAP_DAEMON_WALLET

Save Data Location

On first launch, a peer-id.json will be generated and stored in ~/.pintswap-daemon/peer-id.json
You can configure a different location and filename for the PeerId by setting PINTSWAP_PEERID_FILEPATH in your environment.
Orderbook data local to the daemon instance will be hosted at ~/.pintswap-daemon/data.json
You can configure a different location and filename for the database JSON by setting PINTSWAP_DATA_FILEPATH in your environment.

RPC Host

RPC bind address can be set with the environment variable, PINTSWAP_DAEMON_HOST and is by default set to 127.0.0.1

Port

RPC port can also be set with environment variables PINTSWAP_DAEMON_PORT and is by default set to 42161

Running Multiple Peers

To run multiple daemon processes, you can either configure the aforementioned environment variables to ensure a unique PeerId and database, but it is simplest to run under different system users, only ensuring that you set a different PINTSWAP_DAEMON_PORT in the .bashrc for the given user.

Operation

To operate the daemon, it is possible to interact with the REST API provided using JSON inputs. It is also possible to simply use the pintswap-cli program also made available upon global install.
An invocation of pintswap-cli is in the following format:
pintswap-cli <command> --field1 value1 --field2 value2
A special command pintswap-cli attach exists which creates a WebSocket connection to the daemon and streams in logs emitted. In this fashion, you can get a handle to a stream of outputs from a daemon process forked into the background or otherwise run in systemd or Docker.
The pintswap-cli commands will call the corresponding /command endpoint on the hostname:port specified by the PINTSWAP_DAEMON_HOSTNAME and PINTSWAP_DAEMON_PORT set in the environment.