DEV Community

Cover image for How to config a Cyberyen Full Node
C¥kuza
C¥kuza

Posted on • Edited on

How to config a Cyberyen Full Node

CYBERYEN FULL NODE

Any computer that connects to the cyberyen network is called a node. Nodes that fully verify all of the rules of cyberyen are called full nodes. The software implementation of full nodes is called cyberyen-core, its releases can be found on their github page.

WHAT IS A FULL NODE
A full node is a node (computer system with cyberyen-core running on it) which downloads every block and transaction and check them against cyberyen’s consensus rules. Which fully validates transactions and blocks. Almost all full nodes also help the network by accepting transactions and blocks from other full nodes, validating those transactions and blocks, and then relaying them to further full nodes.

Some examples of consensus rules:

  • Blocks may only create a certain number of cyberyens.
  • Transactions must have correct signatures for the cyberyen being spent.
  • Transactions/blocks must be in the correct data format.
  • Within a single blockchain, a transaction output cannot be double-spent.

At minimum, a full node must download every transaction that has ever taken place, all new transactions, and all block headers. Additionally, full nodes must store information about every unspent transaction output until it is spent.

By default full nodes download each new transaction at least twice, and they store the entire block chain forever.

ARCHIVAL NODES
A subset of full nodes also accept incoming connections and upload old blocks to other peers on the network. This happens if the software is run with -listen=1 as is default.

Contrary to some popular misconceptions, being an archival node is not necessary to being a full node. If a user’s bandwidth is constrained then they can use -listen=0, if their disk space is constrained they can use pruning, all the while still being a fully-validating node that enforces cyberyen’s consensus rules and contributing to cyberyen’s overall security.

Most information was referenced from the wiki of our big brother Bitcoin.

Prerequisites:

• A Linux-based server (Debian/Ubuntu recommended)
• Basic command-line knowledge
Enter fullscreen mode Exit fullscreen mode

SETUP CYBERYEN CORE
Now for the fun part, to setup cyberyen-core on linux, use an Ubuntu 18.04 or Debian 10/11 instance and the following commands will be executed as a non-root user.

Create a New User
Create a new user that you'll use to run the Cyberyen node. Replace <user_name> with your desired username:

$ sudo useradd -s /bin/bash -d /home/<user_name> -m -G sudo <user_name>
Enter fullscreen mode Exit fullscreen mode

Create password:

$ sudo passwd <user_name>
Enter fullscreen mode Exit fullscreen mode

Switch to the new user account:

$ su <user_name>
Enter fullscreen mode Exit fullscreen mode

Installation
Update the package manager and install the dependencies:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential
$ sudo apt-get install autoconf libtool pkg-config libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libevent-dev libqt4-dev libcanberra-gtk-module libdb++-dev libfmt-dev
Enter fullscreen mode Exit fullscreen mode

Install BerkelyDB
Cyberyen Core is using BerkleyDB 4.8.30:

$ wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz && tar -xvf db-4.8.30.NC.tar.gz && sudo rm -rf db-4.8.30.NC.tar.gz
$ cd db-4.8.30.NC/build_unix && mkdir -p build && BDB_PREFIX=$(pwd)/build && ../dist/configure --disable-shared --enable-cxx --with-pic --prefix=$BDB_PREFIX
$ sudo make install
Enter fullscreen mode Exit fullscreen mode

Compile Cyberyen
Clone the source code from Github:

$ cd ~
$ git clone https://github.com/cyberyen/cyberyen.git
Enter fullscreen mode Exit fullscreen mode

Build the code:

$ sudo chmod 775 -R ~/cyberyen && cd cyberyen
$ ./autogen.sh
$ ./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/"
$ make
Enter fullscreen mode Exit fullscreen mode

Strip unnecessary symbols and copy the binaries to /usr/bin:

$ sudo strip src/cyberyend src/cyberyen-cli src/cyberyen-tx
$ sudo cp -a src/cyberyend src/cyberyen-cli src/cyberyen-tx /usr/bin
Enter fullscreen mode Exit fullscreen mode

Configuration
Create the cyberyen configuration, if you don’t set CYBERYEN_RPC_USER it will use the user cyberyen and if you don’t set CYBERYEN_RPC_PASSWORD it will generate a password:

$ cd ~
$ mkdir .cyberyen
$ cat > .cyberyen/cyberyen.conf << EOF
server=1
daemon=1
rpcallowip=127.0.0.1
rpcuser=${CYBERYEN_RPC_USER:-cyberyen}
rpcpassword=${CYBERYEN_RPC_PASSWORD:-$(openssl rand -hex 24)}
rpcport=58382
listen=1
txindex=1
EOF
Enter fullscreen mode Exit fullscreen mode

Then launch cyberyen node:

$ cyberyend
Enter fullscreen mode Exit fullscreen mode

Once cyberyend process has started, the initial block download will start and you can get the progress as the cyberyen user using the cli:

$ cyberyen-cli -getinfo
Enter fullscreen mode Exit fullscreen mode

The help RPC lists all available public RPC commands, or gets help for the specified RP:

$ cyberyen-cli help
Enter fullscreen mode Exit fullscreen mode

Setting auto-reboot
The cyberyen daemon should run forever, even after we exit the interactive ssh session on the server. To avoid a server crash program the system to restart it automatically:

$ crontab -e
Enter fullscreen mode Exit fullscreen mode

This command will open the text editor with a special type of file that Linux systems use to schedule tasks automatically. Scroll to the bottom of the text file and enter the following line of text:

@hourly ~/cyberyn/src/cyberyend
@reboot ~/cyberyn/src/cyberyend

Press Control+O (^O) to save the file, then Control+X (^X) to exit the text editor.

Don't forget about security measures and firewall settings.

In this article, we will run a full Cyberyen node over Tor.

Here is the place to contact us:
Support [Matrix]

Thanks C¥kuza.

Image description

Top comments (0)