Merkleroot? How do I generate that?

I’m trying to get my head around this but all I’ve got is a good idea of what an aneurysm would feel like.

I’m trying to figure out how to generate the merkleroot from getblocktemplate but everything I’ve seen so far is bitcoin based & its not helping.

Can anyone point me at the appropriate place?

1 Like

I think mining.notify is where that is


Yup, that’s where I am, but at the server end of things rather than the miner.

The merkleroot is a hash of the transactions (hashed with what?) and some extra detail from getblocktemplate like the coinbase, etc. Trying to generate it rather than mine with it.

1 Like

Maybe this


I’ve been working from that & its useful, but the juicy bits I need are not there - sure there’s a recipe for ‘merkleroot soup’ somewhere.

Maybe fn() is in one of these curcuit or maybe in the incrementalmerkles (in the 2nd theres a merklepath fn) (im sorry for the goose chase, this is current)


It’s funny cuz looking at it I actually kind of understand it a little because it’s in Rust!
I’ll look through it more tomorrow

Found a vague reference to recursively hashing the transactions ids in the block template with SHA-256 to get part of the merkleroot, not sure if that’s even relevant to Zcash but will give it a try.

There’s other stuff that has to be appended to the tx hash, guessing that follows the BTC method so at least I have a starting point.

Amazing lack of information out there (maybe my ‘google-fu’ is lacking), getting detail on mining/miners is like trying to research state secrets.

1 Like

This migjt help, slide 14 describes the Merkle root as taking in the note commitment and authentication path (ya know a generalized description)


Slides from Sean Bowes presentation at Zcon0


I remember vaguely of one where zooko describe the circuit but I can’t remember exactly

Pretty sure its here
http://zerocash-project.org/media/pdf/zerocash-extended-20140518.pdf

Found useful stuff in the protocol spec, section 7.5
https://github.com/zcash/zips/blob/master/protocol/protocol.pdf

1 Like