Qtum Staking Tutorial using qtum-qt

in #qtum7 years ago

Overview

This tutorial will describe how to stake your QTUM coins using qtum-qt (i.e. the QT-based Qtum wallet/node GUI). While I generally do not recommending using qtum-qt for staking, it is a good starting point. I'll discuss why I do not recommend using qtum-qt for staking at the end of this tutorial.

The instructions in this tutorial are for the Skynet test network. However, the instructions should remain the same for the mainnet (i.e. Qtum Ignition) which is expected to be launched in September or October 2017.

For each block generated on the Qtum blockchain (one block every 2 to 3 minutes), a 4 QTUM staking reward will be given to a Qtum network wallet/node that is staking coins. There is no minimum amount of QTUM coins that you need to stake, but the likelihood of receiving the staking reward depends on how many QTUM coins your wallet/node is staking (relative to the other wallets/nodes on the Qtum network).

NOTE: I will use QTUM coin and QTUM token interchangeably. I'll also use QTUM (all caps) to refer to the coin/token, and Qtum to refer to the blockchain/organization.

Assumptions

I will be making the following assumptions in this tutorial:

  1. You are using either macOS/OSX or Linux (e.g. x86_64/amd64 Ubuntu 16.04).* Most of my screenshots will be from macOS.
  2. You have at least 2GB of disk space available (the Qtum Skynet blockchain data is currently at around 265MB as of August 22nd, 2017).**
  3. You are familiar with using the Unix shell (e.g. bash), Unix commands, and tools (e.g. tar).

*If requested, I can add instructions specific to Windows users (I have Windows 10 available on VirtualBox).

**In a separate tutorial, I'll describe a way to restrict the amount of disk space needed.

I'll also assume that you want to install qtum-qt in a directory called "qtum" under your home directory. I'll be using the environment variable "$QTUM_DIR" to refer to this directory. You can either manually substitute the "$QTUM_DIR" references below, or actually use an environment variable, e.g.:

$ export QTUM_DIR=~/qtum

The line above would be run at your Unix (bash) shell prompt to set the QTUM_DIR environment variable.

If you run:

$ echo $QTUM_DIR

You should see the following:

/<your_home_directory>/qtum

Obviously, /<your_home_directory>/ above will actually display your own home directory (e.g. /home/cryptominder/).

Lastly, let's make sure that this directory exists:

$ mkdir -p $QTUM_DIR

The command above should return without any errors.

Downloading qtum-qt

The qtum-qt binary is available at https://github.com/qtumproject/qtum/releases/tag/testnet-skynet-v1.1 .

For macOS/OSX, I will be showing instructions for qtum-0.14.0-osx64.tar.gz (i.e. the non-DMG version).

For Linux, I will be showing instructions for qtum-0.14.0-x86_64-linux-gnu.tar.gz.

Feel free to download the other variants (and adjust the instructions below accordingly).

In the sections below, I'll assume that you've downloaded the tar.gz file into the $QTUM_DIR directory.

Extracting qtum-qt

On macOS/OSX:

$ tar --strip 1 -C $QTUM_DIR -xf $QTUM_DIR/qtum-0.14.0-osx64.tar.gz 

On Linux:

$ tar --strip 1 -C $QTUM_DIR -xf $QTUM_DIR/qtum-0.14.0-x86_64-linux-gnu.tar.gz

When listing the $QTUM_DIR directory, e.g.:

$ ls -1p $QTUM_DIR 

You should now see:

bin/
include/
lib/
qtum-0.14.0-osx64.tar.gz*
share/

* On Linux this will be qtum-0.14.0-x86_64-linux-gnu.tar.gz.

The Data Directory

If you've previously run qtum-qt (or qtumd) with the Qtum Sparknet (previous testnet) blockchain, you'll need to make sure to delete (or move) any existing blockchain data. See the section entitled Deleting the Sparknet blockchain at https://github.com/qtumproject/qtum/releases/tag/testnet-skynet-v1.1 for details.

The qtum-qt executable supports many options, but we'll just be using the defaults. I'll create a separate post to discuss the various options (including options that are useful for staking).

With the defaults, it is important to realize that the following (OS-specific) directory is being used to store the blockchain data, the wallet, etc.

  • On Linux: ~/.qtum
  • On macOS/OSX: ~/Library/Application Support/Qtum
  • On Windows: %APPDATA%\Qtum

In the directory above (after running qtum-qt), you'll find wallet.dat which is your wallet file. Keep this file secure (in fact, you can encrypt it in qtum-qt by going to Settings->Encrpt Wallet in the menubar).

There are other important files (e.g. .cookie, etc.) and subdirectories (e.g. the blockchain data, etc.) here as well.

You want to make sure that you have at least 2GB of free disk space where this directory resides (i.e. under your home directory, by default).

Running qtum-qt

To launch qtum-qt, simply run the following:

$ $QTUM_DIR/bin/qtum-qt

If you encounter issues on Linux (e.g. related to $DISPLAY), let me know in the comments section and I'll help you.

You should see the following window the first time you start qtum-qt:
qtumqt-welcome-choose-data-dir-rev1.png

I recommend that you choose the default data directory (although this is really up to you -- just remember what you selected).

After clicking OK, you should now see the Splash screen:

After a few moments, the qtum-qt GUI should be up and running. You'll first get a warning message indicating that your wallet needs to finish synchronizing with the Qtum network. This should take a few minutes to complete (ignore the Estimated time left until synced estimate...):
qtumqt-syncing.png

You can see when the synchronizing is done by hovering over (for a second or two) the last icon at the bottom-right of qtum-qt (i.e. the check-mark):
qtumqt-syncdone.png

You'll also notice that you have no QTUM in your wallet:
qtumqt-zerobalance.png

Now, let's get some (Skynet) QTUM...

Using the Qtum Skynet Faucet to get free (testnet) QTUM

In order to stake QTUM coins, you'll first need... QTUM coins.

Once the mainnet (i.e. Qtum Ignition) is released, you'll be able to use actual (mainnet) QTUM coins (which are traded and have value at many cryptocurrency exchanges). Until then, we'll use Skynet (testnet) QTUM coins (which have no value) for staking.

IMPORTANT NOTE: When the mainnet is released, the existing QTUM tokens (i.e. the ERC-20 tokens) being traded on exchanges (e.g. Bittrex, Binance, etc.) will need to be converted to actual QTUM coins. This conversion process will be handled automatically by the exchanges once the mainnet is released. If you hold the QTUM ERC-20 tokens in your own wallet (e.g. MEW/Ledger Nano S), there will be instructions made available by the Qtum team on how to perform this conversion yourself.

The easiest way to obtain Skynet (testnet) QTUM coins is to go to http://skynet.qtum.me . If you prefer the English language, then select it from the drop-down menu in top-right corner (by default you'll likely get the Chinese version of the page).

You'll notice the a text field on the faucet page saying:
Please enter your QTUM address to receive test tokens.

So, we need a QTUM address... This can be obtained from qtum-qt by selecting the Receiving addresses.. option under the File menubar option of qtum-qt:
qtumqt-receivingaddress.png

Next, select the receiving address shown and click on Copy:
qtumqt-copyreceivingaddress-rev1.png

You'll want to paste this address (from your clipboard) into the input field on the faucet page (mentioned above):
qtumqt-faucet-rev1.png

Click on the blue check-mark at the far right hand side of the input field to submit your request. If all went well, you'll see your Qtum address being displayed under the Latest Payouts column. The Status column will likely show an hourglass until the transaction has been confirmed by the network.

NOTE: The faucet can only be used once every 24 hours (without resorting to tricks).

qtumqt-faucet-status-pending-rev1.png

After the transaction has been confirmed by the network, you'll see a payout to your address, e.g.:
qtumqt-faucet-status-done-rev1.png

Once the transaction propagates across the Qtum Skynet network to your copy of the blockchain (managed by qtum-qt), you'll see it show up in your wallet:
qtumqt-faucet-transaction-in-wallet-rev1.png

Staking

Now that you have QTUM (Skynet) coins in your wallet, you're ready to stake them. But...

If you hover over (for a second or two) the lightning bolt icon (next to the HD icon) at the bottom-right of qtum-qt, you'll notice the following:
qtumqt-staking-not-mature.png

The message "Not staking because you don't have mature coins" appears. This is because you must wait 500 blocks for your coins to mature.

Let me repeat this: TO BE ELIGIBLE FOR STAKING, YOU MUST WAIT 500 BLOCKS FOR YOUR COINS TO MATURE.

Also, once you've received a staking reward (currently 4 QTUM), you must wait 500 blocks for the reward to mature (after which you can then spend it).

Once you are eligible to stake, the lightning bolt icon will turn solid (instead of empty/outlined) and the following message will be displayed (when you hover over it):

Staking.
Your weight is <your staked coin amount>
Network weight is <total network weight>
Expected time to earn reward is <some number> day(s)

e.g.:
qtumqt-staking-rev1.png

The Expected time to earn reward (in days) is roughly calculated by: (network_weight / your_weight) * block_time_in_minutes / 60 minutes / 24 hours. To be clear, this is a statistical expected time (i.e. you could get a stake reward much sooner, or much later than the expected time).

How Long Do I Need To Wait For My Coins To Mature?

You may be left wondering how long you'll need to wait to start staking. The easiest way to determine this is to find the block containing the faucet transaction, then add 500 to that block.

If you go to https://skynet.qtum.info/address/<put_your_address_here> (you can also go there by clicking on your address under the Address column of the Latest Payouts table on the faucet page), you can find the faucet transaction. If you click on the transaction link (higlighted in blue) you'll be taken the the transaction information page (the URL will begin with https://skynet.qtum.info/tx/...)

On the transaction information page, click on the link (also highlighted in blue) shown for Included in Block. This will take you to the block information page (the URL will begin with https://skynet.qtum.info/block/...) and it will display the block number in question. Add 500 to this block number to determine when your coin will mature.

Assuming that each block takes at 2.5 minutes (i.e. 150 seconds), it will take approximately 20.8 hours for your new coins to mature for staking (i.e. 500 blocks x 150 seconds = 75,000 seconds... which is about 20.8 hours).

NOTE: You can see the average block time for the last 24 hours at https://skynet.qtum.info/stats .

Disadvantages of Staking using qtum-qt

The qtum-qt wallet is a useful GUI to interface with the Qtum blockchain. However, if you shut down qtum-qt (or put your laptop to sleep, or get disconnected from the network), you will no longer be staking your coins (until you restart qtum-qt and re-synchronize).

It is therefore preferable to use the qtumd daemon (which is another binary included in the tar.gz file) for staking. I will create a separate (more technically advanced) tutorial to describe how to use qtumd for staking (using block storage with a virtual machine at a hosting/cloud provider), as well as recommending configuration options that are useful for staking.

Stay tuned!

Sort:  

Many thanks for posting this!

Great article, thanks for sharing.

thanks so much my man! i was looking how to stake qtum

very informative post about one of my favorite projects..100% upvote!!

I love it when someone puts together a tutorial I can understand.

please make a guide for how to do this on a VPS Ubuntu like vultr

I was going to do that (I had written 80% of the material), but see my latest post at https://steemit.com/qtum/@cryptominder/qtum-staking-tutorial-using-qtumd-on-a-raspberry-pi-3 .

i have 1855 Qtum coin. now we can staking qtum coin?? or test model?

It's currently enabled on the (Skynet) testnet. The Qtum mainnet (with support for POS/staking and the DGP) should be released in September or October 2017. You'll be able to stake the QTUM coins that you hold in a Qtum wallet on the mainnet.

I got the test coins and have staking running. it is little confusing if these coins have no value even after maturing then why someone would do this? Just for testing purpose until the mainnet is released?

Yes, until the mainnet is released, this is just practice. The steps will be the same (it will just be a different binary for the mainnet). Also be sure to read: https://steemit.com/qtum/@cryptominder/encrypting-backing-up-and-restoring-your-qtum-wallet .

Just a heads up, never post the number of any crypto you have in a public comment

I have the last Wallet. But he gave me an invalid deposit adress (Cryptopia / Bittrex) . How can I have my coins on the wallet to stack ? Thanks.

Thank you. I’ll try.