What's new
  • Thank you for your input for the last few days regarding the list of exchanges you want to see DSTRA in.
    These are our targets for fundraising going forward. Learn more

Running multiple DSTRA masternodes using one IP

twthmoses

Junior Member
Staff member
#1
This is about how to run multiple DSTRA masternodes on a single windows computer using only one IP address.
Basically what ordinary people have at home. Most people don’t have multiple ip addresses at home. They got some sort of router from their IPS, having one single global IP4 address or IP6 address.

Having only one IP address, means you have to run multiple instances of the dstra program, each with one masternode, rather than run multiple masternodes using only one instances of the dstra program.
Not much different than running multiple instances of Word or Paint shop or whatever, but with some crucial difference though. While these other programs will use the same working directory (folder) and data running multiple instances, a blockchain program cannot do that. It will have to have a separate working directory(folder), data and wallet, for each instance. Costs hard drive space. Currently a dstra installation is 235-245 MB, depending on actions in wallet. It will continue to grow as the blockchain grows. A brand new dstra v2 installation, some 16 weeks behind is about 20 MB. So some rough calculating says it grows a little short of 15 MB a week.


There is a wide range of implications starting two or more instances of the dstra program, using different wallets but running on the same chain data e.g. same working directory (folder). This is why dstra will not start a second instance of the program once one is running. You will get the cannot obtain lock on data directory error, trying to start a second instance of the program and it will refuse to start. It’s actually the little (zero byte) file .lock that prohibited this. Once taken control of by one instance of the program, other instances will refuse to start as they cannot grab control. It’s possible to fiddle around this, but now we are getting into experimental wallet fun.

You will have to start a second instance of the program, with separate working directory(folder) and data. When you run dstra-qt.exe it will default use the work directory %AppData%\DSTRA2. If it does not exist, it will be created. When you start dstra-qt.exe with an alternative working directory it will not create it, if it does not exist. You will have to create it yourself before you start the dstra program or it will give you an error at startup and terminate. Error is specified data directory xxxx does not exist.

We will be running two masternodes, both directories’ we specify. So first create two directory in %AppData% (…\AppData\Roaming\) named example DSTRA2-MN01 and DSTRA2-MN02. Two empty directories for now, but they will be filled soon enough.

Now we need to start two instances of dstra-qt.exe into each directory. You can have dstra-qt.exe located where ever you want. I have a folder on the desktop with dstra-qt.exe in. Where you have dstra-qt.exe located, now create two text files, named DSTRA2-MN01 and DSTRA2-MN02 and rename the file extension on both to .BAT, rather then the .TXT it is. Like DSTRA2-MN01.BAT. They are now executable batch (bat) files. So don’t double click on them just yet, as they will be executed. When done editing them, you start your two dstra instances via those two file. For editing, right click on them and select edit. If you don’t see the file extension you need to enable view of file extensions (windows default hides this)

In each of these texts (bat) files write…

Text file DSTRA2-MN01 write : dstra-qt.exe -datadir=%AppData%\DSTRA2-MN01

Text file DSTRA2-MN02 write : dstra-qt.exe -datadir=%AppData%\DSTRA2-MN02

If you run those bat files now, and have no other instance of dstra running, one will start and the other will give you an error. If you already have an instance of dstra running, both will give you an error. This is because the very first instance of dstra running takes control of the default port, namely port 5269. In order to overcome this you will have to start each instance with its own port. You can use any port you like. I just use 5270, 5271 etc.. So make the line you have written in each bat file like this…

Text file DSTRA2-MN01 write : dstra-qt.exe -datadir=%AppData%\DSTRA2-MN01 -port=5269

Text file DSTRA2-MN02 write : dstra-qt.exe -datadir=%AppData%\DSTRA2-MN02 -port=5270

And volla you now have two running instances of dstra. Now you setup your masternodes like normal, one in each instance, using the same IP and port in both cases. But a little more… You still use port 5269 in masternode.conf as normal, on both instances. Not the port you start dstra up with, cause masternodes only works on port 5269. The reason this little port confusing works is that the port you start dstra up with is the listening port (inbound port) and every port works here. The outbound port has to be 5269 and once in masternode mode, dstra works this bit on its own.

Another thing, now that you are in the process of fiddling with command lines to dstra-qt.exe, you might as well apply a little security. There is something out there called wallet crawlers. That’s unwanted software on your PC that, without your knowledge, sweeps your computer for Wallet.dat files and steals copies of them. Should not get in there in the first place, but it happen. Call your wallet something else. You can name it anything you want, really! anything you want. Like this…

Text file DSTRA2-MN01 write : dstra-qt.exe -datadir=%AppData%\DSTRA2-MN01 -port=5269 -wallet=DSTRA2-MN01.DAT

Text file DSTRA2-MN02 write : dstra-qt.exe -datadir=%AppData%\DSTRA2-MN02 -port=5270 -wallet=DONTSTEALMYCOINS

As probably noted, you will have two command windows (black windows) hanging from running the bat files. You can just close them manual if you want or you can make it automatically. The reason they are there is that it is a batch (bat) command file. The command in line one you write, starts dstra, then the dstra program has control. When you exit dstra again, it will return control to the command windows and it will terminate. In order to terminate the bat file, you have to pass the start command and continue in order to exit. Use the "start" command, like this.

Text file DSTRA2-MN01 write : start "" dstra-qt.exe -datadir=%AppData%\DSTRA2-MN01 -port=5269 -wallet=DSTRA2-MN01.DAT

Text file DSTRA2-MN02 write : start "" dstra-qt.exe -datadir=%AppData%\DSTRA2-MN02 -port=5270 -wallet=DONTSTEALMYCOINS

2019-01-09.png

Enjoy..
 
Last edited:

chunnorris

Junior Member
#5
im talking by experience and mostly coins have a security for avoid same ip for differents MN
and after few days you get POSE_BAN STATUS
 

twthmoses

Junior Member
Staff member
#6
im talking by experience and mostly coins have a security for avoid same ip for differents MN
and after few days you get POSE_BAN STATUS
That’s not my experience, in fact this trick has worked and works on all coins I have ever MN’ed. New or old style wallet. In some coins wallet there is an extra tab where you can see all MN’s and their ip (also in some explorer), not in Dstra though. If they are sortable, not all are, try sort by ip. You will see others do it to. Whether they use this method or something else I don’t know. This method I worked out myself, by trial and error. And it does work, every time.

There would be no reason to ban your MN from the network, because of running on the same ip. You have to fully separate masternode, with different keys, outputs and wallet; they just function on the same “road”. Technical it’s no different than two different coins wallet you run on the same ip (and hardware).
 

chunnorris

Junior Member
#7
exactly, for the coins who give this status, i checked on MN list and there arent same ip for several MN
i have one coin where i tried on each of my 6 vps and only succeded on 1 vps, with same method
peonuser who are 1000 times better than me with linux tricks tried too, and always get pose_ban
it doesnt work for all coin
 

chipr

DSTRA Moderator
Staff member
#8
Thanks for that insight @twthmoses!

Upon reading through this it seems a good idea to rename all wallets to something other than wallet.dat. I'd only been doing that with my backups.
 

twthmoses

Junior Member
Staff member
#9
exactly, for the coins who give this status, i checked on MN list and there arent same ip for several MN
i have one coin where i tried on each of my 6 vps and only succeded on 1 vps, with same method
peonuser who are 1000 times better than me with linux tricks tried too, and always get pose_ban
it doesnt work for all coin
Being unfamiliarly with vps, never used them, how do you make separate installations on your vps? So each use a fully separate data directory and blockchain?

I’m a home guy :) like to have my coins in my own wallet to control myself. An i3-i5-i7 pc will easy run 30+ wallets at the same time.
 
#10
my coin are always in my wallet, on the vps there are only the tx of collateral, even if someone succeed to access to my vps, the worst he can do is erase all my data for pissed me off
its same on vps linux, a db for each MN, a diferent rpcport and need to bind ip
you did this:
dstra-qt.exe -datadir=%AppData%\DSTRA2-MN01 -port=5269 -wallet=DSTRA2-MN01.DAT
dstra-qt.exe -datadir=%AppData%\DSTRA2-MN02 -port=5270 -wallet=DONTSTEALMYCOINS


on linux vps it would be:
dstrad --datadir=/root/.dstracore
dstrad --datadir=/root/.dstracore2

dstra-cli --datadir=/root/.dstracore getinfo
dstra-cli --datadir=/root/.dstracore masternode status
dstra-cli --datadir=/root/.dstracore2 getinfo
etc....
 

twthmoses

Junior Member
Staff member
#12
Hmm okay so maybe better not try and waist the effort with that risk
Well what you do, is of course up to you.

There is no reason you should get banned running two or more MN’s on the same ip. That’s like the mailman refusing to deliver mail to you because you share a street address? Never seen any banning before! I have done this method in nearly a year now

If you had two ip’s at your house, you would most likely run those two MN’s on the same hardware in the same wallet – how is that better? You would probably have only one cable into the house, it all runs on the same power, and hardware and wallet. You cut either of these, all goes down, two ip’s or not!