Viewpoint | Checking the block Nonce distribution to track changes in mining equipment

Author: Coin MetricsTom Brand, Uri Kolodny & Avihu Levy

Translation & Proofreading: Min Min & A Jian

Source: Ethereum fans

Editor's Note: The original title is "Viewpoints | Tracking Changes in Mining Equipment with Nonce Distribution"

ASIC caused huge controversy

Since the early days of Bitcoin, the community has been discussing whether to fight the increasingly powerful mining hardware.

In the beginning, using the CPU (the standard processing unit used by most computers) to participate in Bitcoin mining can also make money. In this case, almost everyone has the opportunity to participate in bitcoin mining because there is no need to use custom computer hardware.

Over time, some miners began to use increasingly powerful hardware in order to gain an advantage in the mining competition. Later, miners began using the GPU, a more powerful "graphics processing unit." GPUs are often used for games and 3D rendering, but they can also be used for many general purposes. Although GPUs are much more expensive than CPUs, they are also within the economic power of ordinary people.

Then there came the ASIC. An ASIC is an acronym for "application-specific integrated circuit." It is a specialized mining hardware that is optimized to accommodate specific mining hash algorithms. These mining ASICs are specifically designed for digital currency mining and can only be used to dig digital currency. In terms of pure hash computing, it is much more powerful than GPU.

ASIC has changed the economics of mining. In short, companies that produce new ASIC miners have a significant advantage in the entire mining industry because these companies have an advantage in computing power (at least until they are surpassed by other ASIC manufacturers) and control the market. The supply of the newly released ASIC mining machine. Since the production of a new ASIC hardware requires huge capital investment in the early stage, only a small number of people can join this line. Large miners can enjoy the extra benefits of economies of scale, which is difficult for ordinary miners to compete with.

Therefore, there are already many projects trying to compete with ASICs. Especially in the early 2018, when bit mills and other miners announced that they were developing an ASIC that specializes in excavating Monroe, the project side implemented a hard fork to defend against ASICs, ensuring the decentralization of mining activities as much as possible. Since then, the project side has carried out several hard forks and tried to walk in front of the ASIC to hinder the further development of the ASIC.

Since its inception, Ethereum has continued to struggle with ASICs (Ethash has been designed to be ASIC-resistant since the 1.0 release), but ASIC manufacturers are now struggling to catch up. As a result, many people in the Ethereum community are supporting the ProgPow implementation. ProgPow is a modified version of the Ethash algorithm that helps Ethereum defend against ASICs.

Although these projects are constantly resisting ASICs, it is difficult to guarantee that they will not be caught up with ASICs. Driven by the interests, big miners are actively developing ASICs, because in the anti-ASIC blockchain, dedicated mining hardware will give them a greater advantage than small miners. This means that ASIC miners and blockchain developers are always playing cat and mouse games.

Approaching Nonce

Excitingly, examining the block nonce distribution can understand the rise of ASIC mining on a particular blockchain and the impact of subsequent resiliency measures.

PoW mining is to repeatedly hash the block header of a block until the calculated hash value is less than the target value defined by the protocol. Specifically, the block header is taken as an input value and then substituted into a cryptographic hash algorithm for calculation. For example, Bitcoin uses Secure Hash Algorithm 256 (SHA-256), and is Execute twice in succession.

To ensure that each hash calculation gets a different hash value without recreating a block header, the block header provides the miner with a special field: nonce. Nonce is a value that can be arbitrarily modified by the miner to continuously change the block header for hash calculation until a hash value below the target value is found. Nonce is a number that can range from 0 to the upper limit set by each protocol.

In theory, the probability of calculating an effective hash based on any nonce is equally large, so nonce can be considered to be randomly chosen and evenly distributed. However, data analysis of many blockchains shows that there are very few blockchains that really fit this expectation. There are many explanations for this, but because changes in the nonce distribution can often be associated with new mining machines, this suggests that different mining hardware often have different nonce selection strategies.

Regarding the nonce distribution pattern of the Bitcoin blockchain, it seems that the Twitter user @100TrillionUSD was first discovered in early January 2019. Further analysis shows that there are some strangeities in the nonce distribution pattern of blockchains such as Monroe, Ethereum and Litecoin.

Bitcoin

The nonce distribution pattern of Bitcoin is the most famous. In the early stages of development, Bitcoin adopted a common pattern: many nonce are close to zero. The strategy for this distribution is simple, to calculate the hash by increasing the nonce. Because in the early days, the computational power on the Bitcoin blockchain was low, mining was a CPU, and a valid hash would usually be calculated before traversing all possible nonce values. Based on this fact, Sergio Lerner made the most serious attempt to determine Nakamoto's bitcoin attribution.

After the introduction of the GPU, the nonce field appears to be random. However, at a block height of about 400,000, there is a new pattern inexplicable, forming a few fine nonce value distribution bands, which are the nonce values ​​of the miners' lower selection frequency.

The BitMEX study author described the pattern in detail, but did not find a clear explanation.

Looking at the histogram of the bitcoin block nonce (during the entire historical transaction), it can be clearly seen that in the new mode, the nonce value has several pits.

– The red line represents a uniformly distributed nonce value case –

For a more granular analysis, take a closer look at the distribution of bits. The nonce field in Bitcoin consists of 4 bytes or 32 bits. After analyzing the average of each 32-bit nonce, you will find some interesting phenomena:

– The darker the color, the higher the frequency in which the digits in the nonce are set to 1 instead of 0, and the X axis represents the height of the block –

When Bitcoin was first born, the higher digits were usually set to 0 because the miner's nonce selection strategy simply added a nonce value. The lower digits (the last 8 digits at the bottom of the figure above) seem to follow a certain pattern, but until recently the lower digit mode has changed.

Monroe

One of the most interesting assets for nonce analysis is Monroe. It is also the most analyzed asset, and it has been analyzed by many articles and tools.

Monroe will perform a hard fork upgrade every 6 months, and in the past several upgrades, the PoW algorithm has been adjusted to protect the dedicated mining hardware. The first hard fork caused controversy because it forked several projects/assets.

Therefore, we can study the effect of these changes on the nonce distribution.

At first glance, we can notice a few interesting phenomena. However, when we overlay the network difficulty value and the hard fork schedule on the basis of the above figure, we will find something more interesting.

– The red line represents the time of the hard fork, and the black line represents the network difficulty value –

We can see that all three PoW upgrades caused a reduction in the difficulty value, and two of them changed the original nonce distribution mode. Interestingly, the new nonce mode is usually introduced when the network difficulty value increases suddenly.

After the network difficulty value has changed and the PoW mechanism is adjusted by hard forks, we can observe from the change of the nonce distribution mode that the first fork effectively defends against the first generation of mining machines. In addition, we can also see that some miners quickly returned with the second-generation mining machine after the second fork, but collapsed in the third fork.

Ethereum

At first glance, the nonce distribution of Ethereum shows little surprise.

Looking closer, we can see that after the block height of 7,000,000, there are some dark horizontal lines at the bottom of the nonce map. If you zoom in, you will see that from the block height of 2,000,000 to 4,000,000, there is some slash at the bottom of the nonce map. These lines are most likely caused by a simple nonce selection strategy: during repeated hashing, nonce is incremented from 0.

According to the hist distribution histogram, the lower nonce value takes advantage over a period of time:

However, a closer look at the average value of each digit in the nonce over time will notice a very interesting situation (note that the nonce of Ethereum is composed of 64 digits, unlike Bitcoin which is 32 Composed of digits.)

– The darker the color, the higher the frequency in which the digits in the nonce are set to 1 instead of 0, and the X axis represents the height of the block –

Probably starting from the 1380000th block, the middle digit of the nonce is set to 0 much higher than the other digits. Over time, the randomness of other numbers has also dropped. Interestingly, a cursory look at the overall nonce distribution or histogram does not reveal this pattern because the effect of adjusting the middle digit on the nonce histogram is not obvious.

Interestingly, the nonce digital distribution of ETC (Ethernet Classic) also shows the same pattern.

– The darker the color, the higher the frequency in which the digits in the nonce are set to 1 instead of 0, and the X axis represents the height of the block –

As can be seen from the white vertical strip at the top of the image above, some miners are used to adding nonce from 0.

Bitcoin announced in April 2018 that it will publicly release the first Ethash ASIC miner and stated that it will deliver the first batch of products in mid-July 2018. After marking these two dates in the image above, we will find something interesting:

– Red dotted line: E3 mining machine official announcement time; red solid line: delivery time of the first batch of E3 mining machine –

At first glance, the average of the 41st place in the nonce of the Ethereum and Ethereum classic blocks fell during the ant mining machine E3 official announcement. Focusing on this digit only makes the nonce distribution pattern more obvious:

– Red dotted line: E3 mining machine official announcement time; red solid line: delivery time of the first batch of E3 mining machine –

Before mid-March 2018, the 41st average is around 0.5 (the gray horizontal dashed line in the figure below shows the expected value of the nonce evenly distributed). However, in the Ethereum and Ethereum classics, the 41st bit is set to 0 and the frequency is getting higher and higher, and all at the same speed. At the time the mine was first delivered as planned (ie July 16, 2018, indicated by the solid red line), the average dropped sharply, but this only occurred on the Ethereum blockchain. In the Ethereum and Ethereum classic blockchains, the 41st average has fallen in mid-June 2018 (ie, one month before the first E3 miners were delivered), and only in the Ethereum block. The chain is further down.

– Red dotted line: E3 mining machine official announcement time; red solid line: delivery time of the first batch of E3 mining machine –

Looking at the top 5 Ethereum mines at that time, the average of the 41st level began to decline, but since the first batch of E3 miners on July 16, the two mines in China, SparkPool and F2Pool, have been dug up. Within the block, the average value of the nonce 41st is further reduced.

Struggle

With the approach of the ProgPow algorithm, and the Monroe team is still resolutely resisting ASICs through hard forks, the war between this and dedicated hardware may continue. As the war continues, we will keep an eye on it and continue to look for clues from the nonce.

(Finish)