Decipher mining jsons

  • Decipher mining jsons

One would think that in the world of cryptocurrency mining, by now we’d all be living in a time where there’s some sort of standardized thinking in terms of our miners. One would be wrong. Figure that there’s alot of opensource projects out there like XMR-Stak and XMRig for CryptoNight-variant coins and they all do essentially the same thing. In fact, there’s not much to it, you take the algorithm figure out how it functions, apply it, and profit. However with so much the same, noone’s decided to come together on an JSON schema, and that’s sad.

Crypto-mining is both easy and hard all at the same time. Anyone can take their computer, mobile phone, Raspberry Pi and download a miner that works and start churning away. To make the most bang for your buck, you gotta go big or go home though. We call these big boys “mining farms” and they typically have a slew of computers with a bunch of graphics cards. Some are solely mining one thing, but the “smarter” ones diversify or atleast change up what they mine based on the profitability. 

So if you’re going out and spending all this money to make you “mining rigs” you’d think that there’s a solution to monitor it all. Fortunately, that’s where we’re all on board! Alot of miner-developers see this need for monitoring remotely and add in a HTTP interface to print out the information for you. Some, like XMRig and XMR-Stak, even provide for JSON which just changes the game on how we monitor. Anyone with even a school-house education in web development can decipher and code up a way to parse JSON. Atlas, we come to the issue though: If you have multiple miners from multiple developers, you’ll probably have multiple structures.

Here’s some examples:

XMRig

{
    "id": "b44c4a3d3ae95c28",
    "worker_id": "TestBench",
    "version": "2.6.4",
    "kind": "cpu",
    "ua": "XMRig/2.6.4 (Windows NT 10.0; Win64; x64) libuv/1.22.0 gcc/7.3.0",
    "cpu": {
        "brand": "AMD Ryzen 7 2700X Eight-Core Processor         ",
        "aes": true,
        "x64": true,
        "sockets": 1
    },
    "algo": "cryptonight-lite",
    "hashrate": {
        "total": [
            131.34,
            0.0,
            0.0
        ],
        "highest": 0.0,
        "threads": [
            [
                20.3,
                0.0,
                0.0
            ],
            [
                18.76,
                0.0,
                0.0
            ],
            [
                18.87,
                0.0,
                0.0
            ],
            [
                18.91,
                0.0,
                0.0
            ],
            [
                17.12,
                0.0,
                0.0
            ],
            [
                17.72,
                0.0,
                0.0
            ],
            [
                19.62,
                0.0,
                0.0
            ]
        ]
    },
    "connection": {
        "pool": "pool.aeonpool.net:5555",
        "uptime": 10,
        "ping": 0,
        "failures": 0,
        "error_log": []
    }
}

XMR-Stak

{"version":"xmr-stak/2.4.7/c5f0505d/master/win/nvidia-amd-cpu/20","hashrate":{"threads":[[1409.9,null,null],[104.7,null,null],[169.9,null,null],[21.2,null,null],[66.8,null,null],[128.7,null,null],[170.8,null,null]],"total":[2072.2,null,null],"highest":2077.8},"results":{"diff_current":9091,"shares_good":4,"shares_total":4,"avg_time":4.3,"hashes_total":36364,"best":[2061193,19063,14199,12807,0,0,0,0,0,0],"error_log":[]}}

EWBF

{"method":"getstat", "error":null, "start_time":1534106908, "current_server":"us1-zcash.flypool.org:3333", "available_servers":1, "server_status":2, "result":[{"gpuid":0, "cudaid":0, "busid":"0000:20:00.0", "name":"GeForce GTX 1070", "gpu_status":2, "solver":0, "temperature":0, "gpu_power_usage":0, "speed_sps":0, "accepted_shares":0, "rejected_shares":0, "start_time":1534106909},{"gpuid":1, "cudaid":1, "busid":"0000:22:00.0", "name":"GeForce GTX 1070", "gpu_status":2, "solver":0, "temperature":0, "gpu_power_usage":0, "speed_sps":0, "accepted_shares":0, "rejected_shares":0, "start_time":1534106909}]}

You can take your pick of which one is the best, but I prefer EWBF’s a bit more. Unfortunately, that’s a closed-source project (which is a whole other issue I have with crypto mining), so even if I wanted to change something, I can’t.

XMRig would really have taken the cake here if they ever come around to building an unified (gpu and cpu) miner like XMRStak did. The serious let down is how XMRStak seemed to have taken their awesome cli output and changed it into this crap of a json output. Just look at the difference below!

HASHRATE REPORT - CPU
| ID |    10s |    60s |    15m | ID |    10s |    60s |    15m |
|  0 |  121.4 |   (na) |   (na) |  1 |  171.4 |   (na) |   (na) |
|  2 |   26.7 |   (na) |   (na) |  3 |   62.1 |   (na) |   (na) |
|  4 |  141.6 |   (na) |   (na) |  5 |  172.8 |   (na) |   (na) |
Totals (CPU):   696.0    0.0    0.0 H/s
-----------------------------------------------------------------
HASHRATE REPORT - NVIDIA
| ID |    10s |    60s |    15m |
|  0 | 1420.3 |   (na) |   (na) |
Totals (NVIDIA):  1420.3    0.0    0.0 H/s
-----------------------------------------------------------------
Totals (ALL):   2116.4    0.0    0.0 H/s
Highest:  2147.3 H/s

{"version":"xmr-stak/2.4.7/c5f0505d/master/win/nvidia-amd-cpu/20","hashrate":{"threads":[[1409.9,null,null],[104.7,null,null],[169.9,null,null],[21.2,null,null],[66.8,null,null],[128.7,null,null],[170.8,null,null]],"total":[2072.2,null,null],"highest":2077.8},"results":{"diff_current":9091,"shares_good":4,"shares_total":4,"avg_time":4.3,"hashes_total":36364,"best":[2061193,19063,14199,12807,0,0,0,0,0,0],"error_log":[]},"connection":{"pool": "pool.aeonpool.net:5555","uptime":17,"ping":119,"error_log":[]}}

That CLI output is gorgeous, tells me what aspect of the miner is working (Nvidia vs CPU in my case). The NVidia cards are broken down by indexes, so if they’d take a note from EWBF that’d be awesome, and the CPU is clean. Again, it’d be even better if they borrowed from XMRig and got the CPU name in there. However, look at that crap of a json output. Now, you don’t need to be Einstein to know that the 1409/hs are the Nvidia card, but they just lumped the outputs together. 

Now imagine trying to build something to monitor these: You have EWBF using your GPUs and maybe XMRStak or XMRig to use your CPU. You’ll be parsing two completely sets of JSON arrays, looking for threads in XMRStak and looking for result[0].speed_sps in EWBF. This frustration is made apparantly worse as each json needs to be parsed and in most cases that means loops.

Solution?

The Crypto-Currency Mining community needs to A) decide upon a JSON schema that everyone can agree on and pressure the developers to use it, or B) developers need to atleast provide a way we can create our own json syntax. Atleast then, us monitoring developers can then tell everyone how the data needs to be in order to be read.

Obviously, as part of one of my to-dos for CCM, I plan on making my parsing modular so that people can input their miner’s schema and we can utilize it on the fly.

Want to help see this into fruition? Try donating!

Xojo Projects

  • Decipher mining jsons
$
Select Payment Method
Personal Info

Donation Total: $5

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.