How to run a Full Node: COTI’s technical guide

COTI
COTI
Published in
6 min readSep 19, 2019

In COTI, Full Nodes are the main client-facing nodes of the system. Wallets are connected to Full Nodes to process transactions and receive payments. Full Nodes are responsible for PoT Consensus, attaching transactions to the COTI DAG and performing PoW. In the COTI network, Full Nodes can define their own price list and compete for customers.

By following the instructions in this guide, any COTI user can run a COTI Full Node. This is made possible through the user’s own hardware or by renting a cloud-based server. We recommend that users rent a server from a reliable hosting provider. In any case, your server will require a static IP address and domain name to run a Full Node.

The server configuration has the following parameters:

✓ 16GB of memory
✓ 4 vCPU cores
✓ Bandwidth (up to 3.5 Gbps)
✓ Broadband Internet connection
✓ 24/7 availability
✓ Operating system: Ubuntu/Linux/Windows

The estimated costs for running such a VPS on Digital Ocean or Vultr is approximately $40-$80 per month.

Check if Java is already installed in Ubuntu

Java is a very popular general purpose programming language. To this effect, it may already be installed on your server. To check if Java is installed, open a terminal and type in the following command:

java -version

If you have Java installed, you will see this output:

openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

From the above output, you can see the system already has Java 10 installed via OpenJDK.

Install JRE in Ubuntu and Linux Mint

If your server doesn’t have Java installed, open a terminal and use the following command to install JRE:

sudo apt install default-jdk

This will install the latest JDK available from Ubuntu.
Next run:

java -version

The output should look like this:

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

Install Apache Maven

You can download the latest stable version of Apache Maven from their official website. Otherwise, you can download it directly using the following command:

cd /opt/

wget http://apache.spd.co.il/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz

Once the download has completed, extract the downloaded archive.

sudo tar -xvzf apache-maven-3.3.9-bin.tar.gz

Next, rename the extracted directory.

sudo mv apache-maven-3.3.9 maven

Next, you will need to setup the environment variables, such as M2_HOME, M2, MAVEN_OPTS, and PATH. Do this by creating a mavenenv.sh file inside of the /etc/profile.d/ directory.

sudo nano /etc/profile.d/mavenenv.sh

mavenv.sh should look like this:

export M2_HOME=/opt/maven

export PATH=${M2_HOME}/bin:${PATH}

Save and close the file, update its permissions, then load the environment variables with the following command:

sudo chmod +x /etc/profile.d/mavenenv.sh

sudo source /etc/profile.d/mavenenv.sh

Verify installation

Once everything has been successfully configured, check the version of the Apache Maven.

mvn — version

You should see an output like this:

Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T19:00:29Z)
Maven home: /opt/maven
Java version: 1.8.0_191, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-145-generic", arch: "amd64", family: "unix"

You have just successfully installed Java and Apache Maven on your machine!

Clone and build the COTI Full Node from Source

Type the following into a terminal window:

cd ~

git clone https://github.com/coti-io/coti-fullnode.git

Now, change the directory to your freshly cloned git repository:

cd ~/coti-fullnode/

and run the following command to build the COTI Full Node:

mvn initialize && mvn clean compile && mvn -Dmaven.test.skip=true package

Install nginx and configure SSL

Update your local package index:

sudo apt update

Install Nginx:

sudo apt install nginx

You may need to adjust your firewall settings at this step. Please refer to the nginx manual to do so; in any case, port 443 should be open.

Check systemd init to make sure the service is running:

systemctl status nginx

Get SSL keys

You will need an SSL key for https to work properly, and the COTI wallet needs a secured (https) connection to function. You can get an SSL certificate for your domain for free at https://letsencrypt.org/.

You’ll need to upload your keys with any SFTP client (e.g., CyberDuck for MacOS), create the server configuration file /etc/nginx/sites-enabled/coti_fullnode.conf (see the file content in the Addendum) and include it to your nginx configuration file /etc/nginx/nginx.conf:

http {
include mime.types;
sendfile on;
keepalive_timeout 65;
# set client body size to 6M #
client_max_body_size 6M;
server_tokens off;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
include /etc/nginx/sites-enabled/*;
}

Restart nginx:

sudo /etc/init.d/nginx restart

If everything is correct, your server should be up and running.

Create and edit properties file

[link to download sample .properties file]

Upload the fullnode.properties file to the coti-fullnode/fullnode/ directory.

See Addendum for an example.

Now, you will need to change some values in the .properties file, namely:

global.private.key and fullnode.seed. To do so, open your COTI wallet (https://crypto-wallet.coti.io).

Generating the seed

For the COTI Full Node to participate in the network and collect fees, it should have a wallet. Creating a wallet is a standard procedure for all COTI users, including Full Node owners.

Go to https://crypto-wallet.coti.io/connect and generate your seed (you may need to complete KYC verification first).

Click Generate New Seed and select the type of network you need this key for (e.g., MainNet or TestNet). Provide your private key (think of it as a password) and generate your seed. Don’t forget to write down your private key somewhere! If you lose it, you can lose access to your wallet!

*At this stage you can only run TestNet Full node

Now, press the ‘Generate Seed’ button and copy the resulting seed value. Keep it in a safe place.

Now, log in with your seed and generate your private key. To do this, press the ‘Account Keys’ button and copy your private key. Insert it into the global.private.key string in the .properties file.

Run the COTI node

Now you can finally run your very own COTI network node. To do so:

cd /coti-fullnode/fullnodejava -jar fullnode/target/fullnode-0.0.1-SNAPSHOT.jar --spring.config.additional-location=fullnode.properties

Check that the Full Node is on

Now, open your server’s IP address in your preferred browser, and you will see your very own Full Node.

Addendum — fullnode.properties file

network=TestNet
server.ip=[your server external IP] (without brackets)
server.port=7070
server.url=https://[your domain for which you have SSL cert] (without brackets)
#example: server.url=mainnet-fullnode1.coti.io
application.name=FullNode
logging.file.name=FullNode1
database.folder.name=rocksDB1
resetDatabase=false
global.private.key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fullnode.seed=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
minimumFee=0.01
maximumFee=100
fee.percentage=1
zero.fee.user.hashes=9c37d52ae10e6b42d3bb707ca237dd150165daca32bf8ef67f73d1e79ee609a9f88df0d437a5ba5a6cf7c68d63c077fa2c63a21a91fc192dfd9c1fe4b64bb959
kycserver.public.key=c10052a39b023c8d4a3fc406a74df1742599a387c58bcea2a2093bd85103f3bd22816fa45bbfb26c1f88a112f0c0b007755eb1be1fad3b45f153adbac4752638
kycserver.url=https://cca.coti.io
node.manager.ip=52.59.142.53
node.manager.port=7090
node.manager.propagation.port=10001
allow.transaction.monitoring=true
whitelist.ips=127.0.0.1,0:0:0:0:0:0:0:1

Addendum — nginx server config file

/etc/nginx/sites-enabled/coti_fullnode.conf

server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443;
server_name [your server name here];
#example: server_name mainnet-fullnode1.coti.io;
ssl_certificate /etc/ssl/private/cert.pem;
ssl_certificate_key /etc/ssl/private/privkey1.pem;
ssl_session_timeout 5m;
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
text/css
application/json
application/x-javascript
text/javascript
application/javascript
image/png
image/jpg
image/jpeg
image/svg+xml
image/gif
image/svg;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:7070;
}
}

We opened the early registration for running nodes on the COTI TestNet. Be sure to sign in here. For additional details, you can read the full article on the staking model here.

Should you have any additional questions, feel free to send us an email to support@coti.io, or ping us in our Telegram group.

COTI Resources

Website: https://coti.io

Github: https://github.com/coti-io

Technical whitepaper: https://coti.io/files/COTI-technical-whitepaper.pdf

--

--

COTI
COTI
Editor for

COTI is the fastest and lightest confidentiality layer in Web3