Author Topic: Instant Play Config using openvpn/VPS/unity - DIY for Android (and others)  (Read 35025 times)


  • Developer
  • Hero Member
  • *****
  • Posts: 990
    • View Profile
The Purpose of this guide is so you have the ability to instant play huntercoin using the unity client anywhere (e.g. using the Android Unity Client over 3g/4g without storing the chain locally).

Basic Steps:
Setup a 10$/Month SSD VPS on Digital Ocean
build huntercoin, configure, upload chain
Install/Configure OpenVPN Server
configure openvpn on android/desktop
configure unity client

Obviously not ideal for what we want for hunercoin - BUT, it works and it's fast :) (Temp Solution for those who don't mind getting their hands dirty).

The guide is mostly aimed at windows users.
I've tried to make it as simple/step by step as i could.
It is VERY VERY easy even if this post looks long... actual time spent doing it is probably about 10mins if you discount download/upload/compile times.

These steps setup an instant play server so you can play anywhere anytime pretty much instantly with rocksolid stability. 10$/month. from your Android or Desktop PC.
I've had my Huntercoin Daemon running for several weeks without issue on Ubuntu - currently the windows daemon and qt can stop syncing for unknown reason (hopefully resolved in huntercore)

This is simple to setup but obviously not ideal for the masses. Still, works great from my experience.

Note : I'm not the best at linux/security so there could be lots of security holes - so take this as a work in progress and hopefully those with more knowledge can fine tune it..
SO - DO NOT USE SIGNIFICANT COINS ON THIS SERVER unless someone says it's safe..

You will need (on windows):


Setup VPS

1. Create an account on
2. Click Create Droplet (choose enable Private IP option)
3. Choose Ubuntu 14.04.4, the $10/month Size (30gb SSD, 1gb ram) and your nearest datacentre (if you want).
4. put a name for the host and click create.

Ok you now have your ubuntu VPS ready to go.
You will be emailed your root password for your VPS and it's IP address will be on the digital ocean site (and maybe in the email as well).

We now need to add a swap file to the VPS as it doesn't seem to come with one... 1gb of Ram isn't enough. We'll also update the server.

Get to the Terminal of the VPS from windows:

1. Run Putty
2. In the hostname put in the IP address of your VPS (droplet) that you created.
3. In the box which says "saved sessions" enter something like huntercoinVPS and click save
4. Press Open.
5. Accepted the security certificate (press yes or allow)
6. You should now have a login box
7. login with root as the username and for the password enter the password you got in the email from digital ocean.
8. It will ask you to change the password - use a super secure password and confirm it.
9. You should now be logged in to the session as root
10. Update the VPS - Enter the following and wait for each one to finish..
Code: [Select]
apt-get update
apt-get upgrade

Create/Configure Swap File (this seems the quickest way) - I've gone for 4gb of Swap which may be overkill on this 1gb system, although it has an SSD (that isn't mine) so i think ok..

1. in the putty session type these commands in order followed by enter :

Code: [Select]
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

2. The swap file should now be working - type
Code: [Select]
free -mit should show swap and something like this

Code: [Select]
             total       used       free     shared    buffers     cached
Mem:           994        924         69          0          0        447
-/+ buffers/cache:        476        517
Swap:         4095        414       3681

3. We now need to make it keep the swap file after a reboot..
In the session type:
Code: [Select]
vi /etc/fstab

This will bring up a text editor:
Press the letter i once on the keyboard to allow you to insert/edit the file.
use the down arrow to get to the bottom line and you may need to press the "END" to get to the last character of that line... press enter to make a new line...
then copy this :
Code: [Select]
/swapfile   none    swap    sw    0   0and paste it onto the new line in putty by pressing the right mouse button once.

should like like this:

Code: [Select]
# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/vda1 during installation
UUID=050e1e34-39e6-4072-a03e-ae0bf90ba13a /               ext4    errors=remount-ro 0       1
/swapfile   none    swap    sw    0   0

"/etc/fstab" 11L, 499C                                        11,0-1        All

now to save:
Press : aka colon,
this will allow you to type on the bottom row (issue commands).
Then type wq and enter

so it looks like
Code: [Select]
this will save your config file so your swap file will survive a reboot.

Great VPS + Swap File.


Start Copying the Chain to the VPS and create huntercoin.conf - Best do this now before all the other stuff because it takes so long..

1. In Putty terminal type this in order to create your huntercoin datadir

Code: [Select]
cd ~/
mkdir .huntercoin
cd .huntercoin
vi huntercoin.conf

you should now be in the text editor again..
Press i so you can start typing

use super secure username and passwords here and write this (or copy and paste but changing the user/password)

Code: [Select]

ok, now press : and enter wq and press enter..
Code: [Select]
:wqFile should now be saved..

2. Run WinSCP

1. make sure "new Site" is selected at the top.
2. on the right enter the IP of your VPS in the hostname box. enter your username (root) and password for the VPS. Save it and enter a name like huntercoin-openvpn
3. Click Login, accept any security certificates etc..
4. on the right panel you should see the files in the current directory on the VPS.. click the ".." to get to the root of the directories. Then double click the folder called root.

5. In the root folder you should see .huntercoin in a grey colour.. if you can't see it you may need to set winscp to view hidden files/folder (to do this, click options, preferences, panel, and tick show hidden files).
6. double click the .huntecoin folder to go inside...
7. Copy the Chain into here using drag and drop.. see below:

There is 3 main ways to do this (choose any):

1. using putty you can use wget to download from and then unzip the folder into the .huntercoin. I've not used this method here because, i'm not sure there will be enough space for the large zip and then the uncompressed files - (maybe there is). It's also a bit behind the current block.
2. download from on your windows PC, unzip them, then drag and drop into the .huntercoin folder in WinSCP.
3. If you already have the chain (or most of it) then you can use this and drag and drop into .huntercoin through WinSCP:
The files are normally in C:/users/<username>/AppData/Roaming/Huntercoin/
you need basically all .dat files except your wallet at this stage.
MAKE SURE YOU ARE NOT RUNNING THE QT/DAEMON on the PC when you are copying..

This may take hours.. don't touch and just leave it..

Compile Huntercoin

1. In putty, make sure you are connected to the vps and at the command line logged in as root. then copy and paste this (copy here, right click in the putty window to paste)

Code: [Select]
sudo apt-get install libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-program-options-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev libboost-dev libdb5.1++-dev git qt4-qmake libqt4-dev build-essential qt4-linguist-tools libssl-dev libglib2.0-dev
This installs the dependencies required to compile.

now lets compile huntercoin - enter these in order:

Code: [Select]
cd ~/
git clone
cd huntercoin/src

The last one may take some time..
if there are no error messages, your huntercoind executable should be ready to run.. but don't do anything yet.

At this stage your chain should still be copying over to the datadir..


Install/Configure OpenVPN

1. In putty terminal, connected to the VPS, logged in as root, at the command line, type:

Code: [Select]
cd ~/

this downloads the latest openvpn for our VPS

2. install by typing:

Code: [Select]
dpkg -i openvpn-as-2.0.24-Ubuntu14.amd_64.deb
3. now change the password for openvpn admin (use super secure password)

Code: [Select]
passwd openvpn
4. we now need to re-initialize the openvpn as the web interface doesn't seem to work without it
Code: [Select]
basically is default to most options except when it lets you select interfaces, make sure you choose "all interfaces", it was option 1 for me.
when it asks if you want to give access to internal subnets choose YES,
It may ask if you want to route all traffic through the VPN, and same for DNS, i chose NO. If you are going to use this VPN for accessing netflix or whatever from another country you may want to choose yes.

5. check if you can access the openvpn admin interface...


login with username openvpn and password whatever you changed it to previously.

ok awesome -- nearly there...

in the admin panel go to:

VPN Settings
at the top where it shows "Dynamic IP Address Network", in Network Address enter : and 24 for Number of Bits

Remove anything in "Group Default IP Address Network"
so should look like this:

Now go to "Server Network Settings"
Where it says "Interface and IP address", it should show 2 addresses, .. take note of the one that begins with 10. and write it down.
I'm not to sure how companies that host VPS work, but it seems this is the internal IP of your server and it hopefully doesn't change..

If you go back to VPN Settings, scroll down to Routing, and in the box to specify private subnets, see if something is written in there.. hopefully it should have the subnet of the IP address you wrote down. if not, could be you didn't select YES to allow access to subnets during the init of openvpn. but don't worry for now - carry on with the guide and if it doesn't work go back to initializing openvpn.


At this point the VPN should all be ready...
so lets try to connect to it -


1. Install the official Open VPN Client for Android -

2. Once installed, run it, click the options button in the top right, and choose import, then "Import Access Server Profile"

3. Enter the VPS Public IP Address (not the 10. one you wrote earlier), enter username openvpn and password you changed previously. tick the "import autologin profile". Press ok or import or whatever option it gives.

4. Click Connect (save password if not already ticked).

It should connect up right away. press on the "tap for more details", and check you have a 192.168.20.X ip address.
If it doesn't connect, something has gone wrong....

Congratz your Android OpenVPN is now all setup and working.


to set it up on windows, you can go to https://IP-OF-VPS/
login (select connect), and then download the software with config from your server. follow on screen instructions and you should be able to connect from your windows PC.
Will expand on this later (not doign now because i already have openvpn stuff setup and i don't want it to screw anything up).


Install Huntercoin Unity Client on Android

1. Make sure you are able to install apps from unknown sources. This is somewhere in your settings of your Android device, depending on version. (e.g. google search )

2. Download the Unity for Android apk file (can do it from your android device, or from your pc and copy it on over us),1552.0.html

3. Run the file (to install it).

You should now have the Huntercoin Icon in your Apps. Don't run it yet.


OK - After all that, everything should be ready once your chain has finished copying to the VPS.
So check your WinSCP and make sure the chain is all copied to the .huntercoin folder..


Lets check everything is working -
Make sure all the chain has been uploaded first..

1. in putty terminal, connected to the VPS, logged in as root type

Code: [Select]
cd ~/huntercoin/src
./huntercoind -printtoconsole=1

This should start up the daemon and output the debug.log to the screen line by line. I use this a lot to see what's happening real time..
If all goes well, after a minute, it will start downloading the blocks from where you chain was up to.. it will start spamming on the screen with the latest blocks as it catches up..
Wait for it to get to the latest block..

2. leaving this on your screen, go to your android device, connect to the openVPN and run the Huntercoin unity client.
3. n the unity client, go to the Overview Tab, Server Settings.
4. Enter your server IP in the format - Note, This IP address is the IP your Wrote down earlier from within the openvpn admin section.. it may start with 10.
Code: [Select]
http://10.X.X.Xenter port
Code: [Select]
8399enter the username and password you configured in the huntercoin.conf earlier (rpcuser and rpcpassword).

Press ok.

wait a minute.. if all goes well it should connect and show everything on the map and ready to play...

- but wait.. now that we know it's working we need to run the huntercoin daemon another way so that it persists after closing down the putty session.
exit huntercoin on your android device.

go back to the putty window with the spamming text which is runing the daemon and press control + C
you should see it start to "exit" and shutdown the daemon.. when it's finished shutting down you should be able to press enter and ee the command prompt (it may show a load of boost error messages before it which can be ignored).

now, in the putty session type :

Code: [Select]
nohup ./huntercoind &
You can now click the X and close the putty session.


That should be it.

You should now be able to connect to this openvpn from anywhere and instantly play Huntercoin with the unity client on your android device (or/and windows/Linux/mac unity clients) - with rocksolid stability.

to get coins you can generate an address in the unity client and then send them from any wallet or exchange.

In the unlikely event digital ocean restarts your server, you may need to run the huntercoin daemon again - hasn't happened to me..

to do so, login to the server with putty and type:

Code: [Select]
cd ~/huntercoind/src
nohup ./huntercoind &

If you want to backup your wallet (which you should) without stopping the server you can login with putty and type:

Code: [Select]
cd ~/huntercoind/src
./huntercoind backupwallet ~/backupwallet.dat

This will put a backup of your wallet in the root home,
you can copy it off here using WinSCP..

You can skip putty entirely and use the console/vnc screen within digitalocean website.


Does it need some firewall config (block everything except openvpn port?)
is some stuff better not done as root?
opening up rpc to the internet isn't a good idea, but could you have dyndns setup on your mobile and allow the resolved dydns domain name IP through the firewall only? (if possible). Maybe that would be a simpler setup, or would it be less secure?
« Last Edit: April 01, 2016, 10:39:59 AM by Snailbrain »


  • Developer
  • Sr. Member
  • *****
  • Posts: 285
    • View Profile
Looks good, although I have not checked the VPN configuration steps (I've never worked with OpenVPN myself), so I can't vouch for the security of these.  Three random notes:

1) You can use "nano" instead of "vim" to edit the text files.  While I personally love vim, nano is more similar to ordinary editors and may be easier to use if you do not yet know vim.

2) If you are feeling fancy, consider replacing your SSH root password by SSH pubkey authentication to improve security.

3) In theory, it should not even be necessary to choose a supersecret huntercoin.conf password - the RPC only listens locally, so that no external attacker can access the daemon unless they break your VPN.  It can not hurt, though, and is good advice in general.  You can even set up RPC over TLS, at least if that's supported by the client.
Use your Namecoin-ID as OpenID:
Donations: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | HBkxA5QmYSATFoPN1wFk8eBkgwPpY97Mfu


  • Developer
  • Hero Member
  • *****
  • Posts: 990
    • View Profile
thanks Domob


  • Newbie
  • *
  • Posts: 20
    • View Profile
How to set it up with All in One - Huntercore v0.13 + Unity3d + Pruned Chain?  How to set up with a abbreviated block chain ? By the instruction starts to load all blocks anew or I do something not so ..