Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions how-to-guides/celestia-node-trusted-hash.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Celenium.

3. Set the trusted height & hash in your config file
1. Open your `config.toml` at `.celestia-light/config.toml` (or `.celestia-light-<other-network>/config.toml`)
2. Set `DASer.SampleFrom` to the trusted height (e.g. `SampleFrom = 123456`)
3. Set `Header.TrustedHash` to the trusted hash (e.g. `TrustedHash = "<hash_of_block_n>"`)
2. Set `Header.Syncer.SyncFromHeight` to the trusted height (e.g. `SyncFromHeight = 123456`)
3. Set `Header.Syncer.SyncFromHash` to the trusted hash (e.g. `SyncFromHash = "<hash_of_block_n>"`)
4. Run the node:

```sh
Expand All @@ -58,15 +58,15 @@ celestia light init --p2p.network mocha
# Get both the height and hash values in a single call
read -r TRUSTED_HEIGHT TRUSTED_HASH <<<"$(curl -s https://rpc-mocha.pops.one/header | jq -r '.result.header | "\(.height) \(.last_block_id.hash)"')" && export TRUSTED_HEIGHT TRUSTED_HASH

# Use sed to find and replace the SampleFrom value in the config file (macOS version)
sed -i '' "s/SampleFrom = .*/SampleFrom = $TRUSTED_HEIGHT/" ~/.celestia-light-mocha-4/config.toml
# Use sed to find and replace the SyncFromHeight value in the config file (macOS version)
sed -i '' "s/SyncFromHeight = .*/SyncFromHeight = $TRUSTED_HEIGHT/" ~/.celestia-light-mocha-4/config.toml

# Add/update the TrustedHash value
sed -i '' "s/TrustedHash = .*/TrustedHash = \"$TRUSTED_HASH\"/" ~/.celestia-light-mocha-4/config.toml
# Add/update the SyncFromHash value
sed -i '' "s/SyncFromHash = .*/SyncFromHash = \"$TRUSTED_HASH\"/" ~/.celestia-light-mocha-4/config.toml

# Display the updated values to confirm
echo "SampleFrom updated to: $TRUSTED_HEIGHT"
echo "TrustedHash updated to: $TRUSTED_HASH"
echo "SyncFromHeight updated to: $TRUSTED_HEIGHT"
echo "SyncFromHash updated to: $TRUSTED_HASH"
```

### 3. Start the node
Expand All @@ -79,12 +79,26 @@ celestia light start --p2p.network mocha --core.ip rpc-mocha.pops.one --core.por
For Linux users, remove the empty string (`''`) after `-i` in the `sed` commands:

```sh
sed -i "s/SampleFrom = .*/SampleFrom = $TRUSTED_HEIGHT/" ~/.celestia-light-mocha-4/config.toml
sed -i "s/TrustedHash = .*/TrustedHash = \"$TRUSTED_HASH\"/" ~/.celestia-light-mocha-4/config.toml
sed -i "s/SyncFromHeight = .*/SyncFromHeight = $TRUSTED_HEIGHT/" ~/.celestia-light-mocha-4/config.toml
sed -i "s/SyncFromHash = .*/SyncFromHash = \"$TRUSTED_HASH\"/" ~/.celestia-light-mocha-4/config.toml
```

:::

## Historical queries

::: warning
Default light nodes no longer support historical queries. By default, nodes maintain a sliding window of headers, bounded by Tail and Head headers. Requests with height below the Tail are rejected.

This is, however, temporary, and lazy header fetching will be available with Backward Sync.
:::

To retain the ability to request older queries with light nodes, use the new configuration fields to set an absolute header that the node will sync from:
- `Header.Syncer.SyncFromHeight`: Set the height from which the node will sync
- `Header.Syncer.SyncFromHash`: Set the hash from which the node will sync

By configuring these fields, your light node will maintain history from the specified height onward, allowing you to query historical data from that point.

## For service operators

If you're using multiple light nodes for similar services like tracking the same rollup,
Expand Down
4 changes: 2 additions & 2 deletions how-to-guides/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ Let's set the trusted hash!

1. Set the trusted height & hash
1. Open your `config.toml` at `~/.celestia-light-{{ constants.mochaChainId }}/config.toml`
1. Set `DASer.SampleFrom` to the trusted height (e.g. `SampleFrom = 123456`)
1. Set `Header.TrustedHash` to the trusted hash (e.g. `TrustedHash = "E8BD0C48260C496BB7A4D8D1E7BDBF1F26A2FE3CF5714DECE1741B2FFB3C095C"` )
1. Set `Header.Syncer.SyncFromHeight` to the trusted height (e.g. `SyncFromHeight = 123456`)
1. Set `Header.Syncer.SyncFromHash` to the trusted hash (e.g. `SyncFromHash = "E8BD0C48260C496BB7A4D8D1E7BDBF1F26A2FE3CF5714DECE1741B2FFB3C095C"` )
Comment on lines +87 to +88
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and to follow standard markdown list formatting, please use sequential numbering for list items. The items in this sub-list should be numbered 2. and 3. respectively.

Note that the parent list item on line 85 is also numbered 1. but should be 2.. This is outside the changed lines, so it's just a suggestion for a future change.

Suggested change
1. Set `Header.Syncer.SyncFromHeight` to the trusted height (e.g. `SyncFromHeight = 123456`)
1. Set `Header.Syncer.SyncFromHash` to the trusted hash (e.g. `SyncFromHash = "E8BD0C48260C496BB7A4D8D1E7BDBF1F26A2FE3CF5714DECE1741B2FFB3C095C"` )
2. Set `Header.Syncer.SyncFromHeight` to the trusted height (e.g. `SyncFromHeight = 123456`)
3. Set `Header.Syncer.SyncFromHash` to the trusted hash (e.g. `SyncFromHash = "E8BD0C48260C496BB7A4D8D1E7BDBF1F26A2FE3CF5714DECE1741B2FFB3C095C"` )


> If you don't do this, when trying to retrieve data in a few minutes, you'll see a response saying `"result": "header: syncing in progress: localHeadHeight: 94721, requestedHeight: 2983850"`. You'll either need to let the node sync to the `requestedHeight`, or use quick sync with trusted hash to do this.
> Learn more in [the trusted hash quick sync guide](/how-to-guides/celestia-node-trusted-hash.md).
Expand Down
Loading