[{"data":1,"prerenderedAt":278},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fcore-tech\u002Fnode-initial-synchronization-(deprecated)":3,"docs-surround-\u002Fdocs\u002Fcore-tech\u002Fnode-initial-synchronization-(deprecated)":268},{"id":4,"title":5,"body":6,"description":259,"extension":260,"image":261,"meta":262,"navTitle":261,"navigation":263,"path":264,"seo":265,"stem":266,"__hash__":267},"docs\u002Fdocs\u002Fcore-tech\u002FNode-initial-synchronization-(DEPRECATED).md","-- DEPRECATED --",{"type":7,"value":8,"toc":250},"minimark",[9,13,26,29,56,66,95,100,106,117,120,150,154,157,171,184,187,193,196,199,207,211,217,244],[10,11,5],"h1",{"id":12},"deprecated",[14,15,16,17,21,22,25],"p",{},"BEAM Node initially operates in ",[18,19,20],"strong",{},"Sync"," mode, then eventually it switches to the ",[18,23,24],{},"Standard"," mode.",[14,27,28],{},"Initial state selection is performed according to the following logic:",[30,31,32,39,50],"ul",{},[33,34,35,36,38],"li",{},"If the current blockchain tip is non-empty, i.e. contains at least the genesis block ",[18,37,24],{}," mode is selected.",[33,40,41,42,46,47,49],{},"If there is a ",[43,44,45],"em",{},"Treasury"," block(s) defined - the Node is supposed to create the genesis block. It switches to the ",[18,48,24],{}," mode, mines the genesis block(s), and eventually broadcasts it to the network.",[33,51,52,53,55],{},"Otherwise ",[18,54,20],{}," mode is activated.",[14,57,58,59,61,62,65],{},"The goal of the ",[18,60,20],{}," mode is to allow the fast-Sync via ",[43,63,64],{},"Macroblock"," whenever possible. It consists of three phases.",[67,68,69,78,87],"ol",{},[33,70,71,74,75,77],{},[43,72,73],{},"Detection phase",". Node analyzes its peers, and selects the most suitable ",[43,76,64],{}," to download.",[33,79,80,83,84,86],{},[43,81,82],{},"Download phase",". Node downloads the ",[43,85,64],{}," (by portions), from one or several peers.",[33,88,89,92,93,25],{},[43,90,91],{},"Import phase",". Once fully downloaded - the Node uses it to import, and then switches to the ",[18,94,24],{},[96,97,99],"h3",{"id":98},"synchronization-via-macroblock","Synchronization via Macroblock",[14,101,102,103,105],{},"The ",[43,104,64],{}," is a \"compressed\" blockchain history, which includes the following:",[67,107,108,111,114],{},[33,109,110],{},"All the block headers, with PoW.",[33,112,113],{},"All the transaction kernels.",[33,115,116],{},"The unspent UTXO set.",[14,118,119],{},"In contrast to the original blocks the macroblock doesn't contain any info about spent UTXOs. Once downloaded, the Node verifies the following:",[67,121,122,125,136],{},[33,123,124],{},"All the headers are valid (sane, have valid PoW, form a valid blockchain)",[33,126,127,128],{},"All the original kernels are included in the macroblock\n",[30,129,130,133],{},[33,131,132],{},"This is done by verifying groups of kernels corresponding to a specific block w.r.t. kernel commitment in the appropriate header.",[33,134,135],{},"This proves that all the original transactions are included.",[33,137,138,139],{},"The resulting state of the system is valid:\n",[30,140,141,144,147],{},[33,142,143],{},"Unspent UTXOs with all the kernels form a valid transformation from the genesis to the asserted height.",[33,145,146],{},"The overall value equals what it should be according to the emission schedule.",[33,148,149],{},"Recent coinbase UTXOs are time-locked, according to the system rules.",[151,152,73],"h2",{"id":153},"detection-phase",[14,155,156],{},"For each peer with non-empty tip the Node requests the following:",[30,158,159,165],{},[33,160,161,164],{},[43,162,163],{},"Chainwork proof"," (to ensure the credibility of the reported tip)",[33,166,167,168,170],{},"Information about the most recently generated ",[43,169,64],{}," (its State ID).",[14,172,173,174,177,178,180,181,183],{},"This continues until either enough such peers are examined, or the timeout expires (since the first suitable peer was found). The macroblock of the peer with the highest ",[43,175,176],{},"Chainwork"," is selected.\nIf there is no macroblock to download (which is typically the case until blockchain height is low) - the Node switches to the ",[18,179,24],{}," mode, otherwise the ",[43,182,82],{}," is activated.",[151,185,82],{"id":186},"download-phase",[14,188,189,190,192],{},"During this phase the ",[43,191,64],{}," is downloaded by portions. Each time it gets a portion - the next portion is requested from the same peer. In case the peer goes down or has no macroblock for upload - another peer is selected.",[14,194,195],{},"In case of shutdown\u002Frestart - the Node will continue the download from where it stopped.",[151,197,91],{"id":198},"import-phase",[14,200,201,202,204,205,25],{},"The Node performs the import from the downloaded ",[43,203,64],{},", and then switches to the ",[18,206,24],{},[10,208,210],{"id":209},"notes","Notes",[14,212,213,214,216],{},"In case something goes wrong during the ",[18,215,20],{}," mode - there is no automatic retry\u002Frestart. User intervention is required. Whereas in typical scenarios problems are unlikely, possible abnormal cases are:",[30,218,219,228,241],{},[33,220,221,222,224,225,227],{},"No Macroblock detected. Can happen if the peer with the highest (proven) chainwork reports than it has no ",[43,223,64],{},". In this case Node goes straight to the ",[18,226,24],{}," mode to sync, which is slower, and may not succeed in case old original blocks are already deleted in all peers.",[33,229,230,231,233,234,237,238,240],{},"Macroblock download stuck: Node attempts to download a ",[43,232,64],{}," which no more exists in any of its peers. Can happen if the download takes insanely long, and during this time all the peers generated many newer ",[43,235,236],{},"Macroblocks",". Typically each node keeps several most recently-generated ",[43,239,236],{}," (7 by default), and eventually deletes older ones.",[33,242,243],{},"Macroblock import error (data corruped, inconsistent state). Most probably the result of DoS attack,  or less probably - some bug or the storage corruption.",[14,245,246,247,249],{},"In case of an error it's possible to reset the Node state, and retry the synchronization. Or, alternatively, the most recent ",[43,248,64],{}," may be downloaded manually, and given to the Node for explicit initialization",{"title":251,"searchDepth":252,"depth":252,"links":253},"",2,[254,256,257,258],{"id":98,"depth":255,"text":99},3,{"id":153,"depth":252,"text":73},{"id":186,"depth":252,"text":82},{"id":198,"depth":252,"text":91},"BEAM Node initially operates in Sync mode, then eventually it switches to the Standard mode.","md",null,{},true,"\u002Fdocs\u002Fcore-tech\u002Fnode-initial-synchronization-(deprecated)",{"title":5,"description":259},"docs\u002Fcore-tech\u002FNode-initial-synchronization-(DEPRECATED)","tsL2JOip5-K9T8_Hcd1FW8vF8VEMXB_n7gZw7IcUYyM",[269,273],{"title":270,"path":271,"stem":272,"description":251,"children":-1},"Beam Fierce Fermion 6.0 Upgrade Guide for pools and exchanges","\u002Fdocs\u002Fcore-tech\u002Fnew-address-types-support","docs\u002Fcore-tech\u002FNew-address-types-support",{"title":274,"path":275,"stem":276,"description":277,"children":-1},"Node Standard Operation Mode","\u002Fdocs\u002Fcore-tech\u002Fnode-standard-operation-mode","docs\u002Fcore-tech\u002FNode-standard-operation-mode","According to the protocol Node advertises its tip (header) to all the connected peers, which may potentially be interested in it. Potentially interested means the following:",1783006076737]