Service Torrent node setup

Instruction on the GitHub LINK

❗️

Be sure to read the instructions on setting up the #MetaHashGate node here

🚧

Please pay attention that this package can be installed on devices running UBUNTU 18 (20 is also suitable).

Please check if you have required libraries:

cmake > 3.8
gcc > 8.0
libevent 2.1.8

Please follow these steps to build and run Torrent:

1. Preparation

sudo apt install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update

sudo apt install gcc-8 g++-8 liburiparser-dev libssl-dev libevent-dev git automake libtool texinfo make libgmp-dev libcurl4-openssl-dev libgcrypt20-dev libgnutls28-dev libboost-dev libre2-dev libgoogle-perftools-dev

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8
sudo update-alternatives --config gcc

2. Get and compile latest cmake

cd /tmp
wget https://github.com/Kitware/CMake/releases/download/v3.13.0/cmake-3.13.0.tar.gz
tar zxfv cmake-3.13.0.tar.gz
cd cmake-3.13.0
./bootstrap
./configure
make -j$(nproc)
sudo make install

3. Get and compile libevent

cd /tmp
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar zxfv libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure
make -j$(nproc)
sudo make install

4. Get and compile libmicrohttpd2
Please note: you must use this libmicrohttpd2 library, because the original libmicrohttpd library has no all functions available which are necessary for running Torrent.

cd /tmp
git clone https://github.com/metahashorg/libmicrohttpd2
cd libmicrohttpd2
./bootstrap
./configure
make -j$(nproc)
sudo make install

5. Get and compile libmhsupport

cd /tmp
git clone https://github.com/metahashorg/libmhsupport
cd libmhsupport/build
./build.sh
sudo make install

6. Build Torrent Node

cd /tmp
git clone https://github.com/metahashorg/Node-Torrent.git torrent_node
cd torrent_node/build
git checkout master
git submodule update --init
cmake .. && make

To run torrent, you have to add the file containing your private key to the folder containing torrent (/opt/mh-torrent). The file’s name must be as follows: wallet address.raw.prv. Create the file with this name and put private key in HEX format inside. Сlick here for information about where to get the private key in HEX format.

Example:
Name of the file - 0x007ff2d508be12392be5a381ca07b55c8fd02d09192a9b5cf4.raw.prv
Content of the file (in HEX format) -

30770211110420f9a9054ca699c38de747e9f6626fb3d4d87b4d02ef111e8e284d7f8e018afd6da00a06082a8648ce3d030107a14403420004886d9fe32423473984eb0c6782c69e64d08e33c1c89c74d3925dab93c73aff72b670f482e2f753f9f7811198f37abe8fa873d8afc665a5801a183246cc999dcс

Besides, you have to configure your config file (/opt/mh-torrent/config.conf). To do it, add the row with the name of your file containing private key or, if the row sign_key = ... already exists, replace the private key with your key in it.

Example: sign_key = "0x007ff2d508be12392be5a381ca07b55c8fd02d09192a9b5cf4".

Script for starting, stopping, restarting

Script torrent.sh for the following operations with MetaHash torrent application:

  • starting,
  • stopping,
  • restarting,
  • getting status.

Note: default workdir is /opt/torrent. If you’ve install torrent to another location please change workdir in script.

RUN script as follows:

./torrent.sh status

Update torrent to recent version

  1. Stop running torrent:

kill ps axuwf|grep torrent_node|grep -v grep|awk '{print $2}'

  1. Go to directory where you've cloned torrent_node, for example:

*cd /tmp/torrent_node

git pull
cd build
rm -rf
cmake ..
make -j$(nproc)*

  1. Start torrent:

./torrent_node torrent_config