PascalCoin RandomHash2: Now you can do even better!
PascalCoin RandomHash2: Now you can do even better!

By Dzoelx | Joelagbo | 17 Aug 2019


The RandomHash protocol have been a breakthrough solution to the mining centralization experienced during the earlier days of the PascalCoin blockchain. Following the centralization of about 99% of mining of the PascalCoin by one mining pool, this posed an economic threat to the PascalCoin ecosystem, hence the development of the RandomHash protocol, a GPU and ASIC resistant hashing algorithm which restored the decentralized mining system and shifting the mining power to the serial gadgets and solving the problems of dual miners mining PascalCoin as a ‘secondary coin’.

The Secondary coin concept entails that a random miner X can mine PascalCoin while mining other coins using the same electricity, while PascalCoin is not the main coin of interest, the economic implication of this is that the miner can easily dump the PascalCoin into the market as they invested almost nothing in the mining. This made exchanges skeptical about listing PascalCoin.

Why the RandomHash?

Having already given a preamble to this, the centralization of the PascalCoin mining activity by one mining pool and the dual miners dilemma is the major reason for the development of the RandomHash protocol [PIP–009].

The dual miners dilemma

Since PascalCoin is GPU-friendly PoW coin,it has become a prime candidate for "dual-miners", especially a non-PascalCoin-centric Pool-X. Dual-miners are miners who mine two independent coins simultaneously using the same electricity. This works because some coins are memory-hard (Ethereum) and others are not (PascalCoin).

When mining memory-hard coins, GPUs have an abundance of idle computational power which can be re-purposed to simultaneously mine a non-memory-hard coin like PascalCoin. Whilst a great technical innovation, the introduction of dual-mining has fundamentally changed the economics and incentive-model of mining for the "secondary coin".

Ordinarily, a coin’s mining ecosystem grows organically with interest and centralization does not occur. This is due to the "hash-power follows price" law. As price grows organically due to interest, so do the number of miners. If there are too many miners, the coin becomes unprofitable, and some miners leave. This homeostasis between mining, price and ecosystem size is part of the economic formula that makes cryptocurrencies work.

With dual-mining, this is broken. Dual-mining has led to coins with small user-base having totally disproportionate number of miners who mine the coin even when "unprofitable". In the case of PascalCoin, miners are primarily the Pool to mine another coin which is of their primary interest and not PascalCoin. So the number of PascalCoin miners are a reflection of the other coin’s ecosystem, not PascalCoin's. Also, these miners mine PascalCoin because they have latent computing power, so it technically costs them nothing to mine PascalCoin. As a result, they mine PascalCoin even when unprofitable thus forcing out ordinary miners who are not dual-mining.

This unregulated and partial incentive system led to a rapid convergence to 99% centralization which was unhealthy for the PascalCoin economy and the general mining ecosystem.

RandomHash to the rescue


Image source

A low-memory, GPU and ASIC-resistant hash algorithm called Random Hash was proposed and developed to resolve and prevent dual-mining centralization. Random Hash, defined first here, is a "high-level cryptographic hash" algorithm that combines other well-known hash primitives in a highly serial manner.

The distinguishing feature is that calculations for a nonce are dependent on partial calculations of other nonces, selected at random. This allows a serial hasher (CPU) to re-use these partial calculations in subsequent mining saving 50% or more of the work-load. Parallel hashers (GPU) cannot benefit from this optimization since the optimal nonce-set cannot be pre-calculated as it is determined on-the-fly. As a result, parallel hashers (GPU) are required to perform the full workload for every nonce. Also, the algorithm results in 10x memory bloat for a parallel implementation. In addition to it's serial nature, it is branch-heavy and recursive making in optimal for CPU-only mining.

This protocol enhances mining for the serial hashers(CPU) while making it more tedious for the parallel hashers (GPU) and hence a more decentralized mining ecosystem.

<Development of the RandomHash2:Enhanced GPU and ASIC resistant hashing algorithm

The RandomHash perfectly solved the problem of centralized mining and saved the PascalCoin ecosystem from the harsh implications of dual mining and the PascalCoin being mined as a secondary coin, however due to it's computationally-heavy nature, the RandomHash has resulted in an unforeseen consequence of slow blockchain validation.

The RandomHash1 operates in two modes, validation mode and mining mode.

In validation mode, RandomHash1 is simpl used to hash a block-header in order to verify it's position in a blockchain— just as how SHA2-256D does in Bitcoin.In mining mode, RandomHash1 is used to mine the next block-header by enumerating many nonces to find an acceptable Proof-of-Work solution for the next block. In this mode, RandomHash1 exploits the partial calculations from previous rounds by resuming them in subsequent hashing rounds

In RandomHash 1, the mining operates at twice the hashrate as validation mode (200%), and is the basis for the "CPU Bias" and important to achieve GPU resistivity. It is biased towards CPU's since re-using the partially calculated nonces is a serial optimization that cannot be efficiently exploited in a parallelized, batch-computation context (such as GPU mining). In other words, the optimal nonce-set is enumerated on-the-fly and cannot be pre-determined into a range for parallel mining as GPU mining requires.

However, on a typical 2019 desktop computer, the validation hashrate of RandomHash is approximately 20 hashes per second. At 288 blocks per day, that's 14 seconds to validate a days worth of blocks and over 1 hour to validate 1 year of blocks. Whilst multi-threading, performance tuning and other optimizations have significantly optimized this performance oversight, it remains a fundamental a long-term issue that needs to be resolved.

RandomHash2 offers an order of magnitude improvement in both validation and mining hashrate. In RandomHash2, the same machine validates at ~400 hashes per second yet mines at ~2,000 hashes per second with far less memory-hardness. Whilst not empirically tested against GPU performance, these numbers suggest a 500% CPU bias.

In order to strengthen ASIC and GPU resistance, RandomHash2 also employs 77 internal hash algorithms, (a reasonable improvement to the 18 internal hash algorithms used in RandomHash1) to transform the data. This moves the economic costs of an ASIC far beyond viability for any rational economic actor, and since the sequence in which these 77 hash algorithms are used is in-determinable and random on a nonce-by-nonce basis. This number is also such that it makes GPU-programs (kernels) similarly non-viable, although not to the same degree as an ASIC.

The RandomHash2 have been developed and implemented as part of the V5 protocol. 

Read more... 

RandomHash1 protocol proposal

RandomHash 2 protocol proposal

RandomHash 2 implementation

Hook up with us...

Official discord channel

Follow us on twitter 


Photographer|blogger|freelance writer


Pascal ambassador| Freelance writer| articles and updates about Pascal blockchain.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.