You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/guides/state-sync.md
+82-51
Original file line number
Diff line number
Diff line change
@@ -5,41 +5,81 @@ title: "State Synchronization"
5
5
import ThemedImage from '@theme/ThemedImage';
6
6
import useBaseUrl from '@docusaurus/useBaseUrl';
7
7
8
-
Nodes in an Aptos network (e.g., validator nodes and fullnodes) must always be synchronized to the latest Aptos blockchain state. The [state synchronization](https://medium.com/aptoslabs/the-evolution-of-state-sync-the-path-to-100k-transactions-per-second-with-sub-second-latency-at-52e25a2c6f10) (state sync) component that runs on each node is responsible for this. State sync identifies and fetches new blockchain data from the peers, validates the data and persists it to the local storage.
8
+
Nodes in an Aptos network must always be synchronized to the latest Aptos blockchain state, e.g., validators, validator
9
+
fullnodes (VFNs) and public fullnodes (PFNs). The [state synchronization](https://medium.com/aptoslabs/the-evolution-of-state-sync-the-path-to-100k-transactions-per-second-with-sub-second-latency-at-52e25a2c6f10) (state sync) component that runs on each
10
+
node is responsible for this. State sync identifies and fetches new blockchain data from the peers, validates the data
11
+
and persists it to local storage.
9
12
10
13
:::tip Need to start a node quickly?
11
-
If you need to start a node quickly, here's what we recommend by use case:
14
+
If you need to start a node quickly, here's what we recommend (by use case):
12
15
13
-
-**Devnet public fullnode**: To sync the entire blockchain history, use [intelligent syncing](state-sync.md#intelligent-syncing). Otherwise, use [fast sync](state-sync.md#fast-syncing).
14
-
-**Testnet public fullnode**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, download [a snapshot](../nodes/full-node/bootstrap-fullnode.md) or use [fast sync](state-sync.md#fast-syncing).
15
-
-**Mainnet public fullnode**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, use [fast sync](state-sync.md#fast-syncing).
16
-
-**Mainnet validator or validator fullnode**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, use [fast sync](state-sync.md#fast-syncing).
16
+
-**Devnet PFN**: To sync the entire blockchain history, use [intelligent syncing](state-sync.md#intelligent-syncing). Otherwise, use [fast sync](state-sync.md#fast-syncing).
17
+
-**Testnet PFN**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, download [a snapshot](../nodes/full-node/bootstrap-fullnode.md) or use [fast sync](state-sync.md#fast-syncing).
18
+
-**Mainnet PFN**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, use [fast sync](state-sync.md#fast-syncing).
19
+
-**Mainnet validator or VFN**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, use [fast sync](state-sync.md#fast-syncing).
17
20
:::
18
21
19
-
## State sync modes
20
-
21
-
State sync runs in two modes. All nodes will first bootstrap (in bootstrapping mode) on startup, and then continuously synchronize (in continuous sync mode).
22
-
23
-
### Bootstrapping mode
22
+
## State sync phases
23
+
24
+
State sync runs in two phases. All nodes will first bootstrap on startup (in the **bootstrapping phase**), and then
25
+
continuously synchronize (in the **continuous syncing phase**).
26
+
27
+
### Bootstrapping phase
28
+
29
+
When the node starts, state sync will perform bootstrapping by using the configured bootstrapping mode. This allows the
30
+
node to catch up to the latest state in the Aptos blockchain. There are several bootstrapping modes:
31
+
32
+
-**Execute all the transactions since genesis**. In this mode, the node will retrieve from the Aptos network all the
33
+
transactions since genesis, i.e., since the start of the blockchain's history, and re-execute those transactions.
34
+
Naturally, this mode takes the longest amount of time because it must process all transactions since the network began.
35
+
-**Apply transaction outputs since genesis**. In this mode, the node will retrieve all the transactions since genesis,
36
+
but it will skip transaction re-execution and instead apply the outputs of the transactions that were previously
37
+
produced by validator execution. This mode reduces the amount of CPU time required, but still processes all transactions
38
+
since the network began.
39
+
-**Intelligent syncing since genesis**. In this mode, the node will retrieve all the transactions
40
+
since genesis and will either execute the transactions, or apply the transaction outputs, depending on whichever is
41
+
faster, per data chunk. This allows the node to adapt to CPU and network resource constraints more efficiently.
42
+
This mode is the default mode for devnet and other testing environments.
43
+
-**Fast syncing**. In this mode, the node will skip the transaction history in the blockchain and will download only
44
+
the latest blockchain state directly. As a result, the node will not have the historical transaction data, but it will
45
+
be able to catch up to the Aptos network much more rapidly. This mode is the default mode for testnet and mainnet.
46
+
47
+
:::tip Bootstrapping defaults?
48
+
The default bootstrapping mode depends on the network type:
49
+
50
+
-**Testnet and Mainnet**: The default bootstrapping mode is fast sync, because these networks are long-lived
51
+
and have a large amount of historical data.
52
+
-**Devnet and other networks**: The default bootstrapping mode is intelligent syncing, because these networks are
53
+
typically short-lived and have a small amount of historical data.
54
+
:::
24
55
25
-
When the node starts, state sync will perform bootstrapping by using the specified bootstrapping mode configuration. This allows the node to catch up to the Aptos blockchain. There are several bootstrapping modes:
56
+
### Continuous syncing phase
26
57
27
-
-**Execute all the transactions since genesis**. In this state sync mode the node will retrieve from the Aptos network all the transactions since genesis, i.e., since the start of the blockchain's history, and re-execute those transactions. Naturally, this synchronization mode takes the longest amount of time.
28
-
-**Apply transaction outputs since genesis**. In this state sync mode the node will retrieve all the transactions since genesis, but it will skip the transaction execution and will only apply the outputs of the transactions that were previously produced by validator execution. This mode reduces the amount of CPU time required.
29
-
-**(Default) Intelligent syncing since genesis**. In this state sync mode the node will retrieve all the transactions since genesis and will either execute the transactions, or apply the transaction outputs, depending on whichever is faster, per data chunk. This allows the node to adapt to CPU and network resource constraints more efficiently. This mode is the default mode.
30
-
-**Fast syncing**. In this state sync mode the node will skip the transaction history in the blockchain and will download only the latest blockchain state directly. As a result, the node will not have the historical transaction data, but it will be able to catch up to the Aptos network much more rapidly.
58
+
After the node has bootstrapped and caught up to the Aptos network initially, state sync will then move into
59
+
the continuous syncing phase to stay up-to-date with the blockchain. There are several continuous syncing modes:
31
60
32
-
### Continuous syncing mode
61
+
-**Executing transactions**. This mode will keep the node up-to-date by executing new transactions as they are
62
+
committed to the blockchain.
63
+
-**Applying transaction outputs**. This mode will keep the node up-to-date by skipping the transaction execution
64
+
and only applying the outputs of the transactions as previously produced by validator execution.
65
+
-**Intelligent syncing**. This mode will keep the node up-to-date by either executing the transactions, or applying
66
+
the transaction outputs, depending on whichever is faster, per data chunk. This allows the node to adapt to CPU and
67
+
network resource constraints more efficiently. This is the default mode for all environments.
33
68
34
-
After the node has bootstrapped and caught up to the Aptos network initially, state sync will then move into continuous syncing mode to stay up-to-date with the blockchain. There are several continuous syncing modes:
69
+
:::tip Continuous syncing defaults?
70
+
The default continuous syncing mode is always intelligent syncing, because this mode is the most performant.
71
+
:::
35
72
36
-
-**Executing transactions**. This state sync mode will keep the node up-to-date by executing new transactions as they are committed to the blockchain.
37
-
-**Applying transaction outputs**. This state sync mode will keep the node up-to-date by skipping the transaction execution and only applying the outputs of the transactions as previously produced by validator execution.
38
-
-**(Default) Intelligent syncing**. This state sync mode will keep the node up-to-date by either executing the transactions, or applying the transaction outputs, depending on whichever is faster, per data chunk. This allows the node to adapt to CPU and network resource constraints more efficiently. This mode is the default mode.
73
+
## Configuring state sync
39
74
40
-
## Configuring the state sync modes
75
+
The configuration snippets below provide instructions for configuring state sync on your nodes for different use cases.
76
+
These configurations can be added to your node's configuration file, e.g., `fullnode.yaml` or `validator.yaml`.
41
77
42
-
The below sections provide instructions for how to configure your node for different use cases.
78
+
:::danger Manual configuration
79
+
State sync is tuned to automatically select the best mode for your node, depending on the network.
80
+
Be aware that if you manually configure your node to use a different mode, it may not be the most
81
+
optimal, and you could experience slower syncing times and degraded performance.
0 commit comments