Overview Work Market Companies Politics Wars

Running a ChainRepublik node

The ChainRepublik software is composed of two components. First is the java kernel ( source code) that maintains p2p connectivity, signs data transactions / packets, and performs the rest of the network-level tasks. The second component is the web interface ( source code) written in PHP. The web interface allows a regular user to access all of the network's functions, such as writing articles, voting, and so on.
The two components communicate via a database server such as MySQL. Also, the web interface, the database, or the java module does not need to be on the same server. In this tutorial we will use all the components on the same machine. Official implementation uses MySQL because it is free software but other servers (Oracle, SQL Server) can also be used.
Hardware Requirements

In order to run ChainRepublik you will need first of all a server with root access. Because the java module is very well optimized, it uses little memory and can run on average computers. Minimum requirements are 1 processing core and 1 GB of RAM. There are multiple options where you can rent a low budget server starting at $5 / month, like DigitalOcean or Vultr. If you want to mine, you will need a larger machine with at least 4 processing cores.
Software Requirements

Because the java kernel was written in java you can run it on any OS, but we strongly recommend a Linux implementation like Ubuntu 16 or newer with LAMP software stack installed. This tutorial is written for a Linux machine. LAMP is an archetypal model of web service stacks, named as an acronym of the names of its original four open-source components: the Linux operating system, the Apache HTTP Server, the MySQL relational database, and the PHP programming language.
Fortunatelly a lot of server providers deliver LAMP preinstalled on their systems and all you have to do is to move to the next step, but in case you rented a "bare metal" linux machine, you will have to install LAMP on your own. This is a simple tutorial on how to setup Apache, MySQL and PHP on your brand new server. For a more complex one check this link. Keep in mind that you will also need a FTP server installed like vsftp ( how to install ).
Install Java SDK

Because the kernel is written in java, you will need Java SDK installed. Run the following instruction on your Linux command line
sudo apt-get install default-jdk
You can check that java installed successfully by running java -version. Next we have to create a database and a user.
Setup the database

Both the java kernel and web interface use MySQL so we will have to create the initial database. You can manually create a database by typing create database db_name from your MySQL prompt, but other methods are also available. You will also need to create a user and grant it full rights on your new database. Write down the database name, the user and user's password because you will need them on the next step.
Starting ChainRepublik kernel

First of all you can get the last version by directly compiling the source code or by downloading the last build. In both cases you will end up with a .jar file called chainrepublik.jar and a dependencies directory. To run the kernel type
nohup java -Xmx1024m -Xms1024m -jar chainrepublik.jar -db_user=user db_pass=pass db_name=name wallet_pass=wpass &
Keep in mind that you will have to replace some parameters as following
  user - Replace this parameter with MySQL user created in previous step.
  pass - Replace this parameter with MySQL user password created in previous step.
  name - Replace this parameter with MySQL database name created in previous step.
  wpass - For security reasons the sofware maintains the users private keys in a separate file, AES256 encrypted. This is the   decryption password. Use a minimum 8 characters password. If you loose this password you will loose all private keys and all data   associated (coins, assets, companies and so on).
At first run, the kernel will create the initial wallet file containing the private keys. Search wallet.CRC on your system and make daily backups of this file. The walet will also create the db tables and populate them with initial data. After this step, it will connect to seed nodes and start the syncronizing process (download and execute all blocks from block 1). This process could take some time. Because we used nohup, the java module will run in background as a daemon. You can check that the node is running by logging into mysql db server and check the node database contents or by simply running top from your command line and search for a process called java. For error logs and other data, type sudo tail -n100 nohup.out
Installing the web interface
Installing the web interface is an easy process. You can get the last version of software from github source code or you can download it as an archive. In both cases you have to upload the files to your http root directory and setup the database name, databae user and database password. To change this parameters go to directory where tou uploaded the files and, and search for a directory kernel. You should find a file called db.php. Open it by typing sudo nano db.php and look for the following lines :
Change DB_USER with the database user created before. Also change DB_PASS and DB_NAME with the database user password / database name. Open your browser and type the webserver address or domain name. The standard first page should appear. Login as root (user root, password root) and you will be redirected to default root admin area. One of the first things you have to do is change the root password (Settings / Security). Use a strong password. Now you are all setup. Your game node is ready to accept players and you can also start mining.