Qtum Mainnet Performance Charts — Simplicity and Difficulty
This week we have the usual charts and graphs showing mainnet performance. The educational feature gives a super simple explanation of Qtum Proof of Stake (PoS) mining, with a little gratuitous source code thrown in, and takes a deep dive on difficulty.
I am an independent researcher, not affiliated with the Qtum Team, but appreciate their advice and the robust technical discussions in the community.
Charts and Graphs
Data sources for this review of the Qtum mainnet performance come from the Qtum Explorer and logging from the qtumd server application.
Unique Reward Addresses
This week larger wallets continued to show their muscle this week. Unique addresses per day dropped to 252 on November 19, which means the larger wallets were claiming over half the block rewards.
For the entire week, there were 1,065 unique addresses, vs. 1,159 last week. Wallets winning multiple blocks per day continued to drift up.
Active Transactions per Day
Active transactions per day show transactions on the network above the required coinstake and empty coinbase transactions. This week active transactions grew into the 4,000 range, a nice increase from last week.
Block Spacing Variation
For November 13 to November 19 there were 3 blocks with more than 20-minute spacing (vs. 1 last week), with the greatest spacing for block 46,088 at 25:17.
This week the Network Weight chart will take a well-deserved break to enter rehab. “Network Weight” is not a reliable indicator of true network weight, for reasons I have written about previously. Your correspondent suggests you ignore this number for now.
In its place, I suggest the BFNW (Big Five Network Weight). The concept is simple and was explained in last week’s report.
Since a new big wallet began mining on November 11th, today’s BFNW will just use the percentage of block rewards won and the current balance for the top five wallets since then. Averaging over the last 9 days gave 181.56 block rewards per day for these five, or 30.6% of the total. The calculation is:
This network weight is higher than the wallet’s calculation of network weight. I’m hoping by next week to have enough daily data to evolve BFNW into a daily value, using an exponential moving average.
A Very Simple Game
This week the educational feature starts super simple with a short explanation at the most basic level for probability and block rewards and then takes a deep dive on the “difficulty” subject.
In past reports your author has tried different explanations for probability and proof of stake mining. I wrote a DM last week that I would like to share. If you are comfortable with SHA-256 as a random number generator for block rewards, please skip ahead to the difficulty subject.
Consider this game: two players roll a 100-sided dice at the same time, each with their own fair die. The winner has to roll the number 1, anything above that loses. Can you see that this is a completely fair, completely random game, and each player will win on average once in every 100 rolls? (get your 100-sided dice here, see the dice in action here)
Now change the rules. The two players, let’s call them Alice and Bob, get to win with the previous winning low number of 1 times the number of coins they have. Alice has 4 coins so her new winning number is 1 x 4 coins = 4 or less on the dice roll. Bob has 2 coins so his new winning number is 1 x 2 = 2 or 1 on the dice roll. Can you see that now Alice winning with a roll of 4 or less will win twice as often with Bob with a winning roll of two or less? Still a completely fair, completely random game, but on average Alice will win twice as often as Bob. To learn more about random variables and probability you can watch some of the excellent videos on Kahn Academy. What happens when Alice and Bob both roll the same number may be a topic for a future educational feature.
Now let’s change the rules again and add another 1,500 people to the game, and have them each roll a 1.16 x 10 to the 77th power sided dice (also called the SHA-256 hash algorithm) where for the winning number for each is the number on the dice (called the target) times the number of mature coins they are staking (called the “weighted target”, as in their wallet’s weight). The target is given by the Difficulty from the previous block, and the dice roll is actually made by the SHA-256 hash algorithm, represented by “Hash” in the code below:
Exactly the same game, just with a hugely many sided dice. On average you win this game proportional to the number of coins you are staking. (get your 1.16 x 10 77-sided dice here, see the dice in action here)
A Difficulty Subject
In last week’s report I begged off the details of the block difficulty/target details as being too difficult (a weak pun at best). This week we embrace difficulty with a deep dive.
Why is this important? “Difficulty” is a fundamental concept for mining coins, and the difficulty mechanism gained wide use with bitcoin. Qtum uses the same difficulty mechanism, tweaked for fast PoS (Proof of Stake) blocks. Think about the problem Satoshi was trying to solve: how to create a feedback loop where autonomous peers could regulate the pace of blocks over the years as there were potentially huge increases in the number of nodes and the hash power of the nodes. Team Satoshi’s solution was to implement a “difficulty” parameter that controls how difficult it is to mine the next block. For PoW (Proof of Work) coins like bitcoin, as network hash power goes up, the difficulty also goes up to keep an average block spacing of 10 minutes. Bitcoin adjusts difficulty every 2,016 blocks, about two weeks.
The difficulty parameter in Qtum scales with network weight, because PoS mining does not scale with hash power, it only scales with the number of coins being staked on the network. With Qtum, the difficulty is adjusted with every block, and the difficulty is communicated to all the wallets through the Difficulty Bits in the block (usually called just “Bits”).
Because they are so important, Bits and Difficulty are shown for every block on the Qtum Explorer, and for the deep dive today, we will show the calculations for difficulty and the target.
Difficulty is a (more) human-friendly way to express how hard it is to mine the next block. The action in the software is really controlled by the “target”, which moves inversely with difficulty, and target is the actual number that must be found by the SHA-256 hash algorithm random number generator (this is the number that Alice and Bob are trying to “roll under” in the game above).
Bitcoin PoW miners get trillions of chances to “roll the dice” and get under the target to win the next block reward. As bitcoin network hash increases over time, the bitcoin difficulty will continue to rise automatically, even now that Satoshi has retired. On the other hand, Qtum PoS wallets get, on average, 8 rolls of the SHA-256 dice to get under the target and win the next block reward, and the number of rolls (and the difficulty) will not change much, even in the future when Patrick retires.
Lucid explanations are online for everything related to bitcoin details, including extensive discussions of difficulty, SHA-256 and what they call the “eternal question”: when will I get a block reward? Here is a good explanation of difficulty bits. There are many examples showing the program code to convert Bits to target to difficulty, but since you may not have your favorite C++, Rust, or FORTRAN compiler ready, I will show a conversion using the widely available and easy to use tool called Excel.
Excel has to crunch some big numbers to work through the bits to target conversion, it also easily converts from hexadecimal (base 16) numbers to decimal (base 10) numbers. The bits number uses a compact notation, where the first two hexadecimal characters represent a multiplier factor using an exponent (“1a” in the example), and the last 6 hexadecimal characters represent the value of the target (“07ac05” in the example). The spreadsheet is shown below, with the formula for the calculation cells:
In this example, the exponent is “1a” in hex, which is 26 in decimal. The multiplier works out to be 2 to the 184 power, or 2.45 times 10 to the 55th power. The target value in hex is “07ac05”, which converted to decimal is 502789, and the final target is 1.23 times 10 to the 61st power. Get the difficulty by dividing the easiest ever target (used to mine genesis blocks) by the current target, which gives a difficulty of 2,186,792. This spreadsheet is available as a tab-delimited text file on my GitHub, in case you would like to try it in your favorite spreadsheet program.
Just remember, as network weight goes up, difficulty goes up, time to expected reward goes up, and target goes down. They are all interrelated, and the target really drives everything in its role of keeping the blocks running on time.
The report this week comes from Berlin, where your correspondent is searching for the perfect currywurst and most vivid street art in hipster Friedrichsain. It’s a difficult job, but someone’s got to do it.
I hope that you won’t be troubled by difficulties. Enjoy your block rewards.