Mining Algorithm Selection and Evolution

Qitmeer Network
6 min readJun 2, 2021

Qitmeer’s consensus protocol, MeerDAG, is based on the BlockDAG framework. BlockDAG requires that all the blocks are generated by mining, so BlockDAG has the same security and decentralization as the PoW BlockChain represented by Bitcoin. The difference is that BlockDAG can safely accept blocks generated at high concurrency, breaking the throughput limits of BlockChain protocols.

Under the premise that MeerDAG protocol’s consensus plugin ensures the security and decentralization of protocol framework, the fairness of mining algorithm seems very important. The fairness of mining algorithm is mainly reflected in two aspects: on the one hand, it is necessary to ensure that the computing power is sufficiently decentralized, so that small and medium-sized computing power will not give up competition due to excessive mining risk, resulting in Matthew effect and the formation of computing power monopoly; on the other hand, it is necessary to ensure that the ratio of input and output of computing power is generally stable in mining efficiency.

Blake2BD Stage — Calves Born

Blake2B is an efficient and secure hashing algorithm optimized for 64-bit machines, and like SHA-256 is not inherently resistant to ASIC miners, and in fact there are already Blake2B ASIC miners on the market. ASIC miners are already available in the world.

Considering these two principles, Qitmeer first adopted Blake2BD, the double Blake2B algorithm. Blake2B is an efficient and secure hashing algorithm optimized for 64-bit machines, like SHA-256, which is not resistant to ASIC mining machines. In fact, ASIC mining machines for Blake2B has already existed in market.

In order to repay the community’s during the initial phase of Qitmeer, considering that the users of the community did not have professional mining equipment. Early mining algorithms needed to be CPU- and GPU-friendly so that even PCs could participate in mining. Combined with security and computational efficiency, BLAKE2B became the most appropriate algorithm. The initial mining algorithm needed to be CPU and GPU friendly so that even PCs could participate in mining, and Blake2B became the most suitable algorithm for security and computational efficiency.

At the same time, in order to ensure that the computing power will not be monololized by ASIC mining machines and other professional equipment in the short term. Qitmeer does not adopt the native Blake2B algorithm directly, but a variation of Blake2B, namely the secondary Blake2B operation, Blake2BD. Considering the longer production cycle of ASIC miners, this window of time before the emergence of ASIC mining machines allows community users to mine as much PMEERS as possible.

Cuckoo Cycle Stage — Aggressive

Qitmeer’s fully communitization, zero-pre-mining idea has attracted a greater influx of computing power than expected, including many professional mining pools as well as large miners. Although Qitmeer has taken care of small and medium-sized miners as much as possible in the mining algorithm, which is already technically completely decentralized and fair, so no professional ASIC miners have emerged. But because the Blake2BD algorithm itself is still computationally intensive, the GPU miners of big miners still have a huge scale advantage over individual mining. In addition, the windowof time for this simpler variant of Blake2BD, the anti-ASIC, is coming to an end.

In the end, Qitmeer decided to replace the algorithm with a more ASIC-resistant Cuckoo Cycle. The current mainstream idea on ASIC resistance is to use memory-intensive algorithms, because the cost of increasing memory capacity and bandwidth is much higher than the cost of increasing computational power for the chip. Cuckoo Cylce is also such an algorithm, which needs to find a loop with N edges in a huge bipartite graph with 2 * 2N edges. Obviously, the larger the video memory is, the higher the search efficiency will be. In this way, the difficulty of the algorithm can be quickly adjusted by adjusting the size of N.

For example, in the early stage of Qitmeer, in order to take care of the small and medium-sized miners who made great contributions to the community, 24 small graphs were adopted, generating a bipartite graph with only 2 * 242 edges, which was adjusted to 29 large graphs with 2 * 292 edges in the later days, and the threshold of video memory was raised to 8G.

In addition, Cycle includes cuckaroo, cuckatoo, cuckaroom and other variants of the algorithms. The difference mainly lies in the number of hash rounds within the algorithm, or the change in the definition of ring. These algorithms can be switched at any time as needed, for example, every six months.

The flexible adjustment of difficulty and algorithm brings great risks to the development of ASIC miners, because the project owner can quickly adjust the algorithm or difficulty to scrap the miners once the ASIC miner is causing the monopoly of computing power.

Qitmeer_keccak256 Stage — Never Forget the Original Intention

Pre-Qitmeer (PMeer) using the Cuckoo Cycle algorithm was launched as the first version and recieved a lot of popularity from miners, including bminer, gminer and other well-known miner developers. One problem that has arisen is the large mining efficiency gap between gminer and official miners, resulting in the loss of many miners’ interests. And with the impact of the ETH coin price, the loss of miners was also severe, switching back and forth between the Ether and the PMEER, causing instability in computing power.

It is understandable that miners are profit-oriented, but the resulting computing power instability will have a great impact on the security of Qitmeer. Because the source of security based on PoW consensus is the aggregation of computing power, especially in the early stage of the project when computing power accumulation is relatively low. Therefore, Qitmeer needs to ensure a certain level of computing power loyalty, so that miners who are really willing to work together to build Qitmeer can share the benefits of Qitmeer’s development.

FPGAs (field-programmable gate array) can customize chips with specific functions through programming. Compared to GPUs, which are purely customized at the software-level, FPGA needs to burn the program into the chip, which is a hardware-level customization, and the migration cost is much higher. Therefore, FPGA miners are much more loyal, so the stability of computing power can be guaranteed for quite a long time. In the end, Qitmeer decided to support Qitmeer_keccak256, which is more friendly to FPGA algorithms, and pioneered a hybrid mining mode for FPGAs and GPUs.

The loyalty of FPGA miners proved to be much higher than that of GPU miners. In the early days of hybrid mining, Qitmeer took into account that FPGA mining is more efficient than GPU mining, and also considered GPU miners as early participants, Qitmeer protected GPU miners by setting the block ratio between GPU and FPGA at 7:3, also hoping to introduce competition to allow GPU miners to support Qitmeer steadily.

After several months of operation, the Qitmeer network decided to remove the GPU arithmetic protection by soft forking at a certain height and instead unifying the algorithm to the more FPGA-friendly Qitmeer_keccak256.

The evolution of PoW algorithm is also the growth journey of Qitmeer, which is not only solving one technical challenge after another, but also exploring the balance between ideal and reality, moving towards the pragmatic and stubborn goal of “building a usable blockchain”.

Links and extra information

Medium:https://medium.com/me/stories/public

Twitter: https://t.co/jIZ0PiXLll?amp=1

Telegram: https://t.me/qitmeernetwork

YouTube: https://www.youtube.com/channel/UCAl3TFrHDZ-RSNJSdRfOWUQ/featured

Instagram: https://lnkd.in/gSqwhf3

Discussion Forum : https://qitmeertalk.org

--

--

Qitmeer Network

Qitmeer Network is the next generation payment network infrastructure based on BlockDAG technology.