Word of Mouth

I was at a local crypto meetup looking for some conversation around identity, privacy, and technological advancements. As the conversation goes on and I’m providing my input, I’m inevitably asked what I do. This is always the opportunity to introduce YadaCoin. I pitch the idea of YadaCoin and it’s implications for communication and social networking on the internet. The message is always well received and that’s when the vetting questions come, which I’m happy to answer.

The questions are usually around the economic aspects, how many coins already mined, total supply, etc. These questions go smoothly but then someone always hits me with, “which algorithm do you use?” I will admit that I naively thought that following in bitcoin’s footsteps would always be a safe bet. So I answered, “SHA256.”

Silence…

“So you’re going to get attacked by GPU miners, FPGAs, and ASICs. Not to mention someone renting hash power from NiceHash.” This was a disqualifier in their eyes and rightly so because our project was nearly deserted by the CPU mining community when only a few GPU miners jumped on the network and started winning every new block.

This puts every crypto project in a precarious position. Do they want more security from the higher hash rate or more decentralization of hash power, block insertion, and coin distribution? Obviously the latter was more desirable but our algorithm was just too vulnerable. We had to do something.

A patron of the meetup asked if I was familiar with a new hashing algorithm from the Monero project that is exclusively tailored to all the strengths of CPUs. This was the break YadaCoin was waiting for. Finally, we had a way to keep our hashing network fully decentralized.

The Implementation

I immediately dove into the RandomX source code. I found a package already made for Python integration and the documentation was superb.

I couldn’t wait to revive our CPU mining community, so we made the announcement that at block 65,000 YadaCoin would no longer be using SHA256 and officially transitioning to RandomX.

Some unexpected things came up with RandomX that a typical miner my not be used to. RandomX is “memory hard” and requires a little more than 2GB in “fast mode.” This is PER CORE. So with our pool mining client, if your system has 8GB and 8 cores, then you’re only going to be able to run 3 or 4 cores for optimal hashing performance. Which does disappoint some miners as they love to see all of their CPUs completely maxed out at 100%. There’s also an initialization that is pretty hefty and can take several seconds, even close to a minute, to complete. After the initialization period, however, subsequent hash generation is instantaneous.

A note about the PyRX module. It was developed for testing and there were some tweaks needed to make it viable for windows. The version currently available at the time of writing this article, takes literally an hour to initialize due to certain flags and settings not being properly set on windows machines. If you’re going to use this module for windows, use our pyrx fork as a reference for making the necessary changes to drop that wait time to around 20 seconds.

We’re still working on tuning the initialization time but it does appear to be a fact of life at this point. This really only becomes an issue when verifying the entire blockchain. There’s a parameter called seedheight that we interpreted to take the block height as the proper input. After about 2048 blocks, the initialization process starts over. The datasets, VMs, cache, etc. are all dropped and this reset process takes several seconds. If you have tens of thousands of blocks, this can significantly slow down the verification time to 10 or 20 minutes. In the blockchain world, however, this is not unheard of and users are used to walking away for several hours from a node that is busy syncing.

The trade-off was definitely worth it.

YadaCoin’s target audience is the general public and their gateway to using the features of the Yada protocol is through the YadaCoin wallet. So it was a no-brainer that we would favor consumer grade hardware.

In conclusion, our experience with RandomX has been wonderful and we can’t thank the Monero project enough for this enormous contribution.

PyRX by Jethro Grassie

https://github.com/jtgrassie/pyrx

RandomX by Tavedor

https://github.com/tevador/RandomX

Our forks:

https://github.com/pdxwebdev/pyrx

https://github.com/pdxwebdev/RandomX