Run on one VPS & Premining

+1 vote
This tutorial requires two server nodes.

As per above statement, If I am not wrong I need two VPS servers. Right?

I want to do premine blocks. Is there any way to do it?
asked Jan 4, 2018 by Dhwalin

1 Answer

0 votes

Yes, a couple of DigitalOcean or Linode servers will work fine.  Below are some quick Ubuntu 16.04 instructions;

First, open a couple of tabs and SSH to both of your VPSs using your root account (ssh root@11.22.33.44);

1. ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'     // TAKE NOTE OF LAN/WAN IPs
2. dpkg-reconfigure tzdata     // SET TIME
3. adduser yourName
4. usermod -aG sudo yourName

Open a third tab for localhost and create keys;

5. ssh-keygen    // IF YOU ALREADY HAVE KEYS, SKIP THIS STEP
6. ssh-copy-id root@ip.of.server        // USE YOUR ROOT PASSWORD
7. ssh-copy-id yourName@ip.of.server       // USE YOUR yourName PASSWORD

Return to SSH tabs;

8. sudo nano /etc/ssh/sshd_config
  PermitRootLogin without-password
  PasswordAuthentication no

9. sudo nano /etc/nanorc
    set tempfile
    set autoindent

10. export EDITOR=/usr/bin/nano
11. sudo systemctl reload sshd
12. exit      // LOG OUT ROOT

SSH back onto VPSs using yourName user accounts;

13. download [whatever version of] MultiChain and unzip
14. cp ~/multichaind multichain-cli multichain-util /usr/local/bin
15. multichain-util create yourChain     // ONLY DO THIS ON FIRST SERVER
16. sudo nano ~/.multichain/yourChain/params.dat     // ONLY DO THIS ON FIRST SERVER

    setup-first-blocks=60, initial-block-reward=50, first-block-reward=10000000000

The first item above is how many blocks it will take for the rules to activate, the second item is the per block miner reward, and the third item is the pre-mining.  Of course, set these to whatever values you like.  Also, make sure to set the consensus requirements correctly so that blocks are mined using your first and/or second node.... see https://www.multichain.com/developers/blockchain-parameters/ .  Save and close document.

The following instructions assume you set anyone-can-connect=true as one of the global permissions in the params.dat file.

17. multichain yourChain -daemon     // ONLY DO THIS ON FIRST SERVER
18. multichaind yourChain@xx.xx.xx.xx:1234     // DO THIS ON SECOND SERVER
19. multichain-cli yourChain     // getinfo (https://www.multichain.com/developers/json-rpc-api/)
20. multichain-cli yourChain stop   // TO QUIT

Otherwise, if yourChain was set to private(anyone-can-connect=false), use the instructions on this page to connect your second node; https://www.multichain.com/getting-started/

If/when you mess up, simply stop the service as per #20, and rm -R ~/.multichain and start over again beginning from step #15.

answered Jan 4, 2018 by ericjarvies
Thank you for your reply..

Can you please tell me why block is not increasing in my 3rd PC?

I have sent some balance with sendtoaddress to that pc node but balance did not increase.

Is there any way to pre define wallet id address before starting node? So reward get save in that wallet id?
I assume you are referring to the native coin balance?  If so, on the recipient node use 'getmultibalances' to view both the assets and the native coin balances.  The 'gettotalbalances' command will only display assets.

If you are still unable to see the balance (increase), run 'listwallettransactions' on the recipient node and see if the latest transaction is shown.  If it is not shown, run 'listwallettransactions' on the sending node and inspect the last transaction and see if you got the address wrong.

The mining reward is only able to go to the original node address.
Ok thank you very much
For your block count problem (not increasing), stop the 3rd PC;

multichain-cli [chain] stop

and reconnect it;

multichaind [chain]@[ip-address]:[port]

On all the nodes check the block count again;

multichain-cli [chain] getinfo
ok sure. (y)
...