Run a node with Docker

Environment

Ubuntu/CentOS and other systems (including Windows 10 Professional Edition, similar commands) with Docker installed, and docker is running.

Run a node

Run the following command to run the node:

$ sudo docker run --restart=always \
    --name starcoin-main \
    -d -p 9880:9880 \
    -v /data/starcoin/:/data/starcoin/ \
    starcoin/starcoin \
    /starcoin/starcoin \
    -n main \
    -d /data/starcoin \
    --disable-metrics true \
    --stratum-address 0.0.0.0 --stratum-port 9880 \
    --miner-thread 0

Hint:

  • If you don't need to start the mining pool function, you can remove -p 9880:9880, and the last parameter --stratum-address 0.0.0.0 --stratum-port 9880;

  • -n main: Specify the main network main, the test network can be changed to barnard;

  • --miner-thread 0: The number of mining threads, which can be adjusted by yourself;

Check the running status of the node:

$ sudo docker ps -a

Export account and private key

Connect to the Starcoin console

Enter the server and run this command:

$ sudo docker exec -it starcoin-main /bin/bash

Connect to the console and see that starcoin% is returned at the end, which means that you have successfully reached the console:

/starcoin/starcoin --connect /data/starcoin/main/starcoin.ipc console

View account and export private key

Prerequisite: Connecting the Starcoin console.

View the default account:

account default

Export the private key of the default account:

account export 0x8b79fdf7bd004b72ea4bd83289429455

As shown in the figure below, the account and private key are exported, and the private key must be saved! ! !

View account public key and balance

Command:

account show 0x8b79fdf7bd004b72ea4bd83289429455

Field explanation:

  • public_key: Account public key;

  • balances: Account balance. 0x000000000000000000000000000001::STC::STC STC balance, the precision is 9 digits, the balance will increase after the block is produced.

Exit the console

Command:

$ exit

Block explorer

Website: https://stcscan.io

Last updated