GithubHelp home page GithubHelp logo

the meaning of prev_root about docs HOT 7 OPEN

mimblewimble avatar mimblewimble commented on May 24, 2024
the meaning of prev_root

from docs.

Comments (7)

jackzhp avatar jackzhp commented on May 24, 2024

Then I found that 0000000000000000002a8bc32f43277fe9c063b9c99ea252b483941dcd06e217
is the block # of BTC at height 558653(15th Jan 2019 15:00:22)

while 00000000000000000017ff4903ef366c8f62e3151ba74e41b8332a126542f538 is the block # of BTC at height 555959(
28th Dec 2018 20:15:09)

Why Grin contains the info from BTC? very weird.

from docs.

tromp avatar tromp commented on May 24, 2024

Not that weird; it serves as proof that the Grin Genesis blocks were generated after those Bitcoin blocks were (similar to the Bitcoin genesis block containing the message “The Times 03/Jan/2009 Chancellor on brink of second bailout for banks”). This further allays possible fears that the chain could have been fast mined before the public.

from docs.

jackzhp avatar jackzhp commented on May 24, 2024

Thanks for responding to me.

OK. then does this really get into the MMR? it say prev_root.

suppose it does not get into the header MMR, then the first node of the header MMR is the blake2b(32) hash of
HeaderEntry(block#0 hash + timestamp + totalDifficult + secondary_scale + isSecondary).
ie. 40ADAD0AEC27797B48840AA9E00472015C21BAEA118CE7A2FF1A82C0F8F5BF82000000005C3E03D600000004000000000000074001 (*****)
and its hash_with_index 0(8 bytes): gives: A4E6257532125F637CED6F3A1D1BD0BDAAF0C77630337DEDC0C14BD3E88F0246

this does not match the block#1.prev_root 5671FB28C1509E422D9B8F60CE90E9AC9041E3B9FEBD34A79C03048844ED2733 (%%%%%)

suppose it(the BTC block hash) does not get into the header MMR, it's the first node, and the genesis block gives the 2nd node. blake2b(32) hash the (***** line) with index 1(the 2nd node), this gives: DC205D06D4358D797B8A03D02EB52DD792BD151B8C64F2D315D6489804109C91
And then the 3rd Node is C0B2622CF9DDD8B22821B1FFCC133AB5EDA5F85812C697C36CDF1370241F7DA8, still not expected (%%%%% line)

Anyone has any idea on this?
I guess I did not get (the ***** line) right, but this is specified in block.rs.

from docs.

tromp avatar tromp commented on May 24, 2024

the first node of the header MMR is the blake2b(32) hash of
HeaderEntry(block#0 hash + timestamp + totalDifficult + secondary_scale + isSecondary).

What do you mean by "block#0 hash"?
The HeaderEntry hash is set to the BlockHeader hash which is the Blake2b hash of the prepow header as defined in

https://github.com/mimblewimble/grin/blob/684f0a387ae1ac47e34e68aae2cf94514b86aaf4/core/src/core/block.rs#L322

from docs.

jackzhp avatar jackzhp commented on May 24, 2024

eventually, I found that for header MMR, to build the mountain, only the index + cuckoo_solution is hashed for those leaf nodes, now block#x.prev_root is indeed the root of the header MMR.

from docs.

jackzhp avatar jackzhp commented on May 24, 2024

And the BTC block hash does not get into the MMR.

from docs.

tromp avatar tromp commented on May 24, 2024

cuckoo_solution is hashed

Where in the code did you see this happening?

from docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.