Saving energy with hashing algorithm enhancements
By Ashish Rajendra Sai
An introduction to the series
Over the past decade, blockchain technology has become highly common, primarily owing to the effective implementation in the cryptocurrency realm. After the emergence of Bitcoin and other cryptocurrencies, blockchain solutions have been implemented in just about every dimension of traditional business activities as a medium to securely exchange digital assets among trust-less parties. This widespread attention is evident in the number of scientific research publications in recent years.
We in the Research and Development department at Globex have actively participated in the research with our collaboration with the Irish Software Research Centre, Lero. We have also assisted in the foundation of the blockchain interest group in Lero, which has successfully published articles related to blockchain in peer-reviewed journals, conferences, and workshops. In this series of research insight blogs, we will be reviewing the active research here at Globex along with other influential research publications in the blockchain domain.
We hope you enjoy the first piece:
Blockchain Research Insights #1:
Authors: Runchao Han, Nikos Foutris, Christos Kotselidis
Affiliation: The University of Manchester, UK
Article Category: Mining Algorithm Optimization
Why this article? : Proof-of-Work (PoW) mining algorithm is the backbone of prominent cryptocurrencies such as Ethereum and Bitcoin. The core idea behind PoW is that entities participating in the network spend some computation power to earn money. This is considered a very clever implementation of social engineering, where incentives are used to ensure human participants stay honest to the network. Just like most other clever computing solutions, this PoW is not without any trade-offs.
In the case of cryptocurrencies, the trade-off for this clever social engineering is the immense electricity consumption. Some research estimates have put the global electricity consumption of Bitcoin mining slightly over Ireland’s annual electricity consumption. To counter this negative side effect, we here at Horizon Globex have moved to solar mining farms where a fair proportion of our mining electricity comes from our solar farm. Unfortunately, this socially responsible practice is far from the norm in the mining industry. Thus the design of these cryptocurrencies must undertake the vast electricity consumption into consideration.
The authors of the shortlisted article aim to address this by optimizing the computation algorithm (Ethash) to increase efficiency and reduce energy consumption by 10%.
Background: The authors describe the three most prevalent memory-hard PoW algorithms operating on NVIDIA GPUs, including Ethash, CryptoNight, and Scrypt. They draw an illustrative algorithm to describe the basic functioning of a PoW memory-hard algorithm. We provide a brief overview of the algorithm before moving on to the original contribution of the paper.
Algorithm 1 introduces a generic PoW memory-hard pseudo-code that intuitively has been split into three implementation stages.
1) Initialization: Generation of a scratchpad (Large memory blocks).
2) Memory Hard Loop: Calculate Hash and Access Memory Scratch Pad (Lines 3 through 6).
3) Finalization: formatting of the final output value (Line 7).
A memory-hard PoW algorithm often relies on generation and allocation of a comparatively large data block (scratchpad) based on a Nonce value (an integer value used in the proof of work algorithms to set a target). The larger the scratchpad, the higher the algorithm’s memory requirements. The proof is updated continuously by mixing proof and Nonce values to enforce data dependencies and increase the memory requirements of the PoW algorithms.
GPUs are the mainstream hardware used to perform memory-hard PoW algorithms due to programmability ease, high memory performance, and low to moderate cost. Ethash, a proof-of-work algorithm used on Ethereum cryptocurrency, is designed due to the potentially high memory requirements to be ASIC-resistant.
In particular, Ethash uses a direct acyclic graph data set representation of 1 GB custom-generated. To examine the usage requirements, they examine the most prominent hashing algorithms.
Notable Results from the hashing algorithm benchmarking:
CryptoNight is reported to be the most memory-hard algorithm, followed by Ethash and Scrypt since it has the lowest compute utilization. Memory is considered the source of the performance bottleneck on the selected memory-hard PoW algorithms, according to the analysis of utilization. Ethash uses just over 1 GB of memory, which is the lowest of all algorithms. CryptoNight uses more memory instructions than the other two algorithms, reducing the use of the computer while keeping the memory fully used. They also state that the limited memory bandwidth and low cache hit rate bound the memory-hard PoW algorithm performance.
As a result of the analysis, the authors propose modifications to the Ethash algorithm. The specifications of these modifications can be located in the full article. In brief, to optimize the memory-hard loop phase of Ethash algorithm, they prefetch the scratchpad. The authors also evaluate the performance of the unmodified and optimized Ethash algorithm for all computing systems. They reported that the modified instance of the algorithm far outperforms the existing implementation by improving the performance by 14% and by reducing energy consumption by 10%.
Implications for the greater blockchain community:
Cryptocurrencies and the underlying technology powering them will continue to have a large impact on the financial ecosystem as acceptance and adoption continue to grow. Its up to developers and the community at large to be sure this innovation doesn’t have an equal yet negative impact on the environment.
What are your thoughts on cryptocurrency energy consumption?
Check in each Wednesday for digestible insights surrounding the most influential research publications in the crypto/blockchain domain.