github.com/number571/tendermint@v0.34.11-gost/docs/tendermint-core/fast-sync.md (about) 1 --- 2 order: 10 3 --- 4 5 # Fast Sync 6 7 In a proof of work blockchain, syncing with the chain is the same 8 process as staying up-to-date with the consensus: download blocks, and 9 look for the one with the most total work. In proof-of-stake, the 10 consensus process is more complex, as it involves rounds of 11 communication between the nodes to determine what block should be 12 committed next. Using this process to sync up with the blockchain from 13 scratch can take a very long time. It's much faster to just download 14 blocks and check the merkle tree of validators than to run the real-time 15 consensus gossip protocol. 16 17 ## Using Fast Sync 18 19 To support faster syncing, Tendermint offers a `fast-sync` mode, which 20 is enabled by default, and can be toggled in the `config.toml` or via 21 `--fast_sync=false`. 22 23 In this mode, the Tendermint daemon will sync hundreds of times faster 24 than if it used the real-time consensus process. Once caught up, the 25 daemon will switch out of fast sync and into the normal consensus mode. 26 After running for some time, the node is considered `caught up` if it 27 has at least one peer and it's height is at least as high as the max 28 reported peer height. See [the IsCaughtUp 29 method](https://github.com/number571/tendermint/blob/b467515719e686e4678e6da4e102f32a491b85a0/blockchain/pool.go#L128). 30 31 Note: There are three versions of fast sync. We recommend using v0 as v2 is still in beta. 32 If you would like to use a different version you can do so by changing the version in the `config.toml`: 33 34 ```toml 35 ####################################################### 36 ### Fast Sync Configuration Connections ### 37 ####################################################### 38 [fastsync] 39 40 # Fast Sync version to use: 41 # 1) "v0" (default) - the legacy fast sync implementation 42 # 2) "v2" - complete redesign of v0, optimized for testability & readability 43 version = "v0" 44 ``` 45 46 If we're lagging sufficiently, we should go back to fast syncing, but 47 this is an [open issue](https://github.com/number571/tendermint/issues/129). 48 49 ## The Fast Sync event 50 When the tendermint blockchain core launches, it might switch to the `fast-sync` 51 mode to catch up the states to the current network best height. the core will emits 52 a fast-sync event to expose the current status and the sync height. Once it catched 53 the network best height, it will switches to the state sync mechanism and then emit 54 another event for exposing the fast-sync `complete` status and the state `height`. 55 56 The user can query the events by subscribing `EventQueryFastSyncStatus` 57 Please check [types](https://pkg.go.dev/github.com/number571/tendermint/types?utm_source=godoc#pkg-constants) for the details.