Post
Topic
Board Development & Technical Discussion
Re: Generate coinbase from to send to miner (ckpool source code question)
by
achow101
on 08/02/2018, 00:58:07 UTC
1. Transaction ids received from GBT should be reversed byte-wise or used as is to calculate markel ?
Things are only reversed for display to the user. On the protocol level, things are used as provided.

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
The sha256d of the coinbase will be the merkle root if there are no other transactions.

01000000010000000000000000000000000000000000000000000000000000000000000000fffff fff2c03dc851300043c487b5a0c5a7b47ff0100000000000000066e5175616e740d2f6e5175616e 742e706f6f6c2fffffffff026fe2ab04000000001976a9144ab4b2aa35879fe47e6a16ea783494f 9dcf615b788ac0000000000000000266a24aa21a9ed60af3e8651f28353ad47a0664c3892b67d82 0d3828af0c5dc854fc2e0bec44d200000000

= 5cb15257b783b9a4c12d1425ad80985a9d43ee474019d5026d04a0e80090f32b

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

0000002062be1e317f0dce1aa3fcf2b3bf9d604e2b20e853a7575ba03e0d0000000000005cb15257b783b9a4c12d1425ad80985a9d43ee474019d5026d04a0e80090f32b898e7b5aaddc001b00000000
As is. This is correct.

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