Post
Topic
Board Development & Technical Discussion
Re: Generate coinbase from to send to miner (ckpool source code question)
by
nQuant
on 08/02/2018, 00:33:22 UTC
Thanks, Below is the request received from pool, so if you check first header above which looks like big endian has previous hash as is.
It is not big endian.

I do not think that this is exactly what your miner received from the pool. I think what you are seeing is based on an internal representation of the data which makes it appear to be different than what it actually is.

So bloc header has previous hash flipped in 32 bit chunk ?
That is what is being displayed, but that is not what it actually has to be in the block header.

But as per documentation it doesn't say so.
Because your miner is displaying that information incorrectly.

prev_hash: da780ff935f3917ed99a7b616cb98ebb3104b3fa000b7acd0000000000000000
The correct block hash is f90f78da7e91f335617b9ad9bb8eb96cfab30431cd7a0b000000000000000000. You will notice that if you byteswap this so that it is actually in big endian, the block hash becomes 0000000000000000000b7acd3104b3fa6cb98ebbd99a7b6135f3917eda780ff9 which is an actual block that you look up on a block explorer or node. Looking up what your miner is displaying in both its original form and byteswapped form results in not being able to find such a block.

Strange, I can confirm its not cgminer.. I connected to ckpool using tcp socket and raw received message has flipped previous hash
as 6daed056abb0d17f362455ec230dd738ca958301001084f40000000000000000
It should be 56d0ae6d7fd1b0abec55243638d70d23018395caf48410000000000000000000

This better should be reviewed with ck I guess on whats going on Smiley
Alright for now I'm ignoring what cgminer/ckpool doing since its making me crazy. I'm able to prepare correct coinbase now and its decodes properly. Thanks to you Smiley

Last questions:

1. Transaction ids received from GBT should be reversed byte-wise or used as is to calculate markel ?
2. Considering the is no transaction so sha256d of coinbase becomes the markel and 2xhash output of coinbase should be used as is in block header or it should flipped byte-wise ?
ex: 2xSha256 of below coinbase

01000000010000000000000000000000000000000000000000000000000000000000000000fffff fff2c03dc851300043c487b5a0c5a7b47ff0100000000000000066e5175616e740d2f6e5175616e 742e706f6f6c2fffffffff026fe2ab04000000001976a9144ab4b2aa35879fe47e6a16ea783494f 9dcf615b788ac0000000000000000266a24aa21a9ed60af3e8651f28353ad47a0664c3892b67d82 0d3828af0c5dc854fc2e0bec44d200000000

= 5cb15257b783b9a4c12d1425ad80985a9d43ee474019d5026d04a0e80090f32b

So block header should use it as is or it should be flipped ?

0000002062be1e317f0dce1aa3fcf2b3bf9d604e2b20e853a7575ba03e0d0000000000005cb15257b783b9a4c12d1425ad80985a9d43ee474019d5026d04a0e80090f32b898e7b5aaddc001b00000000

3. Submitblock param = block header + (number of transactions + 1 for coinbase) + coinbase + All the transaction data field received from GBT . Is this correct ?