跳到主要内容

Persistent States

Nodes store snapshots of states of the blockchain periodically. Each state is created at some masterchain block and has some TTL. The block and TTL are chosen using the following algorithm:

Only key blocks can be chosen. A block has some timestamp ts. There are periods of time of length 2^17 seconds (approximately up to 1.5 days). The period of a block with timestamp ts is x = floor(ts / 2^17). The first key block from each period is chosen to create a persistent state.

TTL of a state from period x is equal to 2^(18 + ctz(x)), where ctz(x) is the number of trailing zeroes in the binary representation of x (i.e. the largest y such that x is divisible by 2^y).

That means that persistent states are created every 1.5 days, half of them have TTL of 2^18 seconds (3 days), half of the remaining states have TTL of 2^19 seconds (6 days) and so on.

In 2024 there is the following long-term (at least 3 months) persistent states:

Block seqnoBlock timeTTLExpires at
89307062021-01-14 15:08:4012427 days2055-01-24 08:45:44
277470862023-03-02 05:08:111553 days2027-06-02 19:50:19
326383872023-09-12 09:27:36388 days2024-10-04 18:08:08
348359532023-12-18 11:37:48194 days2024-06-29 15:58:04
358930702024-02-05 00:42:5097 days2024-05-12 02:52:58
369076472024-03-24 13:47:57776 days2026-05-10 07:09:01

When the node starts for the first time, it has to download a persistent state. This is implemented in validator/manager-init.cpp.

Starting from the init block, the node downloads all newer key blocks. It selects the most recent key block with a persistent state which still exists (using the formula above), and then downloads the corresponding masterchain state and states for all shards (or only the shards that are required for this node).