[{"data":1,"prerenderedAt":126},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fcore-tech\u002Fdmmr-internal-layout":3,"docs-surround-\u002Fdocs\u002Fcore-tech\u002Fdmmr-internal-layout":115},{"id":4,"title":5,"body":6,"description":12,"extension":107,"image":108,"meta":109,"navTitle":108,"navigation":110,"path":111,"seo":112,"stem":113,"__hash__":114},"docs\u002Fdocs\u002Fcore-tech\u002FDMMR-internal-layout.md","DMMR Internal Layout",{"type":7,"value":8,"toc":104},"minimark",[9,13,21,47,50,61,64,67,70,101],[10,11,12],"p",{},"In Merkle trees there are leaf nodes that are added explicitly, and appropriate non-leaf nodes which are created on-demand.",[10,14,15,16,20],{},"Our DMMR consists of ",[17,18,19],"em",{},"Elements"," of variable size, whereas each new element internally contains all the supposed non-leaf nodes. Technically element consists of:",[22,23,24,28,44],"ol",{},[25,26,27],"li",{},"Hashes of the assumed non-leaf nodes",[25,29,30,33,34],{},[17,31,32],{},"Pointers"," to the elements that contain the siblings assumed by the above non-leaf nodes.\n",[35,36,37],"ul",{},[25,38,39,40,43],{},"By ",[17,41,42],{},"pointers"," we mean the information used to access the element, not necessarily the memory pointer.",[25,45,46],{},"A pointer to the last element of the previous MMR peak.",[10,48,49],{},"For example, consider and MMR containing 10 items:",[51,52,57],"pre",{"className":53,"code":55,"language":56},[54],"language-text","                         *\n                        \u002F \\\n                       \u002F   \\\n                      \u002F     \\\n                     \u002F       \\\n                    \u002F         \\\n                   \u002F           \\\n                  \u002F             \\\n                 \u002F               \\\n                \u002F                 \\\n               \u002F                   \\\n              \u002F                     \\\n             *                       *\n            \u002F \\                     \u002F \\\n           \u002F   \\                   \u002F   \\\n          \u002F     \\                 \u002F     \\\n         \u002F       \\               \u002F       \\\n        \u002F         \\             \u002F         \\\n       *           *           *           *           *\n      \u002F \\         \u002F \\         \u002F \\         \u002F \\         \u002F \\\n     \u002F   \\       \u002F   \\       \u002F   \\       \u002F   \\       \u002F   \\\n    0     1     2     3     4     5     6     7     8     9\n","text",[58,59,55],"code",{"__ignoreMap":60},"",[10,62,63],{},"In our DMMR this is represented by the following data:",[10,65,66],{},"[[\u002Fimages\u002Fdmmr1.png]]",[10,68,69],{},"There are 10 elements of varying size, denoted by different colors. Rectangles outline the data and the non-leaf hashes of which the elements comprise. Lines denote pointers to the parent elements. We see the following:",[35,71,72,75,78,94],{},[25,73,74],{},"Elements with odd index contain extra hashes, denoted by asterisk (*). The number of hashes equals to the height of the formed peak.",[25,76,77],{},"For every extra hash there is also a pointer to the last element of the appropriate sibling node.",[25,79,80,81],{},"Most of the elements in addition have a pointer to the last element of the previous MMR peak, denoted by a curly line.\n",[35,82,83,86],{},[25,84,85],{},"The exceptions are elements at position 0, 1, 3, 7, because they are last elements of the only peak.",[25,87,88,89,93],{},"This is obviously the property of elements at positions 2",[90,91,92],"sup",{},"n","-1.",[25,95,96,97,100],{},"The only element that contains no data is the 1",[90,98,99],{},"st",", at position 0.",[10,102,103],{},"It's easy to see that each element has access to all the parent elements and their datas. Hence it can be used as an effective MMR implementation with all the relevant functionality, such as calculating the root, and generating proofs.",{"title":60,"searchDepth":105,"depth":105,"links":106},2,[],"md",null,{},true,"\u002Fdocs\u002Fcore-tech\u002Fdmmr-internal-layout",{"description":12},"docs\u002Fcore-tech\u002FDMMR-internal-layout","99mIRX1rkHIyMr9agqh4gdEWTHpZ0877JiaGHFxy59c",[116,121],{"title":117,"path":118,"stem":119,"description":120,"children":-1},"Cryptographic Primitives","\u002Fdocs\u002Fcore-tech\u002Fcryptographic-primitives","docs\u002Fcore-tech\u002FCryptographic-primitives","Cryptographic primitives used by BEAM are based on the secp256k1 library (the one that is used in bitcoin). Naturally it uses the same elliptic curve equation. The following primitives are used directly:",{"title":122,"path":123,"stem":124,"description":125,"children":-1},"Ethash Verification In Contracts","\u002Fdocs\u002Fcore-tech\u002Fethash-verification-in-contracts","docs\u002Fcore-tech\u002FEthash-verification-in-contracts","To implement trustless bridges between Beam and other blockchains there's a need to verify the headers of the appropriate blockchains in the contract. For a PoW-based blockchain there's a need to verify the appropriate header PoW.",1783006064129]