I am trying to program my own miner using a node.js server (this is for learning/exploration, not profitability).

I am subscribed to a monero pool socket and am receiving jobs like this:

{ jsonrpc: '2.0',
  method: 'job',
   { blocktemplate_blob: '07078286e9da05f1...',
     difficulty: 51779148158,
     height: 1625346,
     reserved_offset: 128,
     client_nonce_offset: 140,
     client_pool_offset: 136,
     target_diff: 5000,
     job_id: 'gJrlffjmKa7b/thYkVFuioukLzf/',
     id: '294f72b5-638f-4915-90ae-67db09dd4212' } }

I am trying to understand the next steps from here. My understanding is that I hash the blob + nonce (which is a random number?), see if the hash is below difficulty, and repeat with different nonces.

I have a few questions about this.

  1. Is there a programmatic example of this being done? I found a function called processShare here where they verify if a resultHash is correct. But with all their classes, buffers, threads, etc its hard to actually understand what's happening.
  2. Is documentation on the returned variables anywhere? What is hieght? I think I understand difficulty, but target_diff ?
  3. Is there perhaps an example blob, nonce, and difficulty for a successful share that I can test with?

Realize I'm asking for a lot of info here. If you can help me out, feel free to PM me and I'd be happy to donate to your wallet.

1 Answer 1


Firstly it looks like the job you have is for a mining proxy, not a miner.

A miner hashes a blockhashing_blob. To get a block hashing blob (which answers point #1) you have to update the blocktemplate_blob (after converting the hex to binary) with the data you want in the reserved space (at offset reserved_offset), then get a hashing blob (which in the monero codebase you can use get_block_hashing_blob - which is what the pool uses in one of it's node modules). Hash the hashing blob by incrementing the nonce in the hashhing blob until your hash is below the target difficulty (note also the target difficulty needs a conversion like target = 0xFFFFFFFFFFFFFFFFULL / (0xFFFFFFFFULL / ((uint64_t)target)). This is all a little redundant though because a pool will give you a hashing blob when the client is a miner, not a proxy.

Point #2 height is the blocks height, target_diff is the target difficulty. The miner is expected to find a hash to this target.

Point #3 just connect to any pool with an existing miner whilst doing a network trace.

  • Appreciate your help. Send me an email if you're interested in potential work
    – kmoney12
    Commented Jul 27, 2018 at 17:22

Your Answer

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

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