1

There are several mining pool servers.

Each server polls monerod for a new job.

I want to generate a unique job on each server for all the workers of my distributed pool.

It is very important to note that I want to generate unique among all my servers.

What is the simplest to do this?

Would it be the simplest way to use an algorithm similar to this algorithm from the sources of mining pool implementation? (and the question of uniqueness interests me the most)

  1. Generate a server ID (4 bytes).
  2. Use extra nonce integer (4 bytes).
  3. And put this (1, 2) as extra data of miner’s transaction.
  4. Regenerate hashing blob by using parse_and_validate_block_from_blob and get_block_hashing_blob functions.
1

Every Monero pool I know of (including the pool you linked), reserves 32 bytes in the block template for the purposes of dealing with job uniqueness, which is laid out something like:

job_nonce | instance_nonce | pool_nonce | worker_nonce

Here, job_nonce would be unique to the job, instance_nonce unique to the server and lastly pool_nonce and worker_nonce is space a mining proxy can use.

Thus each server, as you correctly observe, needs to use a unique instance_nonce (per the example above). It doesn't matter what it is, but it needs to be unique. The simplest way of achieving this is to read 4 random bytes. This can be read from /dev/random or /dev/urandom, or anything which sources random data (such as a UUID). Alternatively you could set an instance ID via a pool config file, removing the need to create a random ID, but you'd have to make sure each pool was configured with it's own unique ID.

If you don't need to support proxies, you don't need to reserve the space for the proxy related nonces.

What is the simplest to do this?

Simplest is probably reading 4 bytes from /dev/random.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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