Blocknet: Masternode Setup

David Michael
CRYPDEX
Published in
5 min readJan 5, 2019

Background

Blocknet is one of the earliest projects to address the need for decentralized atomic swap networks. This now crowded field includes related projects like PolkaDot, Cosmos, SparkSwap, Block Collider, and Interledger (among many others). At Crypdex we use Blocknet extensively for testing as it is a relatively mature chain, its in production today, it has fast confirmation times, and its market cap is low enough now to purchase and run Masternodes.

Blocknet’s consensus model is Proof of Stake (PoS) and as such, there is no mining. Any holder of BLOCK, the network’s native token, can stake to secure the network by validating incoming blocks and earn rewards. While you can stake with any amount of coin, you earn only 30% of the block reward split. The remainder 70% of the split goes to Blocknet Masternodes. So let’s run one of those.

Blocknet calls its Masternodes, “Service Nodes”. Service Nodes run the Blocknet blockchain and are responsible for hosting multiple blockchains and enabling cross-chain Dapps (or so says the website). Since Blocknet is in the Dash lineage, their Service Nodes are very similar to Dash Masternodes. Service Nodes require 5,000 BLOCK as collateral that is locked (essentially) in a single transaction and must remain unspent. They also require that you have a the Service Node running 24/7.

Basic Setup

Blocknet has some documentation on setting up Service Nodes and it is well worth reading through, but it can be a little confusing and ambiguous in places. I understand the team is working on an update to the docs, so stay tuned. Without rehashing the documentation verbatim, let’s hit the high notes of the setup.

There are 2 main pieces to getting a Service Node running.

  1. A Client: A Blocknet wallet, with the collateral locked, that authorizes the Service Node. Once setup is complete, it can be shut down.
  2. A Server: A machine running 24/7.

I suppose it would be possible to do this on a single machine if you controlled the configs properly, but let’s keep this process as simple as we can and use separate machines.

Client Setup

For all intents and purposes, this is the most important part and the most fiddly to get right. In all of the following steps, the commands you see assume you are running in the “debug console” that is available from the Blocknet Wallet GUI.

  • IMPORTANT: If you are staking in your wallet, stop it before proceeding. If you create a collateral transaction and a stake reward happens before you get the Service Node setup, it will spend your collateral and nothing will work as expected.
  • Send exactly 5,000 BLOCK to an address that you control in your wallet. You should make a note of the hash of this transaction as well as the transaction output index as its used in the following steps. This information can also be gotten by running servicenode outputs from the wallet’s debug console.
  • Create a servicenode.conffile and place it in you Blocknet data directory. On macOS, this is ~/Library/Application Support/blocknetdx.
  • In the servicenode.conf file enter a single line in the following format (with information from the Server — see below)
    <servicenode-alias> <servicenode-ip> <servicenode-privatekey> <collateral-txhash> <tx-output-index>

Here are what the variables in the servicenode.conf file mean:

  • servicenode-alias is an alias or name. It can be anything you’d like but you should make it something meaningful.
  • servicenode-ipaddress is the public IP, including port, of the Server. This should be static.
  • servicenode-privatekey is a shared private key that is generated in the console using the command $ servicenode genkey in the debug console of the wallet. It can also be generated by the Server. The point here is that the key is shared by Client and Server.
  • collateral-txhash is the transaction hash that contains the unspent collateral, in this case 5,000 BLOCK
  • tx-output-index is the output index of the UTXO containing your collateral. You will sometimes see this as the “vout”.

All these variables might look daunting, but this process is largely the same as other Masternode setups.

With the servicenode.conf file in place, reboot your wallet so that it sees the Service Node configuration.

Server Setup

The Server in the Service Node setup is mercifully much simpler. The Server is just a plain old Blocknet node with some special params in the blocknetdx.conf file. The only catch here is that this box needs to be on all the time in order to function in the network.

servicenode=1
servicenodeaddr=<server-ip>
servicenodeprivkey=<server-privatekey>

Now boot up your server.

Finalizing

Finally, you need to “activate” the Service Node from the Client wallet. This is also somewhat simple, but not obvious and not available from the GUI at the time of this writing.

  • Unlock your wallet if its locked.
  • “Start” the Service Node

From the debug console in the Client wallet, that would be these commands:

$ walletpassphrase <pass> <timeout>
$ servicenode start-alias <server-alias>

You should now be able to click on the Service Nodes tab in the wallet GUI and see that your Service Node is running and ENABLED. If there is an issue, it will say MISSING.

Masternode Hosting: NodeHost

If you have gotten this far, you can tell that getting a Service Node up and running against your collateral is a little involved. This sequence of events is not particularly unique to Blocknet (though we didn’t cover the process of getting the xbridge or other chains configured).

There is a nascent industry of Masternode hosting services that launch pre-configured VMs for you either on accounts you own or completely managed by the hosting service. Crypdex reviewed a number of these services and decided to work with NodeHost.online. Most of these services are brand new and we feel like NodeHost is moving in the right direction with full service hosting (they take care of everything listed above) as well as server-only Masternodes (meaning you setup the Client portion).

One feature we look forward to is their shared or pooled Masternodes. This functions a lot like a mining pool where you contribute some portion of the Masternode collateral and they take care of all the rest — including the distribution of rewards to accounts.

Our experience with NodeHost was relatively smooth and we were able to work directly with their team to iron out the kinks. We got this setup running in about 3 hours for a server-only Masternode.

Let the earnings begin.

We are using our Masternode in the testing of our platform. Specifically, we have written a flow that takes reward income, splits between the company founders, and continuously converts it to a stablecoin. More on this in another post.

Thanks

Thanks to an anonymous reviewer on the Blocknet team who offered some corrections and clarifications. The changes have been applied to the article. If you see other parts of this that could be clearer, please leave a comment.

--

--