Connecting to a Node

In this section we explain how to connect to a Stegos Node.

Prerequisites:


Connecting to a Local Node

./stegos

./stegos

docker exec -t -i <CONTAINER_NAME> stegos

The command-line client will try to connect to a local node and print stegos prompt on success:

1Stegos CLI 0.11.13 (e63fb9e 2019-08-09)
2Type 'help' to get help
3
4account#1>

Type help to get help:

 1stegos> help
 2Usage:
 3show accounts - show available accounts
 4use ACCOUNT_ID - switch to a account
 5create account - add a new account
 6recover account - recover account from 24-word recovery phrase
 7delete account - delete active account
 8passwd - change account's password
 9lock - lock the account
10unlock - unlock the account
11
12pay ADDRESS AMOUNT [COMMENT] [/snowball] [/public] [/lock DATETIME] [/fee FEE] [/certificate] - send money
13validate certificate UTXO SENDER_ADDRESS RECIPIENT_ADDRESS RVALUE - check that payment certificate is valid
14msg ADDRESS MESSAGE - send a message via blockchain
15stake AMOUNT - stake money
16unstake [AMOUNT] - unstake money
17restake - restake all available stakes
18cloak - exchange all available public outputs
19show version - print version information
20show keys - print keys
21show balance - print balance
22show utxo - print unspent outputs
23show history [STARTING DATE] - print history since date
24show election - print leader election state
25show escrow - print escrow
26show recovery - print recovery information

You successfully connected to a local Node.


Connecting to a Remote Node

Copy api.token from a remote host to your host. You can find this token in STEGOS_DATA_DIR. See Running a Node for details.

scp YOURNAME@HOST:~/.local/stegos/api.token .

Where

Forward WebSocket API port from the remote host to your machine using ssh port forwarding:

ssh -f -N -T -L 127.0.0.1:3145:127.0.0.1:3145 YOURNAME@NODE

On success, ssh will connect to the remote host and forward remote 127.0.0.1:3145 to your local 127.0.0.1:3145:

1local$ nc -z 127.0.0.1 3145
2local$ echo $?
30

Alternatively, you can provide --api-endpoint command-line option or overrideSTEGOS_API_ENDPOINT variable for Node, configure firewall and restart your Node.

Exposing WebSocket API port to the public Internet is insecure. Please consider to use SSH port forwading or configure firewall.

Connect to remote Node by providing path to api.token and API Endpoint:

./stegos --api-token <PATH/TO/TOKEN> --api-endpoint <API_ENDPOINT>

./stegos –api-token <PATH/TO/TOKEN> –api-endpoint <API_ENDPOINT>

docker run -t -i stegos/stegos – –api-token <PATH/TO/TOKEN> –api-endpoint <API_ENDPOINT>

You sucessfully connected to a remote Node.