We recommend not using the root user to run the node. You can add a user on your server. For example:
adduser stafi and if you need to add sudo permission for using stafi. You can modify
/etc/sudoers and add
stafi ALL=(ALL:ALL) ALL.
In addition, you should run the node in the background. Maybe you can create a systemd service or use some commands like screen or nohup, or some other tools. If you need more information about these commands, please google it.
git clone https://github.com/stafiprotocol/stafi-node.gitcd stafi-nodegit checkout v0.4.1
You can add
export PATH="$HOME/.cargo/bin:$PATH"in the ~/.bashrc and restart the terminal or run source ~/.cargo/env to update the environment temporarily.
cargo build --release
It may take 30m - 1h, which depends on your machine.
You may encounter CMAKE_PROJECT_VERSION error. Please scroll to the bottom and follow the instructions to fix it.
If you encounter other compilation problems, please try
rustup install nightly-2020-10-06rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-06cargo +nightly-2020-10-06 build --release
./target/release/stafi --validator --name='your name' --execution=NativeElseWasm
./target/release/stafi --pruning=archive --rpc-cors=all --ws-external
Note: By default, Validator nodes are in archive mode. If you've already synced the chain not in archive mode, you must first remove the database with stafi purge-chain and then ensure that you run Stafi with the --pruning=archive option. The --pruning=archive flag is implied by the --validator and --sentry flags, so it is only required explicitly if you start your node without one of these two options. And if you just want to run a simple sync node, only the state of the past 256 blocks will be kept.
You can see your node on telemetry.
Make sure to enable
30333libp2p port on your server. Eventually, it will take a little bit of time to discover other peers over the network.
./target/release/stafi \--base-path ~ \--chain=mainnet \--port 30333 \--ws-port 9944 \--rpc-port 9933 \--validator \--name 'your name' \--execution=NativeElseWasm
Flags in detail:
Specifies a directory where Substrate should store all the data related to this chain. If the directory does not exist it will be created for you.
Specifies which chain specification to use. [default: mainnet]
Specifies the port that your node will listen for p2p traffic on. 30333 is the default and this flag can be omitted if you're happy with the default. If run multiple nodes on the same physical system, you will need to explicitly specify a different port for it.
Specifies the port that your node will listen for incoming web socket traffic on. 9944 is the default, so it can also be omitted.
Specifies the port that your node will listen for incoming RPC traffic on. 9933 is the default, so it can also be omitted.
Means that we want to participate in block production and finalization rather than just sync the network.
human-readable name in the telemetry UI
The execution strategy that should be used by all execution contexts [possible values: Native, Wasm, Both, NativeElseWasm]
RPC methods to expose. [default: Auto] [possible values: Auto, Safe, Unsafe]
Specify browser Origins allowed to access the HTTP & WS RPC servers
Listen to all Websocket interfaces
Make sure you are on the right branch. And there is no need to shut down your node when recompiling.
cargo build --release
Please restart your node after the compiling.
If you need to start from the beginning. You should clean your db.
### Mainnet./target/release/stafi purge-chain --chain=mainnet### Testnet./target/release/stafi purge-chain --chain=testnet
1. Head to app.ankr.com to deploy and click the Deploy A Node button.
2. Search or scroll down to find the Stafi card, hover over it, select Validator Node and press Deploy.
3. Now you are taken to the configuration page. The hardware configuration is set at the recommended system requirements, but you can choose to increase the specifications if you wish to do so, by using Advanced button.
4. The platform also recommends a cluster, which is usually the one that has the most freely available resources. In this particular case, the recommended cluster is the United Kingdom cluster, but another cluster may be recommended for you, depending on your location.
5. The Project Name / Node Name for use in the Ankr application is pre-filled. You can change it if you want (please note that only a small set of special characters are allowed in this name).
6. Select Payment Method, choose number of months you want to run the node by moving the slider. The price and discount will increase when you extend the run time.
If later on you want to extend the node’s run time, you can add funds at any time.
7. Click Proceed to payment
8. Select payment method (USDT, ANKR erc20 or add your credit card)
9. For this tutorial we will choose Add New Credit Card
10. Provide all requested information and click Pay with Credit Card
11. If all information is provided successfully the deployment will of the node will start
12. Your node is now deployed and will sync with the network
13. On the information tab you will find Status of your node, the Name of your node and the Session Key
Your node is up and running, now we need to get validator status. All details can be found using the following link: https://docs.stafi.io/validator-sv/become-a-validator Below some high level steps to become a validator.
14. When your node is fully synced, you can set the session keys. Your node is running in validator mode.
You need to tell the chain your Session keys . This is what associates your validator with your Controller account.
15. In the Stafi Portal (https://apps.stafi.io/#/explorer) go to Staking > Account Actions, and click "Set Session Key" on the bonding account. Copy the Session Key from the Ankr app in the field and click "Set Session Key".
16. Now you are reading for validating.
Verify that your node is live and synchronized, head to Telemetry in Stafi Portal and find your node. Note that this will show all nodes on the Stafi network, which is why it is important to select a unique name in the Ankr app.
If everything looks good, go ahead and click on "Validate" in Stafi-apps.
Payment preferences - You can specify the percentage of the rewards that will get paid to you. The remaining will be split among your nominators.
If you go to the "Staking" tab, you will see a list of active validators currently running on the network. At the top of the page, it shows the number of validator slots that are available as well as the number of nodes that have signaled their intention to be a validator. You can go to the "Waiting" tab to double check to see whether your node is listed there.
The validator set is refreshed every era. In the next era, if there is a slot available and your node is selected to join the validator set, your node will become an active validator. Until then, it will remain in the waiting queue. If your validator is not selected to become part of the validator set, it will remain in the waiting queue until it is. There is no need to re-start if you are not selected for the validator set in a particular era. However, it may be necessary to increase the number of FIS tokens staked or seek out nominators for your validator in order to join the validator set.
Congratulations! If you have followed all of these steps, and been selected to be a part of the validator set, you are now running a Stafi validator and start earning rewards!
1.Failed to run custom build command for
/home/stafi/.cargo/registry/src/github.com-1ecc6299db9ec823/wabt-sys-0.7.2/wabt/src/option-parser.cc:60:20: error: MAKE_PROJECT_VERSIONwas not declared in this scopeprintf("%s\n", CMAKE_PROJECT_VERSION);^~~~~~~~~~~~~~~~~~~~~make: *** [CMakeFiles/wabt.dir/src/option-parser.cc.o] Error 1make: *** [CMakeFiles/wabt.dir/all] Error 2make: *** [all] Error 2
This may be a problem with your cmake version. You can try this to fix it.
wget https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3-Linux-x86_64.tar.gztar -xzvf cmake-3.17.3-Linux-x86_64.tar.gzsudo mv cmake-3.17.3-Linux-x86_64 /opt/cmake-3.17.3sudo ln -sf /opt/cmake-3.17.3/bin/* /usr/bin/cmake --version
More download versions on Cmake