Author Topic: Step-by-step: Masternode on VPS  (Read 1104 times)

vertoe

  • Newbie
  • *
  • Posts: 33
  • Darkcoin Core Dev
    • View Profile
    • Darkco.in
Step-by-step: Masternode on VPS
« on: January 29, 2015, 09:48:38 PM »
VPS: I used Amazon Webservice running Ubuntu 14.10. This will be running the masternode.
Local: I used a Qt wallet to generate the transaction input and masternode secret.

Single masternode on one VPS.

1 VPS: Get dependencies for building spreadcoin daemon:
Code: [Select]
sudo apt-get install git build-essential autoconf libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev libdb-dev libdb++-dev libminiupnpc-dev

2 VPS: Get the source code:
Code: [Select]
git clone https://github.com/spreadcoin-project/spreadcoin
3 VPS: And switch directory:
Code: [Select]
cd spreadcoin/src

4 VPS: Checkout mn-test branch:
Code: [Select]
git checkout mn-test

5 VPS: Compile the daemon:
Code: [Select]
make -j $(nproc) -f makefile.unix

6 VPS: Create a config file:
Code: [Select]
mkdir -p ~/.spreadtestcoin
cat > ~/.spreadtestcoin/spreadcoin.conf <<EOF
rpcuser=spreadcoinrpc
rpcpassword=3btqdvnaaY8Lsv934ZeULWRcgnv4KblablablaB2S5FHB # change this to something usefull
daemon=1
server=1
testnet=1
EOF

7 VPS: ...and "Install" the daemon:
Code: [Select]
sudo cp spreadcoind /usr/bin/spreadcoind

8 VPS: Run the daemon:
Code: [Select]
spreadcoind -daemon -server

9 On your local wallet, get a new address and send at least 100 coins to that address and wait for 50 confirmations.
Code: [Select]
mnQEmuD8yC4UAkc8Fm6A49JfKaqAqTZEk5
10 On your local wallet, copy the transaction id.
Code: [Select]
7f7bbb802daa9723b1e060cfa28b6e1a1b6d5ad68f1136ca8f6aa9450edee6f7
11 Local: Generate a masternode secret from the transaction input by going to the console at tools > debug console. if input:0 fails, try:1, and so on until you get what you want:
Code: [Select]
mnsecret 7f7bbb802daa9723b1e060cfa28b6e1a1b6d5ad68f1136ca8f6aa9450edee6f7:1

12 On the VPS, put it directly into the config file:
Code: [Select]
echo "mnstart=7f7bbb802daa9723b1e060cfa28b6e1a1b6d5ad68f1136ca8f6aa9450edee6f7:1:1c574e216511919b4578586843198d6c006171592001003986fccae864a3db9b78b6e08037f30fcbbfd33aeec23a6d2130e06556ae66a4796c731b778ad790f0d6:925EuDdYmiQvgq1S6em6kQ1WR5wU5qB8t7treVVFBhwxFLrkN27" >> ~/.spreadtestcoin/spreadcoin.conf

... wait for 50 confirmations of the tx ...

13 VPS: ...and start the masternode:
Code: [Select]
spreadcoind mnstart 7f7bbb802daa9723b1e060cfa28b6e1a1b6d5ad68f1136ca8f6aa9450edee6f7:1:1c574e216511919b4578586843198d6c006171592001003986fccae864a3db9b78b6e08037f30fcbbfd33aeec23a6d2130e06556ae66a4796c731b778ad790f0d6:925EuDdYmiQvgq1S6em6kQ1WR5wU5qB8t7treVVFBhwxFLrkN27

If it says "true", you are done!!!einself

Multiple masternodes on one VPS.

Repeat steps 9-13 for each masternode input with >100 SPR and >50 confirmations you have. Happy masternoding.

Worked? SSHUvYeyGQcV6z1QvFiu2SppKDTbb2ZFC1
SSHUvYeyGQcV6z1QvFiu2SppKDTbb2ZFC1

Mr. Spread

  • Core Developer
  • Posts: 105
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #1 on: January 29, 2015, 10:04:44 PM »
I think it is better not to send your coins to the wallet stored on VPS but instead keep them in your local wallet and generate mnsecert from it.

MyFarm

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #2 on: January 29, 2015, 10:46:41 PM »
I think it is better not to send your coins to the wallet stored on VPS but instead keep them in your local wallet and generate mnsecert from it.

Agreed.  Vertoe, could you edit it for this please?  I'll kick in an additional 100 SPR to the bounty.

Also, on this step: make -j $(nproc) -f makefile.unix

I get:
Quote
Building LevelDB ...
make[1]: Entering directory `/home/ubuntu/spreadcoin/src/leveldb'
g++ -I. -I./include -fno-builtin-memcmp -pthread -DOS_LINUX -DLEVELDB_PLATFORM_POSIX -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -std=gnu++0x -Wno-literal-suffix -g -DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64 -I/home/ubuntu/spreadcoin/src -I/home/ubuntu/spreadcoin/src/obj -DUSE_UPNP=0 -DUSE_IPV6=1 -I/home/ubuntu/spreadcoin/src/leveldb/include -I/home/ubuntu/spreadcoin/src/leveldb/helpers -DHAVE_BUILD_INFO -fno-stack-protector -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2  -c db/builder.cc -o db/builder.o
make[1]: g++: Command not found
make[1]: *** [db/builder.o] Error 127
make[1]: Leaving directory `/home/ubuntu/spreadcoin/src/leveldb'
make: *** [leveldb/libleveldb.a] Error 2

I assume something went wrong.  Any ideas?

vertoe

  • Newbie
  • *
  • Posts: 33
  • Darkcoin Core Dev
    • View Profile
    • Darkco.in
Re: Step-by-step: Masternode on VPS
« Reply #3 on: January 29, 2015, 10:58:54 PM »
Code: [Select]
g++: Command not found
are you on ubuntu and did you install the package build-essential (first step)?
SSHUvYeyGQcV6z1QvFiu2SppKDTbb2ZFC1

vertoe

  • Newbie
  • *
  • Posts: 33
  • Darkcoin Core Dev
    • View Profile
    • Darkco.in
Re: Step-by-step: Masternode on VPS
« Reply #4 on: January 29, 2015, 11:10:41 PM »
I think it is better not to send your coins to the wallet stored on VPS but instead keep them in your local wallet and generate mnsecert from it.

Updated.
SSHUvYeyGQcV6z1QvFiu2SppKDTbb2ZFC1

Strumpet!

  • Full Member
  • ***
  • Posts: 158
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #5 on: January 29, 2015, 11:56:00 PM »
Vertoe, instead of guessing the output number you can just copy/paste the output column from the Masternode tab in the QT wallet, and run

mnsecret <pasted-output>

I find it easier to copy all my elegible-to-be-a-MN SPR lump outputs, run mnsecret on them all, and copy/paste the lot into the remote spreadcoin.conf file at the same time, then just restart spreadcoind.

It would be pretty easy for Mr Spread to have a button that automated this for you within the QT client and outputted a bunch of 'mnstart=...' lines for you to copy to the VPS.

Also, I think you should include a basic firewall setup as part of the guide, I use:
Code: [Select]
sudo apt-get install ufw
sudo ufw allow ssh/tcp
sudo ufw limit ssh/tcp
sudo ufw allow 51678/tcp
sudo ufw logging on
sudo ufw enable
sudo ufw status

edit: and an initial update, some VPS images are quite out of date.
Code: [Select]
sudo apt-get update
sudo apt-get upgrade

But this is your show and I'll butt out.  :)

MyFarm

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #6 on: January 30, 2015, 03:41:02 AM »
I got a little further this time.  On the same step, this time I got:

Quote
virtual memory exhausted: Cannot allocate memory
make: *** [obj/main.o] Error 1

After it ran for quite awhile.  Is my little free micro instance not powerful enough?  :)  What is the story here?

girino

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #7 on: January 30, 2015, 03:50:02 AM »
I got a little further this time.  On the same step, this time I got:

Quote
virtual memory exhausted: Cannot allocate memory
make: *** [obj/main.o] Error 1

After it ran for quite awhile.  Is my little free micro instance not powerful enough?  :)  What is the story here?

you can add some virtual memory to it, so it stands the compilation process

http://stackoverflow.com/questions/17173972/how-do-you-add-swap-to-an-ec2-instance

MyFarm

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #8 on: January 30, 2015, 04:00:33 AM »
I got a little further this time.  On the same step, this time I got:

Quote
virtual memory exhausted: Cannot allocate memory
make: *** [obj/main.o] Error 1

After it ran for quite awhile.  Is my little free micro instance not powerful enough?  :)  What is the story here?

you can add some virtual memory to it, so it stands the compilation process

http://stackoverflow.com/questions/17173972/how-do-you-add-swap-to-an-ec2-instance

Thank you.

NOW I get:

Quote
net.cpp:18:32: fatal error: miniupnpc/miniwget.h: No such file or directory
 #include <miniupnpc/miniwget.h>

Heh.  Any ideas?

girino

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #9 on: January 30, 2015, 04:15:31 AM »
(...)
NOW I get:

Quote
net.cpp:18:32: fatal error: miniupnpc/miniwget.h: No such file or directory
 #include <miniupnpc/miniwget.h>

Heh.  Any ideas?

Code: [Select]
sudo apt-get install libminiupnpc-dev

MyFarm

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #10 on: January 30, 2015, 04:57:19 AM »
(...)
NOW I get:

Quote
net.cpp:18:32: fatal error: miniupnpc/miniwget.h: No such file or directory
 #include <miniupnpc/miniwget.h>

Heh.  Any ideas?

Code: [Select]
sudo apt-get install libminiupnpc-dev

Thank you!

Vertoe, I ran into this issue on both my AWS and another VPS I have been trying it on.  Does it need to be added to the instructions?

def15

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #11 on: January 30, 2015, 05:37:34 AM »
(...)
NOW I get:

Quote
net.cpp:18:32: fatal error: miniupnpc/miniwget.h: No such file or directory
 #include <miniupnpc/miniwget.h>

Heh.  Any ideas?

Code: [Select]
sudo apt-get install libminiupnpc-dev

Thank you!

Vertoe, I ran into this issue on both my AWS and another VPS I have been trying it on.  Does it need to be added to the instructions?

100 SPR burning a hole in my wallet. :)

I will send as soon as it passes the MyFarm test.

MyFarm

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Step-by-step: Masternode on VPS
« Reply #12 on: January 30, 2015, 05:55:31 AM »
When I enter
Quote
echo "mnstart=`spreadcoind mnsecret 7f7bbb802daa9723b1e060cfa28b6e1a1b6d5ad68f1136ca8f6aa9450edee6f7:1`" >> ~/.spreadtestcoin/spreadcoin.conf

(with my transaction ID)

I get:

Quote
error: {"code":-5,"message":"Could not get private key, wallet is locked or it is not your transaction"}

Wallet is not locked and this is the transaction ID of the coins I sent to myself.

Anyone have any ideas?


vertoe

  • Newbie
  • *
  • Posts: 33
  • Darkcoin Core Dev
    • View Profile
    • Darkco.in
Re: Step-by-step: Masternode on VPS
« Reply #13 on: January 30, 2015, 06:11:47 AM »
(...)
NOW I get:

Quote
net.cpp:18:32: fatal error: miniupnpc/miniwget.h: No such file or directory
 #include <miniupnpc/miniwget.h>

Heh.  Any ideas?

Code: [Select]
sudo apt-get install libminiupnpc-dev

Updated thanks.
SSHUvYeyGQcV6z1QvFiu2SppKDTbb2ZFC1

vertoe

  • Newbie
  • *
  • Posts: 33
  • Darkcoin Core Dev
    • View Profile
    • Darkco.in
Re: Step-by-step: Masternode on VPS
« Reply #14 on: January 30, 2015, 06:13:00 AM »
When I enter
Quote
echo "mnstart=`spreadcoind mnsecret 7f7bbb802daa9723b1e060cfa28b6e1a1b6d5ad68f1136ca8f6aa9450edee6f7:1`" >> ~/.spreadtestcoin/spreadcoin.conf

(with my transaction ID)

I get:

Quote
error: {"code":-5,"message":"Could not get private key, wallet is locked or it is not your transaction"}

Wallet is not locked and this is the transaction ID of the coins I sent to myself.

Anyone have any ideas?

It looks like a cold/remote setup is not possible yet. It only seems to work if the funds are on the VPS (e.g. private key known), I had the same problem.
SSHUvYeyGQcV6z1QvFiu2SppKDTbb2ZFC1