2

What JSON messages are exchanged with the pool, and how does one connect to a pool? With mining.subscribe? I read somewhere that the stratum protocol that CryptoNote coins use is different to, say, sha256 coins. I am currently trying to develop a Python CryptoNote miner.

1 Answer 1

5

Monero pools all (to my knowledge) use (roughly) the following payloads:

{
    "method": "login",
    "params": {
        "login": "wallet_address",
        "pass": "pool_pass",
        "rigid": "",
        "agent": "user-agent/0.1"
    },
    "id":1
}

{
    "result": {
        "job": {
            "blob": "blob hex",
            "target": "target hex",
            "job_id": "job id"
        },
        "id": "login-id",
        "status": "OK"
    },
    "id":1
}

{
    "method":"submit",
    "params": {
        "id": "login-id",
        "job_id": "job-id",
        "nonce": "deadbeef",
        "result": "hash hex"
    },
    "id":1
}

{
    "result": {
        "status": "OK"
    }
    "id":1
}

{
    "method": "job",
    "params": {
        "blob": "blob hex",
        "target": "target hex",
        "job_id": "job id"
    },
    "id":1
}

The sensible way to get the exact payloads is to run a network capture while mining to a pool.

As for connection to the pool, this is done using a raw TCP socket to the pools address and port. Every payload is a single line of the whole JSON payload string ending with a linefeed character (\n).

Once connected with your socket, you first send the login payload. The pool will respond with the job result payload (or error). Mine the blob and send the pool a submit payload.

The pool at any time may send you method job payload. You should finish mining any existing job and then use that new job.

I have thrown together a fully working example of both a Python pool miner and a solo miner for you here.

2
  • Hey, thanks. I saw your miner, but i tried it and it was spitting out invalid shares. Maybe because monero is using cn v9 not v2? Feb 7, 2019 at 15:21
  • It works flawlessly using the default setup. Further, as I explained in another answer to one of your questions, v9 refers to the hard-fork version, not CN version.
    – jtgrassie
    Feb 7, 2019 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.