Skip to content

SDS Resource Node

The Stratos Decentralized Storage (SDS) network is a scalable, reliable, self-balancing elastic acceleration network. We can simply take it as a decentralized file system suitable for running on general-purpose hardware.

SDS is composed of many Resource Nodes that store data, and a few Meta Nodes that coordinate with each other.

Note that provides their resource(disk/bandwidth/computation power) for SDS is called Resource Node.


Requirements๐Ÿ”—︎


  • Minimum Hardware Requirements
Type CPU RAM Storage Bandwidth Deposit
TIER 1 8 Coresยน, 2.5GHzยฒ 16 GB 4 TB Up: 50Mbps Down: 100Mbps 800 STOS
TIER 2 16 Coresยน, 2.5GHzยฒ 32 GB 8 TB Up: 100Mbps Down: 100Mbps 1600 STOS
TIER 3 32 Coresยน, 2.5GHzยฒ 64 GB 16 TB Up: 1Gbps Down 1Gbps 3200 STOS

ยน    Can be achieved using dual CPU server configurations (eg. 2cpu x 4cores, 2cpu x 8cores, etc, as long as the frequency per core is respected).
ยฒ    2.5GHz refers to Base Frequency, not Turbo/Boost Frequency.


  • Software(tested version)

    • Ubuntu 18.04+
    • Go 1.19 linux/amd64

Keywords๐Ÿ”—︎

There are some keywords that are widely used in SDS. We describe them as

  • resource node(PP node): Node that participates in the Stratos Resource Network by providing their disk/bandwidth/computation power to earn rewards in the Proof-of-Traffic(PoT) model.

  • meta node(SP nodes): Node that manages the tasks in the Resource Network between resource nodes, including indexing all content, auditing the traffic report and communicating between Resource Network and Stratos-chain through a relay mechanism.

  • active resource node: A resource node that has been activated by depositing to the Stratos-chain and registering to a meta node. It is ready to receive tasks assigned by the meta node.

  • suspended resource node: A resource node that has not satisfied the performance KPI evaluation criteria and is suspended from receiving further tasks from the meta node.

  • traffic: The data volume evaluated in the Resource Network. The incentive for all participants in the Stratos Ecosystem is based on traffic.

  • STOS(Stratos Tokens): The native token facilitating value circulation in Stratos Ecosystem.

  • ozone(oz): The traffic unit used in Stratos Ecosystem.

  • epoch: The Proof-of-Traffic evaluation periodic window. The traffic for the Resource Network is evaluated at the end of each epoch.

  • value network: The Stratos-chain, the network that circulates all values in the Stratos Ecosystem.


Setup Environment๐Ÿ”—︎

Tip

In order to run an SDS resource node, you need to build SDS source code which requires Go 1.19, git, curl and make installed.

If you have installed them previously, just skip this section. Otherwise, please install them as the following

This process depends on your operating system.


  • Linux Users

The following example is based on Ubuntu 18.04+ 64-bit(Debian) and assumes you are using a terminal environment by default. Please run the equivalent commands if you are running other Linux distributions.

# Update the system
sudo apt update
sudo apt upgrade

# Install git, snap and make(you can also install them separately as your needs)
sudo apt install git build-essential curl --yes

# Prepare binary PATH:
mkdir ~/bin
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.profile
source ~/.profile

Warning

Due to a conflict with one of our 3rd party dependencies, for the moment only Go version 1.19 can be used.

To install Go 1.19, please follow these steps:

# If you already have Go installed, check if it's version 1.19.xx:
go version

# If you have 1.18.xx or 1.20.xx, remove it using the same method you installed with. For example:
sudo snap remove go
sudo apt remove golang-go

Install Go 1.19:

# Do a clean-up:
sudo rm -rf /usr/local/go

# Download the Go Binary Package:
wget https://go.dev/dl/go1.19.12.linux-amd64.tar.gz

# Unzip it to /usr/local directory:
sudo tar -C /usr/local -xzf go1.19.12.linux-amd64.tar.gz

# Add the Go PATH:
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
source ~/.profile

# Verify with
go version

# You should see:
# go version go1.19.12 linux/amd64


  • Windows Users

It is possible to build and run the software on Windows. However, we did not test it on Windows completely. It may give you unexpected results, or it may require additional setup.

An alternative option is to install a separate virtual Linux system using VirtualBox or VMware Workstation


Compile SDS resource node๐Ÿ”—︎


  • Compile the binary executables with source code
git clone https://github.com/stratosnet/sds.git
cd sds
git checkout tags/v0.12.0
make build


  • Installing the binary executable

Once the compilation is successful, you will find three binary executables (ppd, relayd, sdsweb) under the target folder. Copy them to your home binary path:

cp target/* ~/bin


  • Verify the installation with:
ppd version

You should get v0.12.0.


Create SDS resource node๐Ÿ”—︎


Create a root directory๐Ÿ”—︎

To start a resource node, you need to be in a directory dedicated to your resource node.

Create a new directory, or go to the root directory of your existing node.

In the following instruction, we assume you have entered the root directory of the resource node.

# create a new folder 
cd $HOME
mkdir rsnode
# Make sure we are inside the root directory of the resource node
cd rsnode


Configure SDS resource node๐Ÿ”—︎

Next, you need to generate the configuration file and its accounts of this resource node. The command ppd config will help you to generate necessary configurations.


Generate/Recover wallet๐Ÿ”—︎

The ppd config command consists of several flags or subcommand. Let take a look at its general definition using ppd config -h.

ppd config -h

create default configuration file

Usage:
  ppd config [flags]
  ppd config [command]

Available Commands:
  accounts    create accounts for the node

Flags:
  -p, --create-p2p-key   create p2p key with config file, need interactive input
  -w, --create-wallet    create wallet with config file, need interactive input
  -h, --help             help for config

Global Flags:
  -c, --config string   configuration file path  (default "./configs/config.toml")
  -r, --home string     path for the node (default "<root directory of your resource node>")

Use "ppd config [command] --help" for more information about a command.


Tip

There are two ways to generate a configuration file and create (or recover) a wallet:

  • Option 1 will generate a configuration file and a wallet automatically.

  • Option 2 will generate a configuration file and allow you to create or recover a wallet.


When asked to input bip39 mnemonic,

Input your mnemonic -> recovers an existing wallet account;

keep it blank -> generates a new wallet account

Usage:

# Make sure we are inside the root directory of the resource node
cd ~/rsnode
# to create config with interactive key creation
ppd config -w -p
Example (creating a new wallet account) You will get a new wallet account
# Make sure we are inside the root directory of the resource node
cd ~/rsnode

ppd config -w -p
[INFO]2022/02/14 10:19:09 setting.go:122: The config at location ./configs/config.toml does not exist
generating default config file
[INFO]2022/02/14 10:19:09 node.go:67: No P2P key specified in config. Attempting to create one...
Enter password:                           # enter your P2P key password
Enter password again:
[INFO]2022/02/14 10:19:29 setting.go:245: finished changing configuration file  P2PAddress:  stsdsp2p1k70qsfx70s2vkyn737hu3yj50ghrn5yz53dzwx
No wallet key specified in config. Attempting to create one...
Enter wallet nickname: wallet2            # enter your wallet nickname
Enter password:                           # enter your wallet key password
Enter password again:

# Leaving the following blank will generate a new wallet account automatically.

input bip39 mnemonic (leave blank to generate a new one)                # Press enter to generate a new wallet
input hd-path for the account, default: "m/44'/606'/0'/0/0" :           # Press enter
[INFO]2022/02/14 10:19:48 setting.go:245: finished changing configuration file  WalletAddress:  st1cmu0e9qlypg6j2ck8v5gfty6sxj2jszz84h8gf
save wallet password to config file: Y(es)/N(o): Y                      # Press Y
save the mnemonic phase properly for future recover:
=======================================================================  
interest liberty thrive maple trip fringe nurse deal fresh sport cool hip gate indoor brown mansion what table three wise design master warm apple
=======================================================================
Example (recovering an existing wallet account) You will get the same wallet account if you already have one.
# Make sure we are inside the root directory of the resource node
cd ~/rsnode
ppd config -w -p

[INFO]2022/02/22 11:25:19 setting.go:125: The config at location ./configs/config.toml does not exist
generating default config file
[INFO]2022/02/22 11:25:19 node.go:67: No P2P key specified in config. Attempting to create one...
Enter password:               # enter your P2P key password
Enter password again:
[INFO]2022/02/22 11:25:21 setting.go:251: finished changing configuration file  P2PAddress:  stsdsp2p1arpvg0wthng0yty06ay0uup3vw7k3upm586few
No wallet key specified in config. Attempting to create one...
Enter wallet nickname: wallet1            # enter your wallet nickname
Enter password:                           # enter your wallet key password
Enter password again:

# Inputting the mnemonic phrase here will recovering an existing wallet account(mnemonic will not show on the screen). 

input bip39 mnemonic (leave blank to generate a new one)         # Insert your mnemonic (seed phrase) 
input hd-path for the account, default: "m/44'/606'/0'/0/0" :    # Press enter
[INFO] 2022/02/22 11:25:34 setting.go:251: finished changing configuration file  WalletAddress:  st10t5chdnhx6myggwwhfq7q39hnjhzapau9yy6tv
save wallet password to config file: Y(es)/N(o): Y               # Press Y
save the mnemonic phase properly for future recover:
=======================================================================  
climb work able lock find blind fire cement exotic outdoor eyebrow panther repeat veteran prosper speak identify wolf mind decorate genre arctic bean gauge
=======================================================================


Directory structure๐Ÿ”—︎

After the above command executed successfully, Your rsnode folder should include directories and files similar to the following.

.
โ”œโ”€โ”€ accounts
โ”‚   โ”œโ”€โ”€ st10t5chdnhx6myggwwhfq7q39hnjhzapau9yy6tv.json
โ”‚   โ””โ”€โ”€ stsds1hez7aewx6srjtrw3064w3qy4dk22uv0cx7jxww.json
โ”‚โ”€โ”€ config
โ”‚   โ””โ”€โ”€ config.toml
โ””โ”€โ”€ tmp
  โ””โ”€โ”€ logs
      โ””โ”€โ”€ stdout.log

accounts folder keeps important account info, including the Wallet Address(starting with st) and P2P Address(starting with stsds) of your SDS resource node.

configs folder includes all configurations for this SDS resource node. User may need to modify configs/config.toml file to adapt to specific requirements of the network.

tmp folder is hols the logs and outputs.


Edit configuration file๐Ÿ”—︎

You will need to edit a few lines in the file configs/config.toml to setup your node.

Open config file and make the following modifications:

nano config/config.toml


โœ๏ธ - Edit your external ip address:

Replace 99.99.99.99 with your external ip address.

This ip address and port must be accessible from the Internet. If you are behind a router, the network_port must be forwarded.

[node.connectivity]
# Is the node running on an internal network? Eg: false
internal = false
# IP address of the node. Eg: "127.0.0.1"
network_address = '99.99.99.99'
# Main port for communication on the network. Must be open to the internet. Eg: "18081"
network_port = '18081'

Tip

To find your external ip, you can run the following command in another terminal:

curl ifconfig.co


โœ๏ธ - Edit the first meta node to connect on first run: (you can skip this if you start with v0.12.0)

# The first meta node to connect to when starting the node
[node.connectivity.seed_meta_node]
p2p_address = ''
p2p_public_key = ''
network_address = ''
metanode you can start with
# europe
p2p_address = 'stsds1ypxg8sj5vn4s4v0w965g4r9g3pt3vlz6wyzx0f'
p2p_public_key = 'stsdspub1y6exsr8snwz65ev3pzq6k3yfy2ku3kexqdd0en35dnr8mxc9w6sq5jg6lf'
network_address = '34.34.149.18:8888'

# asian
p2p_address = 'stsds10kmygjv7e2t39f6jka6445q20e9lv4a7u3qex3'
p2p_public_key = 'stsdspub1srn3qetarx3x6f2x9wqfv3nh2aufxv03ncl5v6jkmyg666scvz6s4xgprq'
network_address = '34.85.35.57:8888'

# NA
p2p_address = 'stsds1z96pm5ls0ff2y7y8adpy6r3l8jqeaud7envnqv'
p2p_public_key = 'stsdspub1lf769k20k36e4gvnewcwdtfudzj95qk45d5f0p300jmr7e6y73zsdyh25y'
network_address = '34.82.40.37:8888'


Example of a full config file
[version]
# App version number. Eg: 12
app_ver = 12
# Network connections from nodes below this version number will be rejected. Eg: 12
min_app_ver = 12
# Formatted version number. Eg: "v0.12.0"
show = 'v0.12.0'

# Configuration of the connection to the Stratos blockchain
[blockchain]
# ID of the chain Eg: "stratos-1"
chain_id = 'stratos-1'
# Multiplier for the simulated tx gas cost Eg: 1.5
gas_adjustment = 1.5
# Connect to the chain using an insecure connection (no TLS) Eg: true
insecure = false
# Network address of the chain grpc Eg: "127.0.0.1:9090"
grpc_server = 'grpc.thestratos.org:443'

# Structure of the home folder. Default paths (eg: "./storage" become relative to the node home. Other paths are relative to the working directory
[home]
# Key files (wallet and P2P key). Eg: "./accounts"
accounts_path = '/home/user/rsnode/accounts'
# Where downloaded files will go. Eg: "./download"
download_path = '/home/user/rsnode/download'
# The list of peers (other sds nodes). Eg: "./peers"
peers_path = '/home/user/rsnode/peers'
# Where files are stored. Eg: "./storage"
storage_path = '/home/user/rsnode/storage'

[keys]
# Address of the P2P key. Eg: "stsdsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
p2p_address = 'stsdsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
p2p_password = 'my-passw0rd'
# Address of the stratos wallet. Eg: "stxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
wallet_address = 'stxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
wallet_password = 'my-passw0rd'
# "Address for receiving reward. Eg: \"stxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"
beneficiary_address = 'stxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

# Configuration of this node
[node]
# Should debug info be printed out in logs? Eg: false
debug = false
# When not 0, limit disk usage to this amount (in megabytes) Eg: 7629394 = 8 * 1000 * 1000 * 1000 * 1000 / 1024 / 1024  (8TB)
max_disk_usage = 7629394

[node.connectivity]
# Is the node running on an internal network? Eg: false
internal = false
# IP address of the node. Eg: "127.0.0.1"
network_address = '99.99.99.99'
# Main port for communication on the network. Must be open to the internet. Eg: "18081"
network_port = '18081'
# Port for prometheus metrics
metrics_port = '18181'
# Port for the JSON-RPC api. See https://docs.thestratos.org/docs-resource-node/sds-rpc-for-file-operation/
rpc_port = '18281'
# Enable the node owner RPC API. This API can manipulate the node status and sign txs with the local wallet. Do not open this to the internet  Eg: false
allow_owner_rpc = false

# The first meta node to connect to when starting the node
[node.connectivity.seed_meta_node]
p2p_address = 'stsds10kmygjv7e2t39f6jka6445q20e9lv4a7u3qex3'
p2p_public_key = 'stsdspub1srn3qetarx3x6f2x9wqfv3nh2aufxv03ncl5v6jkmyg666scvz6s4xgprq'
network_address = '34.85.35.57:8888'

# Configuration for the monitor server
[monitor]
# Should the monitor server use TLS? Eg: false
tls = false
# Path to the TLS certificate file
cert_file_path = ''
# Path to the TLS private key file
key_file_path = ''
# Port used for the monitor websocket connection. It's the monitor UI that uses this port, not the person accessing the UI in a browser
port = '18381'
# List of IPs that are allowed to connect to the monitor websocket port. This is used to decide which IP can connect their monitor to the node, NOT to decide who can view the monitor UI page.
allowed_origins = ['localhost']

# Configuration for video streaming
[streaming]
# Port for the internal HTTP server
internal_port = '18481'
# Port for the REST server
rest_port = '18581'

[traffic]
# Interval at which traffic is logged (in seconds) Eg: 10
log_interval = 10
# Max number of concurrent network connections. Eg: 1000
max_connections = 1000
# Max number of download messages received per second (per connection). 0 Means unlimited. 1000 โ‰ˆ 1MB/sec. Eg: 1000
max_download_rate = 0
# Max number of upload messages sent per second (per connection). 0 Means unlimited. 1000 โ‰ˆ 1MB/sec. Eg: 1000
max_upload_rate = 0

# Configuration for the web server (when running sdsweb)
[web_server]
# Location of the web server files Eg: "./web"
path = '/home/user/rsnode/sds1/web'
# Port where the web server is hosted with sdsweb. If the port is opened and token_on_startup is true, anybody who loads the monitor UI will have full access to the monitor
port = '18681'
# Automatically enter monitor token when opening the monitor UI. This should be false if the web_server port is opened to internet and you don't want public access to your node monitor'
token_on_startup = false


You can save and close the config file with Ctrl + X.


Run SDS resource node๐Ÿ”—︎

After setting up configuration properly, filled your wallet with STOS, you can now start your resource node.

# Node executable must be running in background at all times 
# so it's recommended to start a tmux window first:
tmux new -s rsnode

# Make sure you are inside the root directory of the resource node
cd ~/rsnode

# start the resource node
ppd start

Registration and Activation๐Ÿ”—︎

In order to interact with the resource node, you need to open A NEW COMMAND-LINE TERMINAL, and enter the root directory of the same resource node.

Then, use ppd terminal commands to start the interaction with resource node.

All ppd sub-commands should be executed in this ppd terminal.

# Open a new command-line terminal
# Make sure we are inside the root directory of the same resource node
cd ~/rsnode

# Interact with resource node through a set of "ppd terminal" sub-commands
ppd terminal


  • Registering the resource node to a meta node

The resource node(PP) should be registered to a meta node(SP) before doing anything else.

In ppd terminal, input one of the two following identical sub-commands:

rp

# or

registerpeer


  • Activating the resource node with deposit

You can activate your resource node for a specific TIER.

Choose the amount based on the tier you want to run on.

Tier Amount
Tier 1 800 STOS
Tier 2 1600 STOS
Tier 3 3200 STOS

After it is activated successfully, your resource node starts to receive tasks from meta nodes and thus gaining mining rewards accordingly.

activate <amount> <fee> [gas] 

amount is the amount of tokens you want to deposit. 1stos = 10^9gwei = 10^18wei.

fee is the amount of tokens to pay as a fee for the activation transaction. 10000wei would work. It will use default value if no fee amount is provided.

gas is the amount of gas to pay for the transaction. 1000000 would be a safe number. It will use default value if no gas amount is provided.

Example:

activate 1600stos 0.01stos

  • Start Mining

You should run this command:

1, After new node is activated

2, After node is unsuspended

Run the following command in ppd terminal:

startmining

  • Verify Activation Status

Run the following command in ppd terminal:

status


Update node binary๐Ÿ”—︎

If a newer version is released under SDS GitHub, you can update your current version by following these instructions:

  • Stop the ppd start process
  • Compile the new version:
cd $HOME
rm -rf sds
git clone https://github.com/stratosnet/sds.git
cd sds
go clean -modcache
git checkout tags/vX.XX.X (enter latest version)
make build
  • Replace the current binaries:
# If current binaries are installed under ~/bin folder, 
# otherwise use your custom installation path

cd $HOME
cp sds/target/* $HOME/bin/
  • Verify with
ppd version

# It should display the latest version available on GitHub
  • Edit rsnode/config/config.toml file at the following line with the latest version number:
# Formatted version number. Eg: "v0.12.0"
show = 'v0.12.0'
  • Start the ppd start process again.


Check resource node status๐Ÿ”—︎

There are a set of Restful APIs to check resource node status and Proof of Traffic(PoT) rewards.

You can input the following APIs in an explorer directly. We list some of them here and more details as well as examples can be found in Stratos Chain REST APIs


Check node registration status(register module)


  • Query total deposit state of all registered resource nodes and meta nodes
https://rest.thestratos.org/stratos/register/v1/deposit_total


  • Query params of register module
https://rest.thestratos.org/stratos/register/v1/params


  • Get all deposit info of a specific owner
https://rest.thestratos.org/stratos/register/v1/deposit_by_owner/{owner wallet address}


  • Get info of a registered resource node
https://rest.thestratos.org/stratos/register/v1/resource_node/{resource node network address}


  • Get info of a registered meta node
https://rest.thestratos.org/stratos/register/v1/meta_node/{meta node network address}


  • Get total number of registered resource nodes
https://rest.thestratos.org/stratos/register/v1/resource_node_count


  • Get total number of registered meta nodes
https://rest.thestratos.org/stratos/register/v1/meta_node_count


Check PoT rewards๐Ÿ”—︎

  • Query PoT rewards of a wallet_address at a specific epoch
https://rest.thestratos.org/stratos/pot/v1/rewards/wallet/{wallet_address}/epoch/{epoch}


  • Query current Pot rewards of a wallet_address
https://rest.thestratos.org/stratos/pot/v1/rewards/wallet/{wallet_address}


  • Query owner's Pot slashing info at a specific height
https://rest.thestratos.org/stratos/pot/v1/slashing/{wallet_address}


  • Check SDS prepay and Ozone(SDS module)

  • Get a simulated prepay result

https://rest.thestratos.org/stratos/sds/v1/sim_prepay/<amount of `wei` to prepay>

  • Get current nozPrice

https://rest.thestratos.org/stratos/sds/v1/noz_price

  • Get current nozSupply
https://rest.thestratos.org/stratos/sds/v1/noz_supply



Other ppd terminal commands๐Ÿ”—︎

Please refer to ppd terminal subcommands for more details.