An Introdction to RandomX, Benchmarking tool and pool/solo mining

If you have come here from the RandomX GitHub please post questions and issues in this thread not the GitHub - I am more than willing to help with the config and setup.

If you are new here and found this place via RandomX, welcome to zcash. We too are a privacy centred coin. Take a look around and I hope you enjoy your stay.


Hi,

[Full disclosure I help out with TXChangeCoin. We have similar goals and they have saved me a ton of work - we have something even more exciting coming up - so I have no financial interest but I am on the team as it were.]

So now we have a working ubuntu usb, we have done some testing of the benchmark tool, and we can get a rough estimate of whats going on. What we really need is a real world example to test our hardware against.[update 28/07 - windows binaries are being worked on.]

There are a few projects that have already integrated randomx (loki and wownero) both of these have their own custom parameters for RandomX and are supported by the latest XMRIG.

I am going to concentrate on TXChangeCoin, the third coin I know of that had integrated RandomX, but uses one uses the default parameters - the same as the benchmarking tool, and most likley what Monero will be using in the October network update.

First a brief word about TXChangeCoin. - GitHub - txchangecoin-project/txchangecoin: Txchangecoin (TXX) is a cryptocurrency which focuses on being untraceable and private.

  • Their was no ICO/Premine,
  • there is no dev donation,
  • They do not court exchanges.
  • It is still under test so expect bugs, but everything does function.
  • We (the dev and I) are both enjoying playing with technology rather than chasing profits.
  • It is a great soak test for power consumption, noise, etc.
  • I have been running 3 servers on it for a bit. when you start mining let me know your address and I will send you some coins.
  • We are both doing this for free, so a thank you goes a long way.

I am going to do my ryzen testing via real mining on this pool. the basics are in here. full breakdown of ryzen mining to come.

So after setting up a test environment as outlined in the previous post, lets go from there. NOTE THE SETUP HAS CHANGED DUE TO A MISTAKE BY ME. PLESE USE YUMI TO CREATE YOUR PERSISTENCE

  • one advantage of linux that I have noticed, is it ignores the boost profile of the cpu and rather than boosting just 3 of my 6 cores it defaults to boosting them all to 3.7ghz

Here are the system specs for my ryzen 2600 build. We will quickly run through its stats, then the benchmarking tool, then a real mining pool.

dmidecode -t processor
CPU info for ryzen 2600
Processor Information
        Socket Designation: AM4
        Type: Central Processor
        Family: Zen
        Manufacturer: Advanced Micro Devices, Inc.
        ID: 82 0F 80 00 FF FB 8B 17
        Signature: Family 23, Model 8, Stepping 2
        Version: AMD Ryzen 5 2600 Six-Core Processor
        Voltage: 1.1 V
        External Clock: 100 MHz
        Max Speed: 3900 MHz
        Current Speed: 3400 MHz
        Status: Populated, Enabled
        Upgrade: Socket AM4
        Core Count: 6
        Core Enabled: 6
        Thread Count: 12

So the important bits to take are, 12 threads, and 6 true cores. so initial parameters of --init 12 --threads 6 looks good. lets check the cache

dmidecode -t cache
dmidecode -t cache

[code]
Handle 0x0010, DMI type 7, 19 bytes
Cache Information
Socket Designation: L1 - Cache
Installed Size: 576 kB
Maximum Size: 576 kB
Speed: 1 ns

Handle 0x0011, DMI type 7, 19 bytes
Cache Information
Socket Designation: L2 - Cache
Installed Size: 3072 kB
Maximum Size: 3072 kB
Speed: 1 ns

Handle 0x0012, DMI type 7, 19 bytes
Cache Information
Socket Designation: L3 - Cache
Installed Size: 16384 kB
Maximum Size: 16384 kB
Speed: 1 ns
/details-]

In summary, according to the info and the spec:

567kb of L1 cache (spec requires 16kb per thread)
3mb of L2 cache (spec requires 256kb per thread)
12mb of L3 - (spec requires 2mb per thread)

so

  • We have More L1 than needed,
  • More L2 than needed
  • it looks like L3 will limit us.

I have 3000mhz CL15 ram. when running under XMP. (I think it is 2133 rated, just high binned)
XMP is enabled for this first set of tests because I believe this will be the most common scenario, further testing and timing to follow in later posts.

XMP, is an overclocking profile set by the manufacture. It is a very good baseline for your ram. Manual overclocking will yield better results. (just checked and I think XMP was off but memory overclock was auto.)

lets check those threads and init parameters quickly in the benchmarking tool.

dont forget to enable large pages

sudo sysctl -w vm.nr_hugepages=1250
cd ~/rdx
./randomx-benchmark --mine --jit --largePages --init 12 --threads 6 --nonces 50000
output from benchmark

That is about expected. however 6,7,8 threads all over 100000 nonces (about a minute) all gave roughly the same hash. To test this further we need to
try real mining over a period of time. and their is a lot of room for improvement.

Thankfully the wonderful people at TXChangeCoin have already done this!

Compiling TXChainCoin from source, takes slightly longer but recommended because it is the easiest way on ubuntu. This runs fine off a usb stick. and it auto grabs the latest versions of randomx, etc.

The main project page is here - GitHub - txchangecoin-project/txchangecoin: Txchangecoin (TXX) is a cryptocurrency which focuses on being untraceable and private.

There is a windows GUI version that seems to have the daemon and wallet-cli functionality, but I have not had a chance to download this or even test it. We will be sticking with ubuntu. for the moment. I will get around to testing the GUI soon. lets get some coins mined and some transactions happening. :slight_smile:

You should do all this via a terminal.

Compile from Source

Now to double check have all the dependencies installed and in the right place. (a lot of these are already installed so will be auto skipped when trying to install again)
Note, we are installing screen. This will be used later.

We need to add the universe repository to get some of these.

sudo apt-add-repository universe
sudo apt update
sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev doxygen graphviz libboost-chrono1.65.1 screen

On Ubuntu you have to build the binaries for libgtest yourself, for some reason they do not come made, just as source.

sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/

Okay now we should have everything we need to compile the project

cd ~/
git clone --recursive https://github.com/txchangecoin-project/txchangecoin
cd ~/txchangecoin
git checkout master
make

Because we are testing lets move the important bits to a new folder.

mkdir ~/txbin
cp ~/txchangecoin/build/Linux/master/release/bin/txchangecoind ~/txbin/
cp ~/txchangecoin/build/Linux/master/release/bin/txchangecoin-wallet-cli ~/txbin/
cd ~/txbin

Now you need to generate a wallet and address so let use screen to create a session in the background for the daemon to sync

screen -S TXD
./txchangecoind

Now if all this goes to plan, you should see a load of test scroll past and the daemon to start syncing. Ignore the DNS records warnings.

What Initialisation of the daemon and syncing should look like

I advise typing help and seeing what you can do. Dont worry about mining for the moment, we will do that in the next step.

So we are now synced we are read to solo mine. We need to detach from the daemon (it will keep running because it is running in a screen session)

press CTRL+A+D to leave the screen session but keep the daemon running in the background (you dont need to use screen you could use two different terminal sessions.

This should return you to a normal prompt.

now run

sudo ./txchangecoin-wallet-cli

Type a name for your wallet and give it a password. After you pick a language you will be given an address and a backup phrase.

Generated new wallet: TXCHQEpCKzy7TYEG4d9hnrWF9LYduLg7uP8Cdqej3v4oPkQia6Z9tQ1AWNoRqfVEDcHz2MSrNcBR45RWoVWfetgG56K1Nau9nK

This is your wallet address, I am not sure if the new address generation bug has been fixed or not yet, so just use the original address assigned when you first initialise the wallet. (obviously not this one)

(rest of output snipped, it is pretty self explanatory. just copy this address.)

Now you can start solo mining!
For my CPU which seemed to do best with 6 cores I would use a command like this
( start_mining [<number_of_threads>] [bg_mining] [ignore_battery] )

start_mining 6 false yes
solo mining hashrate and commands
Mining started in daemon
[wallet TXCHQE]: exit
ubuntu@ubuntu:~/txbin$ screen -R

2019-07-27 22:34:26.764 I Miner thread was started [0]
2019-07-27 22:34:26.764 I Miner thread was started [2]
2019-07-27 22:34:27.038 I Miner thread was started [1]
2019-07-27 22:34:27.039 I Miner thread was started [3]
2019-07-27 22:34:27.039 I Miner thread was started [4]
2019-07-27 22:34:27.039 I Miner thread was started [5]
hasrate ramp up

(without large pages i get 2k hashes)
show_hr
Hash rate logging is on
hashrate: 2856.0000
hashrate: 2953.1111
hashrate: 3031.1001
hashrate: 3095.0000
hashrate: 3148.5000
hashrate: 3193.9231
hashrate: 3232.8572
hashrate: 3266.1333
hashrate: 3295.7500
hashrate: 3321.4119
hashrate: 3344.2778
hashrate: 3365.0000
hashrate: 3539.1052
hashrate: 3659.2632
hashrate: 3736.0000
hashrate: 3735.6843
hashrate: 3735.4211
hashrate: 3735.4736
hashrate: 3735.2632
hashrate: 3735.9473
hashrate: 3736.4736
hashrate: 3736.8948
hashrate: 3736.3684
hashrate: 3736.1580
hashrate: 3735.7368
hashrate: 3735.1052
hashrate: 3734.6316
hashrate: 3733.8420
hashrate: 3733.0000
hashrate: 3732.2104
hide_hr
Note this takes time to stabilise, about a minute. notice how similar these are to the benchmark results.

Now, The problem is with solo mining you only get rewards if you find blocks. So there is a pool tool.

to connect to the pool you can just use the latest release of xmrig. For the moment we are just supporting the default RandomX paramteters. so use -a rx/test - as outlined in the initial post.

Now you can run the miner from a command line, and it will try to work out what is best. This is pretty good for most situations. and certainly a good initial test to make sure everything is running okay.

It picks 8 cores for my 6 core cpu though. but the hashrate is fine, it matches solo mining.

./xmrig -a rx/test -o stratum+tcp://blocks.txxcoin.tech:4444 -u <YOUR_MINING_ADDRESS> -p YOUR_WORKER_NAME -k

this command line is better, and allows you to adjust the threads parameter to play with different settings for your cpu I suggest using this until the config file issue is resolved.

./xmrig -a rx/test -o stratum+tcp://blocks.txxcoin.tech:4444 --user=<YOUR_MINING_ADDRESS> -pass=<YOUR_WORKER_NAME> -k -r 5 --asm=AUTO --donate-level=1  --print-time=60 --threads=<THREADS>

Adjust the --threads= parameter for your cpu.

The pool will automatically adjust its share target for you. to fix this target (say you have very high, or very low end equipment) change <YOUR_MINING_ADDRESS> to be <YOUR_MINING_ADDRESS.fixed_diff_number>

I recommend letting the pool sort it out though.

In the interactive xmrig shell you can see the number of threads and check you hashrates with the h command. Over time compare this with the pools hashrate for your miner.

It displays 1hr./12hr/24hr it is really useful in testing what you actual hashrate over a period of time would be.

Here is the hashrate graph for my Ryzen 2600 as set up in this tutorial running for 24 hours.

Happy mining.

edit: forgot to include a basic config file, make sure you change the number of threads and add your mining address.

edit: This config wont work with those versions of the miner. it seems to work with my version (pre- 2.99). I will be looking into it and either generating new configs or a patch to the current mining software.
edit: 19/8 - over the next couple of days I will over haul this thread for the 3.10 xmrig release.

save as config.json in the same folder as the xmrig binary.
{
 "algo": "rx/test",
 "av": 0,                       // algorithm variation, 0 auto select
 "background": false,          // true to run the miner in the background
 "colors": true,              // false to disable colored output 
 "cpu-affinity": null,       // set process affinity to CPU core(s), mask "0x3" for cores 0 and 1
 "cpu-priority": 2,      // set process priority (0 idle, 2 normal to 5 highest)
 "donate-level": 1,        // donate level, minimum 1%
 "log-file": null,        // log all output to a file, example: "c:/some/path/xmrig.log"
 "max-cpu-usage": 75,    // maximum CPU usage for automatic mode, usually limiting factor is CPU cache not this option. 
 "print-time": 60,      // print hashrate report every N seconds
 "retries": 5,         // number of times to retry before switch to backup server
 "retry-pause": 5,    // time to pause between retries
 "safe": false,      // true to safe adjust threads and av settings for current CPU
 "threads": 1,   // number of miner threads
 "pools": [
 {
 "url": "blocks.txxcoin.tech:4444",      // URL of mining server
 "user": "YOUR_MINING_ADDRESS",               // username for mining server
 "pass": "test",                        // password for mining server
 "keepalive": true,                 // send keepalived for prevent timeout (need pool support)
 "nicehash": false,                // enable nicehash/xmrig-proxy support
 "variant": -1                   // algorithm PoW variant
 }
 ]
}