How to start an Oxycoin delegate pool – zero to hero

in #oxycoin7 years ago

I recently became a forging delegate on Oxycoin with my 50% sharing pool, 500bitcoins. For those of you with as much prior experience as me on running a DPOS delegate pool, I thought I would write a guide to take you step-by-step through the entire process.

I will write another guide in the future to take you through what DPOS coins are, how they work and what it means to be a delegate but as a lot of people are requesting help setting up an automated pool, I thought I would start with this one.

If you find the guide useful, you can support my work in a number of ways:

Vote for 500bitcoins as an Oxycoin delegate.
I have included my affiliate links for the best VPS’ to set up a node on; if you don’t have a VPS yet you can sue one of these links.
You can send a donation to one of my addresses: $OXY - 11835547195018540857X, $BTC – 13iC9jLRwmgMLscpi13PCSd9C3qu6mpGWr
There will be a number of steps to this guide so feel free to skip ahead if you’ve already completed any of them:

Setting up a VPS
Setting up Oxy Wallets as delegates
Setting up Oxy-Node
Setting up Oxy-Checker
Setting up Oxy-Pool
Setting up your pool site
Step 1 – Setting up a VPS

In order to run all of the scripts listed above, you will need a virtual private server (VPS). The minimum system spec for running an OXY node is 1 CPU core with 2GB of ram, which is unfortunately beyond the specifications on the AWS free tier. The VPS should be running Ubuntu, at least 16.04. As such, here are some options for you (with prices at the time of writing) for setting up a VPS:

Digital Ocean - $20/month ($10 discount using my link) - https://m.do.co/c/2e6bde76c026
Interserver - $12/month ($0.01 for first month with my discount code, 500bitcoins) - https://www.interserver.net/vps/?id=436032
Vultr - $10/month - https://www.vultr.com/?ref=7235006
Again, the above are affiliate links, so if you use them, you’ll be supporting 500bitcoins but feel free not to if you don’t like my guide.

Once you have chosen your provider, you will need to set up a single Ubuntu instance (this is the equivalent of creating a computer). In order to access this instance in the next steps, you will need to know:

The public IP address of your instance;
The admin username for your instance (probably root); and
The admin password for your instance.
Now you will need a way to connect to your VPS. For Mac users, we are lucky as we can do this directly from terminal. If you’re on windows, then go buy a Mac, what are you doing with your life?? Or download Putty, I heard that’s good: http://www.putty.org/. But seriously, Windows has been shit since like post-XP… And if you’re on Linux, why do you need this guide?!

Step 2 – Setting up Oxy Wallets as Delegates

I assume that you already have a wallet at wallet.oxycoin.io and that you have some Oxy in your wallet. However, for this process (in order to secure the bulk of your coins, we will suggest a two wallet process as follows:

One wallet, with the bulk of your coins in it, from which you will vote for other delegates and to where you will move coins you earn in the pool, after paying out to voters.
One wallet, with enough coins in it to register as a delegate (5), from which you will forge and distribute your forge rewards to voters.
First of all, you should register both of these wallets as delegates. You should use the following format for naming them:

delegatename_voting – the wallet from which you will vote
delegatename (or delegatename_pool) – the wallet from which you forge and distribute
That way, people will be able to link your vote to your pool delegate if you will be vote swapping. To register as a delegate, click on the delegate tab within the wallet. The process will cost you 5 Oxy on each account.

As a final step, on your forging wallet, you should enable your second secret (which will be required for transfers). To do this, click the menu button in the top right of the web wallet, next to send, and select to enable your second secret. Make sure to note it down as otherwise you will not be able to send any coins.

Step 3 – Setting up Oxy Node

Ok, so, now things get technical. If you didn’t crash and burn setting up your instance, then it’s time to log in using the details you got above. So, to connect from Terminal, you will need to type the following command:

ssh USERNAME@IPADDRESS

It will then prompt you for your password. Type it in or copy and paste. You won’t see it but it is there. Just hit enter when you’re done and all going well it will connect you to your VPS. If you’re using putty, I’m afraid you’re on your own for that one step but maybe it’s the same – if a Windows user can confirm in the comments that would be appreciated and I will update the guide.

Now we need to setup our server so that it is ready to install Oxy node. For this, type the following commands:

apt-get install nano

apt-get install git

apt-get install ufw

apt-get update

apt-get upgrade

apt-get dist-upgrade

ufw allow 10000/tcp

ufw allow 10001/tcp

ufw allow 22/tcp

ufw enable

Next we need to make a user where everything else will be installed:

adduser YOURUSERNAME

adduser YOURUSERNAME sudo

sudo visudo

add this line at the end under "#includedir /etc/sudoers.d":

USERNAME ALL=(ALL) NOPASSWD:ALL

Then, press ctrl+x to exit the document, type Y and hit enter to confirm the changes.

Once done, you can exit the server with the command “exit”

Next, you’ll need to log in again with the username you created above:

ssh USERNAME@IPADDRESS

This time, use the password you created above.

Now, we need to generate the locale for en_US.UTF-8 by typing the following:

sudo locale-gen "en_US.UTF-8"

To proceed with installing the mainnet:

cd $HOME

git clone https://github.com/Oxycoin/oxy-node.git

cd oxy-node

./oxy_manager.bash install

Oxy Node is now installed, but we still need to add your details to the config file as follows:

nano config.json

Scroll down until you see “forging” and enter the secret (the 12 words you use to login to your Oxy wallet) from the wallet that you have registered as a delegate and from which you will forge. Only enter the first secret.

You can then start OXY as follows:

./oxy_manager.bash start

./oxy_manager.bash rebuild

And can check the status at any time with this line:

./oxy_manager.bash status

Congratulations! You have now setup your very own Oxy-Node. Now let’s put some monitoring in place with Oxy Checker.

Step 4 – Setting up Oxy Checker

Now we need to set up a way so that you will be alerted if there is anything wrong with your node. For this, we need to install Oxy Checker.

In order for Oxy Checker to work, we will first need to install a snapshot of Oxy. For this, we will need the following commands:

cd $HOME

git clone https://github.com/Oxycoin/oxy-snapshot

cd oxy-snapshot/

bash oxy-snapshot.sh help

Now we need to create a snapshot:

bash oxy-snapshot.sh create

Once you’ve created a snapshot, we can proceed to install Oxy Checker:

cd $HOME

sudo apt install php php-cli php-mbstring php-sqlite3

git clone https://github.com/Oxycoin/oxy-checker.git

Now we need to schedule oxy-checker to run. This is done by editing crontab:

nano crontab -e

Scroll down to the end of the document and paste in the below line:

          • php ~/oxy-checker/checkdelegate.php >> ~/oxy-checker/logs/checkdelegate.log 2>&1

Now close out of the document with ctrl+x, saving with Y+enter.

In order to receive mobile notifications about the status of our node, we now need to set up a telegram bot to receive notifications from Oxy Checker. I will assume that you have installed Telegram Messenger on your mobile device (for that time you lost $200 in a PnD scam) but if not, download and install it. And try to avoid joining any PnD groups.

Start a new conversation with userinfobot. This will display your user ID. We need to add this to the config file for Oxy-Checker as follows:

cd oxy-checker

nano config.php

Scroll down until you see telegram settings and insert your ID number next to $telegramId as follows:

$telegramId = "12345678";

Start a new conversation on telegram with botfather. Type the following:

/newbot

Enter a name and username for your bot. Botfather will say "Congratulations!" and give you a token number. You need to put this in the variable $telegramApiKey as follows:

$telegramApiKey = "1122334455:AAEhBOweik6ad9r_QXMENQjcrGbqCr4K-bs";

Edit the telegram toggle to “true”

Now close out of the document with ctrl+x, saving with Y+enter.

Start a conversation with your bot’s username on Telegram to enable communication with it.

Well done! Another step down. Now to get your pool setup and working.

Step 5 – Setting Up Oxy-Pool

Now for the trickier steps. This might take some time. First, you need to navigate to Github and create an account. We are then going to “fork” the Oxy-Pool repository that I used in order to create your own Oxy-Pool and add all of the requisite details.

Navigate to this link: https://github.com/500bitcoins/oxy-pool and click on “fork” in the top right. We then need to edit the various documents so that they will work for your pool.

First up, click on config.json and then in the edit button. Here you need to add:

pubkey: your public key for the wallet from which you will forge, found by going to the wallet, clicking on the menu button in the top right, and then navigating to your profile. The public key is the one underneath the wallet address.

percentage: the percentage of forging rewards you’re going to share with voters.

minpayout: the minimum amount that must be accrued by a voter before a payout is sent.

This should be all for now. You will later be adding your secrets but once the files are deployed to your VPS.

Next up, open poollogs.json and add the unixtimestamp of the time when you started your pool (or last payout, if you were previously doing manual payouts) You can find the unixtimstamp using this converter: https://www.unixtimestamp.com/.

Now we need to make a couple of changes in the docs folder.

First, in app.js, on line 20, you need to replace the username with your delegate name from which you will be forging.

Secondly, in index.html, you need to change the title of the pool to whatever you want it to be called. In line 12, you should also add your pool title and the wallet address form which you will be forging. In line 13, add details about your pool sharing.

That’s it! Time to deploy the pool to your server and make some final tweaks. Assuming that you are still logged in as your non-root user, you can follow the following commands:

cd $HOME

git clone -b master https://github.com/GITHUBUSERNAME/oxy-pool.git

sudo apt install python3-pip

pip3 install requests

cd oxy-pool

nano config.json

Now we need to add your first and second secrets for the forging wallet.

When done, Ctrl + x, Y + enter

nano autopay.sh

add the following to the new file:

python3 liskpool.py -y

bash payments.sh

cp poollogs.json docs/poollogs.json

When done, Ctrl + x, Y + enter

sudo chmod +x autopay.sh

cd $HOME

exit

Now, login in using your root user. Then:

nano crontab -e

Crate a new line at the bottom of the file as follows:

For Daily Payouts

30 11 * * * cd /home/USER/oxy-pool/ && bash ./autopay.sh

(so this would payout every day at 11:30 am server time)

For Weekly Payouts

30 11 * * 3 cd /home/YOURUSERNAME/POOLDIRECTORY/ && bash ./autopay.sh

(so this would payout every Wednesday at 11:30am server time. You can change the day (number 3) to any day of the week you like; 1-7.

Ctrl + x, Y + enter.

Now you have setup your very own Oxy Pool that will payout automatically to your voters with no further input. All you will need to do is sweep your excess Oxy (your rewards for running the pool) into your non-forging wallet every now and again, for security reasons and to increase your voting weight in that wallet.

The last step is to get your site up and running using nginx.

Step 6 – Setting Up Your Site

For these purposes, you will need a domain name. If you don’t have one yet, I usually use NameSilo. This is my referral link: https://www.namesilo.com/?rid=5181679ys. And if you enter the code 500bitcoins at checkout you will get $1 off your domain name!

Ok, now we need to head back over to your server to set up the website. First of all, make sure to log back in with your non-root username if you logged out already. Then, we need to install nginx:

sudo apt-get update

sudo apt-get install nginx

sudo ufw app list

sudo ufw allow 'Nginx HTTP'

systemctl status nginx

You should see that nginx is active and running. Good start! Now we need to setup the site.

sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/YOURDOMAIN.COM

sudo nano /etc/nginx/sites-available/YOURDOMAIN.com

Change root /var/www/html; to root /home/USERNAME/oxy-pool/docs; Add your domain to the line server_name as follows server_name YOURDOMAIN.COM;

Ctrl + x, Y + enter.

The logout by navigating to home (cd $HOME) and exiting (exit).

Now for the last step, you need to go to your domain providers control panel to edit your DNS records. Simply create a new A record which points to your VPS’ IP Address. Then, you’re done! Wait for your DNS records to update and you should be able to see your delegate site in by typing in your domain name.

Congratulations on setting up your Oxycoin sharing pool. Now you need to get out there and promote your pool to get some votes and start forging!

Sort:  

Nice, very helpfull. In the last paragraph, don't forget to copy de YOURDOMAIN.com to the sites-enabled dir.
sudo cp /etc/nginx/sites-available/YOURDOMAIN.COM /etc/nginx/sites-enabled/YOURDOMAIN.COM