Run a Validator
This article will guide you on how to run the Transformers application on CentOS7, ubuntu-22.04-desktop-amd64 operation system to join in Transformers network.
Recommended Configuration
- CPU: Recommend for Intel Pentium CPU series and above, core number 8 core and above.
- Memory: Recommend for 16G And above
- Hard Disk: Recommend for 500G with NVME protocol
- Bandwidth: 100 megabit upstream and downstream
Software requirements:
- Operation system:Run on CentOS 7、ubuntu-22.04-desktop-amd64 system.
Development environment:
If you need to perform secondary development on the source code, please follow the steps below to set up the environment. If you do not need to perform secondary development, please proceed directly to the installation steps.
The following software packages need to be installed:
- gcc (v9.3)
- cmake(v3.21)
- git
- unzip
- zip
- autoconf
- automake
- libtool
- perl-IPC-Cmd
Dependent Libraries:
- zlib
- zlib-devel
Orders:
yum install -y zlib zlib-devel
yum install -y unzip zip
yum install -y autoconf automake libtool
yum -y install perl-IPC-Cmd
yum install -y devtoolset-9-toolchain
scl enable devtoolset-9 bash
scl enable devtoolset-9 bash
is used to set gcc tool chain to devtoolset-9
CMake upgrade
The CMake version should be at least 3.15.x and the recommended version is 3.21.x
curl -O https://cmake.org/files/v3.21/cmake-3.21.4.tar.gz
tar zxvf cmake-3.21.4.tar.gz
cd cmake-3.21.4
./configure
gmake && make install
1. Source code compilation
If you do not want to compile the source code for installation, please proceed directly to package installation.
Getting source code
git clone https://github.com/tfs-labs/tfs
Compiling
cd TFSC
mkdir build_primary_release && cd build_primary_release
cmake .. -DPRIMARYCHAIN=ON -DCMAKE_BUILD_TYPE=Release && make
The program will generate relevant files in the bin directory after compilation.
Verify the CentOS server time
Ensure that the time of each node is the same and that the transaction is reliable when it is linked
1. Install NTP
sudo yum -y install ntp
2.Use ntpdate to test NTP
ntpdate pool.ntp.org
3.check sever time
date
4.Start ntpd daemon for calibration time
systemctl start ntpd
5.Check whether the ntpd daemon is started
systemctl status ntpd
2. Program compilation
Download && init
Go to Transformers Version Updates page to find the latest package download.
- Download the main network program(tfs_v1.0x.x_dev.zip), then unpack to get the tfs_v1.0x.x_dev binary executable, and then modify the execution permission of the program.
unzip tfs_v1.0x.x_dev.zip
chmod +x tfs_v1.x.x_dev
./tfs_v1.x.x_dev
Starting the program ,and the configuration file will be automatically generated.
./tfs_v1.0x.x_xxxxx_dev
View the contents of the config.json
file
{
"http_callback": {
"ip": "",
"path": "",
"port": 0
},
"http_port": 20620,
"info": {
"logo": "",
"name": ""
},
"ip": "192.168.1.1",
"log": {
"console": false,
"level": "OFF",
"path": "./logs"
},
"rpc": false,
"server": [
"13.52.162.66",
"52.52.118.136"
],
"server_port": 20619,
"version": "1.0"
}
Modify config.json
file
"server" field: This field fills in any ip node in the Transformers network,Obtain IP information of other nodes through the http://yournode:http_port/pub interface.
"server_port" field: This field is the network connection port number (it does not need to be changed by default)
"Log" field: "Console" indicates whether the log is output on the screen;"Level" indicates the level of output log;"Path" indicates the path of the default log generation.
"Ip": the system will detect the local ip and automatically fill in this field when starting.
"Http_port": the port of the http service.
"Rpc": the switch of the access interface, the interface can be accessed when it is turned on, and it is turned off by default.Introduction of specific application scenarios in Developers
"Info": the logo and name of the node set by the user.
"Http_callback": http callback interface,Introduction to specific application scenarios in Callback interfaces.
"Version": the version of the config file.
To view the automatically generated directories and files under the current directory.
cd tfs_v1.0.x_xxxx_testnet
Files or directories | Type | Description |
---|---|---|
cert | folder | Store the generated private key with the suffix ".private" as a private key file |
data.db | folder | Store database file |
logs | folder | Store log file |
config.json | json file | configuration file |
Protect your private key
- The private key in the cert must not be lost.
Open corresponding port shall be port 20619、port 20620.
Start The Node
Directly start the program
./tfs_v1.0.x_xxxx_testnet
Add parameter[ -m ] to start the program to display menu
./tfs_v1.0.x_xxxx_testnet -m
Time display box
UTC time and server time display:
UTC Time: 2024/01/19 02:00:24
Ntp Time: 2024/01/19 02:00:24
ThreadNumber:265
The validator server must be consistent with UTC time, and not synchronizing will result in the inability to verify transactions
Account display box
Account information display:
*********************************************************************************
Version: 1_1.0.0_d
addr: 0x9B7723CdBaaa04Eb63efC14676030F21F76Cda18
Balance: 0.00000000
Block top: 0
*********************************************************************************
illustrate
Version:
Version number of the programaddr:
addr is a public and private key string generated by the keccak256 encryption algorithm, used for the address of the wallet.Balance:
Balance for the corresponding Base58.Block top:
The height of the current block.
Menu display box
- Menu function display:
1.Transaction
2.Stake
3.Unstake
4.Delegate
5.Withdraw
6.Get Bonus
7.PrintAccountInfo
8.Deploy contract
9.Call contract
10.Account Manager
0.Exit
Please input your choice:
Explain the function of the menu.
Order | Menu Items | Function |
---|---|---|
1 | Transaction | Validator provides command line transfer function, and can complete TTOS transfer according to prompts |
2 | Stake | Becoming a validator node requires staking a certain amount of TTOS |
3 | Unstake | Revoke your stake operation. Please understand the stake rules before revoking |
4 | Delegate | Delegate TTOS to validators to obtain revenue,is equivalent to investing |
5 | Withdraw | Revoke your investment in validators |
6 | Get Bonus | The validator needs to claim its own rewards every day in order for delegators to receive their investment dividends |
7 | PrintAccountInfo | Print account information,View your own balance changes and block heights |
8 | Deploy contract | deployment smart contract |
9 | Call contract | Execute smart contract |
10 | Account Manager | 0. Exit 1. Set Default Account 2. Add Account 3. Remove 4. Import PrivateKey 5. Export PrivateKey |
0 | Exit | Exit the program |
As an RPC node
If you want your validator to act as an RPC node, it only takes a few simple steps to complete.
- Modify the
config.json
file and set rpc to true
"rpc": true,
- Configure the value of
http_port
as the HTTP access port.
"http_port": 20620,
Complete configuration example:
Enable RPC node service and set callback interface
{
"http_callback": {
"ip": "192.168.1.123",
"path": "/path/rollback_block",
"port": 6071
},
"http_port": 20620,
"info": {
"logo": "",
"name": ""
},
"ip": "192.168.1.119",
"log": {
"console": false,
"level": "debug",
"path": "./logs"
},
"rpc": true,
"server": [
"192.168.1.217",
"192.168.1.126"
],
"server_port": 20619,
"sync_data": {
"count": 50,
"interval": 50
},
"version": "0.39"
}
- Restart the tfs program after the settings are complete
To test whether the RPC node is enabled, you can query the node information for detection.