TERA: Step-by-step instruction for node installation with additional tips
With each day more and more people are getting to know about the TERA blockchain project. Some of them decide to join the creation of a new economy without borders, which its developers and participants are striving to achieve. This is evidenced by the map, which shows on-line nodes in action around the world. If in April 2019 the average number of nodes, supporting the work of the fastest blockchain TERA, was about 600, in the middle of May the number of network-connected nodes was 1200 at average, and sometimes even went beyond 2,000. In previous articles it was told already what the TERA blockchain project has to offer: high scalability (1000 tps), free transactions in a few seconds, decentralized applications… And the list could go on. TERA has the potential for realizing a variety of ideas. In short-term goals of the main TERA developer is launching sharding technology with an increase in scalability up to 1 million transactions per second.
TERA block generation
It is worth noting that TERA is a blockchain with the fastest expansion rate. Each new block is generated every second, thus, the reward is charged once a second to the miner whose computer device won the hash calculation. Coins are mined using a memory-optimized CPU. And in the work of the blockchain itself, the consensus PoW is applied.
The following link contains instructions for the nodes installing and the project specification: https://sourceforge.net/p/tera/code/ci/master/tree/. But this information could not be enough for a person who does not understand the details of programming and administering systems. Although everything is actually not so difficult, the following article provides detailed description of every step that needs to be done to set up a node and start mining.
Now, let’s get started.
Detailed installation instructions for the TERA node
To create a working node, we need:
1. Get static IP;
2. Open ports 30000 and 8080 (can be changed);
3. Download the latest database to speed up synchronization with the entire blockchain;
4. Install Advance Software Packages;
5. Build the secp256k1 cryptographic library;
6. Set wallet.
After that, the node can be started. But it might be necessary to make the adjustment of the available capacities and optimize the amount of memory for the number of threads. Information about this will be given further, as well as an example of the calculation of remuneration.
First of all, let’s download the TERA blockchain database. The latest versions of archives we can find in the Discord group on the #links channel, which we can join by invitation https://discord.gg/dzSGKyR. Or download torrent — https://sourceforge.net/p/tera/code/ci/master/tree/Torrent/Tera-folder-DB.torrent?format=raw
In Discord, database links look as follows:
Choose the link that corresponds to your region.
The latest database at the time of writing this article for June 03, 2019:
Downloading the database by links to other Internet resources, not belonging to the official website or TERA project groups, is highly not recommended for security purposes.
While the database is being downloaded, which will speed up node loading, we will configure ports and install other components we need: Node.js software platform from the official website (version 8.11 is recommended) and the distributed version control system Git.
The official site address for downloading the installation file Nodejs: https://nodejs.org
The developer recommends installing version 8.11, since it has been tested. It can be found at the following link, according to your operating system: https://nodejs.org/download/release/v8.11.4/
Version 10.15 was also tested out with positive results.
Address for Git downloading: https://git-scm.com/download/win
Prepare the ports
You need a static (direct) IP address. It can be ordered from an internet provider. Various resources allow you to find out your IP. A search service will help you with that.
For example, I found out that my static IP: 220.127.116.11 and wrote it down, as I will need it for further configurations.
Also, to exchange information with the blockchain, we need to open ports (by default) 30000 and 8080.
Let’s open port 8080 in Windows 10:
1 — open firewall Windows. You can find it through the menu search “Start” or through “Control Panel” — “System and safety” — “Windows Firewall”;
2 — in the firewall select “Advanced Options”;
3 — in the opened window select: “Rules for incoming ports” and “Create a rule”;
4 — in the “New Connection Wizard” note: “For the port”;
5 — our next step is to specify “TCP Protocol”, write to which port the rule (8080) will be applied and click “Next”;
6 — in the step “Action” specify: “Allow connection”, then click “Next”;
7 — in “Profile” will be no changes, “Next”;
8 — the final step requires to write the port name and its description (the last one is not necessary).
After that, the button: “Done”.
The similar way we create the “Rule for outgoing connection”.
And in the same way we open the port 30000.
The “netstat –a” command helps to find out which ports are opened. After its introduction into the command line, the list will open.
Let’s proceed to the main stages of installation, which are given here: https://sourceforge.net/p/tera/code/ci/master/tree/. To do this, we need to enter a series of commands in the Power Shell or cmd. Some commands require administrative rights, so run a command line shell directly on its behalf.
To enable the command line as an administrator, right-click on the console shortcut and select the corresponding item from the context menu. Cmd can be found through the search of Windows 10, or through the “Start” menu in the “System Tools” category.
We start the installation. Enter in cmd:
Or just “c:”
Here you choose the disk on which the node will be installed. So you can change “c:” on any other disk. Taking into consideration that the database of the blockchain takes at least 5 gigabytes, and it will be stored in the folder with the node, you need to select a disk with adequate memory.
Next, download the source to the computer:
git clone https://git.code.sf.net/p/tera/code wallet
(For the next three commands, examples are shown in the Power Shell)
We are waiting for the completion and enter the following command, which will allow to download and install the toolkit for further compilation of the crypto library from the sources. Here you will need to run cmd or PowerShell with administrator rights:
npm install — global — production windows-build-tools
After execution, run the next installation process:
npm install -g node-gyp
logs into the folder with the node.
Here we compile a cryptographic library secp256k1. It is important that there are no errors during this process! Load packages into the directory via the command:
Error: VERY SLOW LIBRARY
In the process of node operating, as practice has shown, the following error message may appear:
“WARNING: VERY SLOW LIBRARY: secp256k1”
This can lead to the fact that the node will not have time to process the blocks with a large number of transactions, so you need to eliminate this error. To eliminate it, you will need to reinstall the library from fresh sources.
Here is described how to do it: https://www.npmjs.com/package/secp256k1
We continue the installation and proceed to connect the port 8080. In the specified place you need to enter a secret word, otherwise your wallet can become an easy prey for hackers.
So, enter the command:
node set httpport:8080 password:
and set a password protection.
The node is ready and you can start it with the command:
but its work requires full synchronization with the network. With a clean database, the process starts from zero and takes a long time. It will look like this:
To speed up the process, we downloaded the database. Unpack the archive and copy files from the DB folder.
And paste into the DB folder of the installed wallet, after deleting all the files in it.
The DB will appear in the DATA folder. Until the node is started for the first time, it will be no this folder.
After this step, the indicators will change and the synchronization time will be reduced. The indicate of the fact that the database is being filled up is not only the percentage value, but also a decrease in the number of DB Delta and TX Delta.
The end of synchronization will be reported by: «Synchronization complete»
For mining you must open the port. We have already managed to prepare it earlier, therefore we assign a command (action with the administrator rights):
netsh advfirewall firewall add rule name=”Open 30000 port” protocol=TCP localport=30000 action=allow dir=IN
To access the node in the browser, you must enter the local address 127.0.0.1:8080 or localhost:8080.
Creating a TERA wallet and account
Mining implies a reward for generated blocks. For that you need to create a wallet and an account that will be assigned for charging TERA coins.
TERA wallet is created in just a few clicks:
1 — press the button “New wallet”;
2 — press the button “Save”.
Copy and save your key in a safe place. It will provide your access to the wallet with accounts. Wallet change can be done through button “Edit wallet” (3).
An account is created as follows:
1 — press the button “New account”;
2 — in a line “Public name” write down the account number. On the example on the picture it had name «ACCOUNT_NAME»;
In “Currency” line is blockchain TERA currency by default (it’s ID — 0);
“Adviser” — here is ID of account of the one who invited you or consultant (not necessary);
“Smart” — here, if necessary, is assigned a binding to the smart contract ID or DApp.
3 — now button “Create”. Wait a few seconds and you will see the created account.
We get the account number (ID). In our example it is 200382. To assign this account for accrual of remuneration for mining, simply click the “Set mining” button and enter its ID in the line “Mining account”.
The preparation is almost over and there are several steps left to start mining (Pic.27):
- Press the button “Net connect” (1) and make sure that there is a check mark (2) next to “Run server and use direct IP”, and under it there is really your static IP and port (3);
- set load percentage CPU (4);
- toggle to the right the switch “Mining” (5).
After that, the mining begins.
Error while changing IP
If suddenly you made a mistake and your address was not static, then it will change for example when you restart the computer. Mining will not start, which will be indicated by the red color under the “Mining” switch button. Upon that, the values of DB delta and TX Delta will be increasing.
If the address has changed, then the new value can be indicated in the wallet: press the Net Connect button (1) and enter the new value in the opened line.
Save and restart node (2).
Number of threads
By default, the program will take for mining one core less than the computer has. For example, if the computer processor has 32 threads, the CPU RUN will be 31/31 by default. Free RAM will allocate at them. For each processor thread allocates a memory multiple of the degree 2: 512 MB, 1 GB, 2 GB, 4 GB. A volume of 2 GB considered to be the best, but it is worth to take into consideration about 10% additionally for service purposes. That is, for example, not 1 GB, but 1.1 GB.
How much memory was taken on the thread is informed in the log with the following messages:
With 2GB it would be 256 M, with 4GB — 512 M.
On the picture below we see that
1- mining launched; 2 — CPU power is used by 50%; 3 — remuneration is charged to the account ID 200382; 4–47 threads are allocated for the node and each of them is in operation.
Setting the number of threads for the available memory using constants
What constant is responsible for what function is written here: https://sourceforge.net/p/tera/code/ci/master/tree/Doc/Rus/CONSTANTS.MD. The most important points for the miner are: the allocated power of the CPU, the number of cores involved into the mining and the memory used by each thread. The constant allows to correct the number of threads, involved into the work:
Change the “0” value to the number of threads, that you consider to be the most appropriate for currently available in-memory reserves. For example, for “42”
42 threads will be involved into the mining.
If you have, let’s say, 96 GB of RAM, then each thread will take 2.2 GB. As a result, the amount of used memory will be about 92.4 GB
If we know the total hashrate of the network and the available capacities, it is possible to make an approximate calculation of the average time to receive remuneration for one unit.
The total hashrate is displayed both in the web wallet and in the node interface, in the tab EXPLORER — Counters
Let’s conduct an approximate calculation for the total hashrate, shown on the picture: 15600 (15.6 trillion). Let’s take specified in the example above 42 threads with 2 GB of memory (200 MB, which are taken for service purposes for each thread, are not taken into account, but only the hashset itself), that is 84 GB (84 billions).
1st action: 84/8 (hash in memory takes 8 bytes) = 10,5;
2)15600/10,5 = 1486 sec.
This is assuming that the memory is 100% full of valid hashes. But really, this does not happen. According to practice, the proportion of valid hashes in memory is within 60–90%. Here the frequency of the processor does it’s part. Taking into account practical data, we obtain a discrepancy coefficient of 0.1 ÷ 0.4. That is, the time to obtain a block is increased for 150–600 seconds.
As a result, the approximate time of the reward for the stable node operation: every 1635–2100 seconds.
This data continue to be relevant around 5,000 blocks.
Observing the TERA project, it is sure that it is regularly updated and improved. So, for example, one of the April 2019 updates allows to start mining without waiting for the full database load. This is very important when you first start the node or after a long break. This function is activated by a constant.
where a different from zero value indicates how many blocks need to be loaded from the end of the chain.
It should be noted that restarting the node takes some time from the total period of “useful” work, since it requires 5000 blocks for “energization”, which is approximately 1,5 hours. Therefore, the second advice is — before briefly shutting down or restarting a node, consider whether this action is necessary.
For analytics and all sorts of calculations, as well as observation of the process of mining, graphs with statistical data can be a great help. But you should pay attention that their constant inclusion absorbs RAM (about 1GB per day). This can affect the memory that is allocated to mining. In this case, errors and “emergency” restart of the node can hardly be avoided. For this reason, the next tip is — after viewing the graphs, do not forget to shut them down, to avoid unnecessary loss of memory resources.
Detailed instructions and advices will help to join the work of the blockchain and get your remuneration in the shortest possible time. Welcome to the project, an important part of which you have become! Now your city is also displayed on the online map of the TERA crypto-union (https://terafoundation.org/map.html)