One of the most fascinating things about the Nexus blockchain is that it incorporates three different channels to validate data: a proof-of-stake, a hashing proof-of-work, and a prime proof-of-work channel. For over a year, our community has tried to solve a dilemma with the prime channel: our previous miners were too inefficient to compete with a monopolizing force. Now, thanks to Jack McGowen (@Blackjack) and Nexus Lover’s (@nobody) guidance, we have taken a crucial step in decentralizing the prime channel.
The prime miner is a proof-of-work algorithm that searches for dense prime clusters. The larger and more dense the cluster, the more difficult it is to find. Primes are unique mathematical constants that are useful in cryptography. As a comparison, a GPU miner tries different nonce values and hashes each with the block header to try and find a hash that meets difficulty levels. The prime miner doesn’t hash. Instead it searches for primes, repeatedly trying different offsets (nonce values) until it finds one that is the start of a dense prime cluster of the required difficulty. Then it uses that to create the block hash and publishes the block.
Essentially, the new prime miner can be broken down into a two part algorithm: sieving and testing.* “You can’t allow either one to be too slow; the whole algorithm will only be as fast as the slowest part,” says Jack McGowen, “so it’s a balance.” The first fork introduced GPU sieving, but the majority of the testing was tasked to the CPU which became bottlenecked even for high end CPUs. The forked implementation in the new version has added GPU primality testing, which removed that bottleneck. So the miner went from 2-8k tests per second on a single CPU to 50-130k tests per second per GPU, hardware depending.
Jack dove into the Nexus community in July 2017. He has always been fascinated with GPU capabilities and studied to become a graphics programmer for the video game industry. He obtained his BSCS in Real-Time Interactive Simulation at DigiPen Institute of Technology in April 2017.
“I had a great time working on this. This was my first miner and it was a great challenge,” he says. “I started on it in March. I had to put that education to use somehow! It feels good empowering the miners and the network. Do what you enjoy. Do something meaningful. Build something for a better future. I believe Nexus is that future.”
The Prime GPU Miner Beta goes live on Github today so anyone who is curious can check out the code and contribute to optimizing it even further as it is highly configurable. The miner currently only runs on Linux and you can follow the readme for the new configuration settings.
*Sieving is the process of marking off bits in an array that represent big integers larger than the block hash. You mark off multiples of prime numbers to eliminate composites and the remaining bits are probably prime. Then the second part, the testing, validates their primality.