The best way to understand how something works is to get your hands dirty.
With this in mind, I’ve started developing a cryptocurrency miner.
I’m implementing the part that allows me to communicate with the mining pool (via the Stratum protocol) and I’m already running into a problem with the mining.notify method parameters (from which I’m supposed to create a job).
Based on several Stratum protocol docs I’ve found here and there, I’m supposed to have 9 parameters detailed as follows:
The params contain 9 items:
[0] Job_ID - The 32-bit job ID.
[1] PrevHash - The previous block hash.
[2] Coinbase1 - The first part of the coinbase.
[3] Coinbase2 - The final part of the coinbase.
[4] MerkleBranch - Array of hashes to be used to calculate merkle root.
[5] Version - Block version.
[6] Bits - Encoded current network difficulty.
[7] Time - Current nTime.
[8] CleanJobs - True to invalidate all previous jobs due to a new block. False indicates the job is part of the same block as previous job. Previous jobs in same block are still valid.
However, on the few pools I’ve tested, I don’t get the same parameters, and not at all in the right order (the Boolean, which I think corresponds to CleanJobs, is in the middle of the others)…
A few examples of what I get:
{
"id": null,
"method": "mining.notify",
"params": [
"957",
"30df0ea4f2e07d339bb378054e33dfab5091ae436297ed8142a0a9b247dda45b",
"05bdd2c084d534ca95b954a616e56c8a126ba4a1e77257bf1c3ce22d8ccc5769",
"00000009fff60000000000000000000000000000000000000000000000000000",
true,
458890,
"1b06d58a"
]
}
or
{
"id": null,
"method": "mining.notify",
"params": [
"770450403241227",
"04000000",
"6c77ff9d95248417d8bfa134cc540e97dd1037bb7c2ecb36d3e007fd0b000000",
"eaa8f2941f909df0283e607d932cfe6c67ba861cdc7898434065e00a4594d597",
"d9988e7adc9c6da15d12246eeb18623d1f8039f5ee6bcae29261e383248d7522",
"637e3a65",
"81a10e1d",
true,
"125_4",
"ZelProof"
]
}
The mining pools I tested (different algorithms):
- kawpow.eu.mine.zergpool.com
- de.etc.herominers.com
- zel.2miners.com
My question is a simple one: are there several implementations of the Stratum protocol, depending on the algorithms involved, in which case how do I find these documentations (I’ve scoured the net, and I always come across the same thing)?