I'm developing a stratum mining client. I read on stratum v1 docs on braiins.com how mining work is done on the stratum protocol and that the coinbase is done by concatenating coinb1+extranonce1+extranonce2+coinb2. At the end, mining work is submitted by sending this JSON: {"params": ["<worker>", "<job_id>", "<extranonce2>", "<ntime>", "<nonce>"], "id": 4, "method": "mining.submit"}
.
It says that the extranonce2 value is generated by the miner but must be based on the extranonce2 size provided by the pool. The extranonce2_size im getting from the pool is: 4 (4 bytes). So an extranonce2 value of 00000001(in hex) can be valid.
However, when i'm trying to submit a random miner work to the pool(just testing) by throwing in random nonce and extraonce2(but of course using the current jobId and ntime provided by the response i got from the pool) i keep getting this error response: 20,incorrect size of extranonce2
.
The random extranonce2 i'm sending is '00000002' and random nonce is 'b2957c02'. Shouldn't i get a rejected share and not an incorrect extranonce2 size? I'm still new to this and don't yet understand exactly how everything works so where's my mistake here? or is it a pool problem? I know there's a lot of stuff to do before sending the miner work but here i'm trying to send a random miner work here.
btw is the request id always 4 in stratum for submitting work(or id: 'mining.submit')?
I'm authorizing the miner before submitting.