2

I am trying to use stratum to do pool mining.

https://en.bitcoin.it/wiki/Stratum_mining_protocol#mining.notify

Here, for multiple cases, we have List of Merkle branches to be empty. I am confused in calculating the Merkle Tree Root and would appreciate some insight on how to proceed from here.

For example, I have the following mining.notify request with no Merkle Tree Branches.

{ params:
   [ '0000002548928482',
     '204cb62c9bb6e4b6f5009a84fd795402bc1ebb8b1b7d4569aa0e0c2ec1ce97fb',
     '0100000021403b5b010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03294e230422403b5b08',
     '7a706f6f6c2e636100000000000180ea822b000000002321026a4dab2feb92c30910f6cd20ef98babaf43ef3787cb6868b848b53d0133aa147ac00000000',
     [],
     '00000804',
     '1b010707',
     '5b3b4021',
     true ],
  id: null,
  method: 'mining.notify' }

I am using the NiceHash CryptoNight Pool.

EDIT 1:

My goal is to construct the mining blob from the given information.

I have seen this, How to Generate a Blob for PoW Hashing and am facing issues with tree_root_hash = compute_merkle_tree_root_hash(transaction_ids)

EDIT 2:

To my understanding from here, https://bitcoin.stackexchange.com/questions/22929/full-example-data-for-scrypt-stratum-client

I apply keccak 256 to coinbase = coinb1 + extranonce1 + extranonce2 + coinb2 to get hash

Followed by,

for each Merkle_branch
    byte = hash + merkle_branch
    hash = keccak256(byte)
end

to get the Merkle Tree Root Hash, is this correct?

1

If the transaction pool is empty, a mined block will still have 1 transaction (the miner's transaction claiming the block reward).

So to compute the Merkle tree root, you call the tree hashing function on the single hash of the miner transaction, which is in fact equivalent to doing nothing (Merkle tree root = miner transaction id).

|improve this answer|||||
  • Thanks for your answer. While I think I understand conceptually, I still have some implementation issues. I've added an example, here would I call the tree hashing function on Generation transaction (Part 1 concatenated with Part 2) to generate the Merkle tree root? – Cheran Senthil Jul 3 '18 at 9:47

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.