Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Vinion on October 27, 2016, 07:58:31 PM



Title: How to generate Merkle Root ?
Post by: Vinion on October 27, 2016, 07:58:31 PM
Hello,

Is there any help/tutorial on how to build the merkle root from stratum data?

The slushpool's stratum protocol manual (https://f.com/help/#!/manual/stratum-protocol)
has an example of a mining job but it does not contain any merkle branches so I don't  really know if I generate the merkle root correctly.

This is the slushpool's mining notification string:
{"params": ["bf", "4d16b6f85af6e2198f44ae2a6de67f78487ae5611b77c6c0440b921e00000000",
"01000000010000000000000000000000000000000000000000000000000000000000000000fffff fff20020862062f503253482f04b8864e5008",
"072f736c7573682f000000000100f2052a010000001976a914d23fcdf86f7e756a64a7a9688ef99 03327048ed988ac00000000", [],
"00000002", "1c2ac4af", "504e86b9", false], "id": null, "method": "mining.notify"}



Thank you


Title: Re: How to generate Merkle Root ?
Post by: pepethefrog on November 03, 2016, 08:17:11 AM
You need to get a list of all transaction hashes that will go into your block.
You also need them in the specific order in which they will be placed.


Title: Re: How to generate Merkle Root ?
Post by: sugarfly on November 03, 2016, 09:51:25 AM
I agree with pepe,

does stratum allow you to query all tx hashes?
If yes, you can then very easily construct a merkle root.

-sf-