diff --git a/doc/setup-masternodes.md b/doc/setup-masternodes.md index 1be1b91438..be9edf3839 100644 --- a/doc/setup-masternodes.md +++ b/doc/setup-masternodes.md @@ -1,47 +1,163 @@ -Setup masternodes ------------------ -To start minting, user should become a "masternode" by sending special transaction, which locks collateral and burns an announcement fee. After got banned or resigning, announcement fee isn't refunded (only masternode collateral is refunded). +# How to run a Defichain masternode on Linux/Mac OS -#### Masternode roles -There are two distinct roles: 'masternode owner' and 'masternode operator'. The only ability for owner is to resign masternode (and reclaiming collateral after that). Owner holds the collateral. -The primary activity (minting new coins, voting for anchors) is performed by operator. In general, node hoster can play both. +## Introduction -#### For owners who operate their masternodes -In this case, operator's address is equal to owner's (collateral) address. -1. Announce masternode with your collateral address. You should keep control of that address (have a private key) or you'll loose your collateral. THE OPERATION WILL BURN ANNOUNCEMENT FEE! Don't do it if you're not sure that the address is correct. +Setting up a masternode on Defichain allows you to participate in the consensus protocol and receive staking awards. One thing to note is that in order to set up a masternode, you must have a minimum of 1 million DFI tokens. + +> NOTE: This how-to expects some basic familiarity with the Linux terminal + +## Masternode roles +There are two distinct roles: 'masternode owner' and 'masternode operator'. The owner holds the collateral and the primary activity (minting new coins, voting for anchors) is performed by operator. In general, a node can play both roles. + +## For owners who operate their own masternodes +In this scenario, operator's address will be equal to the owner's (collateral) address. + +### Step 1 - Download and extract node software + +The first step is to download the binaries. Here are links to binaries for Linux and Macosx: + +[Linux v1.0.0-rc1](https://github.com/DeFiCh/ain/releases/download/v1.0.0-rc1/defichain-1.0.0-rc1-x86_64-pc-linux-gnu.tar.gz) +[Mac OSX v1.0.0-rc1](https://github.com/DeFiCh/ain/releases/download/v1.0.0-rc1/defichain-1.0.0-rc1-x86_64-apple-darwin11.tar.gz) + +We can download this on Linux using the command: + +``` +wget https://github.com/DeFiCh/ain/releases/download/v1.0.0-rc1/defichain-1.0.0-rc1-x86_64-pc-linux-gnu.tar.gz +``` + +Following that we can extract the tar file by running: +``` +tar -xvzf defichain-1.0.0-rc1-x86_64-pc-linux-gnu.tar.gz +``` + +### Step 2 - Copy binaries to user directory + +We would like the node software to be stored in a consistent and easily accessible directory, so let's create one in our home folder. This can be done by running: + +``` +mkdir ~/.defi +``` + +Now copy the binaries by running: ``` -defi-cli createmasternode \{\"collateralAddress\":\"YOUR_ADDRESS\"\} +cp ./defichain-1.0.0-beta4/bin/* ~/.defi ``` -The transaction will be funded automatically by any accessible coins in your wallet (the same way as 'fundrawtransaction' acts). Or you can specify custom UTXOs for that (run ```defi-cli help createmasternode```). -The result is the transaction hash being created that acts as masternode's ID. When this transaction gets into mempool (and then, in chain), your collateral will be locked until resigning or ban. Don't be afraid if you can't see it in UTXO lists/wallet - it wasn't lost, just hidden. -2. Place your addresses in config file: + +### Step 3 - Setting up crontab to keep our node running in the background + +Now we may directly run our node by running `~/.defi/defid` , but this would not be very convenient, as we would have to keep the terminal session open the whole time, and run this command every time we restart our computer or SSH session. + +Instead, we'll use crontab to keep the process running. Run `crontab -e`, and select an editor (I recommend Nano if you are unsure which to pick), afterwards paste: + ``` -masternode_owner=YOUR_ADDRESS -masternode_operator=YOUR_ADDRESS +* * * * * pidof defid || ~/.defi/defid ``` -3. Restart the node. After tx got into blockchain, you can see the result of masternode's creation by issuing + +into the file and hit `Ctrl-X` then enter to save the file. + +### Step 4 - Setting up owner address with sufficient funds + +In order to run a masternode, you must own atleast 1 million DFI tokens. Let's set up an address with sufficient funds to use as an owner. Masternodes currently only support legacy addresses, so create a masternode address using: + ``` -defi-cli listmasternodes +~/.defi/defi-cli getnewaddress "