Proof of Stake Mining on Skynet
Skynet v1.2 - Qtum Core version v0.14.2.0-797c365-dirty (64-bit)
There has been some discussion about Proof of Stake (PoS) block rewards on the QtumNexus Slack, and I wanted to see how it works and simulate some results.
Thanks to cryptominder’s excellent article (https://steemit.com/qtum/@cryptominder/qtum-staking-tutorial-using-qtum-qt ) I was able to setup several miners on Win 10 machines. The wallet installation was quick and easy, waiting for coins to mature and waiting for the block rewards are the hard part.
The probability of receiving the block reward for any block period is given by the number of coins you stake (“your weight”) divided by the total coins staked on the network (the “network weight”). At 720 blocks per day (targeted for every two minutes) the probability of receiving a block reward in one day is
P =720 * (your weight) / (network weight)
To simulate the results for various weights, I wrote a python script that uses a random number to simulate receiving PoS rewards over long periods of time. The script calculates the wait in days between block rewards.
With this script, it was easy to try different combinations of “your weight” and “network weight”. Running the simulation for 10 years (and 100 years for the weight of 1,000 coins) evened out some of the variation from the random numbers. The script calculates the number of blocks between rewards (the wait between block rewards), which is what you are going to experience running the staking wallet, and answers the question – how long until my next block reward?
The simulation results seem to agree with the wallet calculations, for example, with 51,000 test coins and a network weight of 86,700,000 the wallet shows the expected time to earn reward of 2 days (rounding up) and the simulator gives 1.64 days for the median.
I tabulated results for the median and 10% longest waits.
Median: For all the block rewards received, the median wait (the midpoint of the sorted waits between blocks). Half of the blocks received will have wait times less than or equal to this median, so wait times could be the very next block (aren’t you lucky?) up to the median.
10% longest waits: For the 10% longest wait times, what is the wait between blocks going to be? You are going to experience these waits for 10% of the block rewards.
Over the past week, Skynet has been running a network weight around 75,000,000, giving these results for the simulator:
How to read this table for 10,000 QTUM staked row: If the network is staking 75,000,000 coins, and you are staking 10,000 coins, then for half of the block rewards you receive, the reward will occur within 7.4days or less from your previous reward. For 10% of the time, there will be at least 25 days between block rewards. You will receive 34 block rewards per year (with 4 QTUM in each block). This represents a 1.36% annual return, so don’t quit your day job2.
The results scale up or down linearly based on your weight and the network weight, with some other examples below.
Qtum currently has a population of 100,000,000 coins and will have an inflation of about 1% per year from PoS mining. Since individual mining results are inversely related to the network weight, here are the simulations for other network weights.
For a network weight of 50,000,000 there is a 2.1% annual return. QTUM PoS is derived from BlackCoin PoS 3.0 (https://blackcoin.co/ ) which quotes annual returns of 1% to 8%, depending on their network weight.
For a network weight of 30,000,000 there is a 3.6% annual return.
For a network weight of 15,000,000 there is a 7.1% annual return.
Here are some initial observations from staking on Skynet using the desktop wallet.
Coins mature after exactly 500 blocks in the wallet. The block time is currently averaging 2.39 minutes, so this means 20 hours.
If you have 1,000 mature coins your staking weight will be 1,000. If you then send 750 coins to the wallet, exactly 500 blocks later your weight will change from 1,000 to 1,750.
If you restart a wallet containing mature coins it will take a minute or two to reactivate the maturity. The wallet will restart with the outline lightning bolt with mouseover messages of “Not staking because the wallet is offline” or “Not staking”, but just wait for staking to resume.
The screenshot below shows the right side of my wallet for a block reward starting at 8/31/2017 17:06. An initial payment of 0.4 QTUM is followed 500 blocks later with 9 more payments of 0.4 QTUM for a total of 4.0 QTUM (the first of these is shown below at 9/1/2017 13:22) My first block reward took 2 days (1638 blocks) after the coins matured, the second came 1040 blocks later, and unless you are a whale, patience is a virtue for PoS mining.
Happy mining to all, anticipating the mainnet launch on September 13.
nice read! I wonder how long it took you to stake 51k coins on testnet? Were you sending them everyday for couple months haha? Also any idea whats the initial mainnet weight gonna be?
@kahmed Sorry for the long delay. I was trying to accumulate test coins on Skynet through the "faucet" but 50k would have taken a long time. So I just asked the team and then sent me the stash (it is play money anyway) so I could try it out. Network weight for the mainnet is a topic of great interest. The current network weight (about a week and a half after the token to coin swap) is about 8 million.