github.com/badrootd/nibiru-cometbft@v0.37.5-0.20240307173500-2a75559eee9b/docs/core/state-sync.md (about)

     1  --- 
     2  order: 11
     3  ---
     4  
     5  # State Sync
     6  
     7  With block sync a node is downloading all of the data of an application from genesis and verifying it. 
     8  With state sync your node will download data related to the head or near the head of the chain and verify the data. 
     9  This leads to drastically shorter times for joining a network. 
    10  
    11  ## Using State Sync
    12  
    13  State sync will continuously work in the background to supply nodes with chunked data when bootstrapping.
    14  
    15  > NOTE: Before trying to use state sync, see if the application you are operating a node for supports it. 
    16  
    17  Under the state sync section in `config.toml` you will find multiple settings that need to be configured in order for your node to use state sync.
    18  
    19  Lets breakdown the settings:
    20  
    21  - `enable`: Enable is to inform the node that you will be using state sync to bootstrap your node.
    22  - `rpc_servers`: RPC servers are needed because state sync utilizes the light client for verification. 
    23      - 2 servers are required, more is always helpful. 
    24  - `temp_dir`: Temporary directory is store the chunks in the machines local storage, If nothing is set it will create a directory in `/tmp`
    25  
    26  The next information you will need to acquire it through publicly exposed RPC's or a block explorer which you trust. 
    27  
    28  - `trust_height`: Trusted height defines at which height your node should trust the chain.
    29  - `trust_hash`: Trusted hash is the hash in the `BlockID` corresponding to the trusted height.
    30  - `trust_period`: Trust period is the period in which headers can be verified. 
    31    > :warning: This value should be significantly smaller than the unbonding period.
    32  
    33  If you are relying on publicly exposed RPC's to get the need information, you can use `curl` and [`jq`][jq].
    34  
    35  Example: 
    36  
    37  ```bash
    38  curl -s https://233.123.0.140:26657/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
    39  ```
    40  
    41  The response will be: 
    42  
    43  ```json
    44  {
    45    "height": "273",
    46    "hash": "188F4F36CBCD2C91B57509BBF231C777E79B52EE3E0D90D06B1A25EB16E6E23D"
    47  }
    48  ```
    49  
    50  [jq]: https://jqlang.github.io/jq/