Product Docs
Product DocsTechnical DocsLearning & GovernanceUseful Links
  • Product Docs
  • Node Docs
  • Learning Docs
  • Node documentation for cheqd network
  • 👉Getting Started
    • Setup a new cheqd node
      • Pre-Requisites & Requirements
      • (Alternative) Install with Docker
      • Configure cosmovisor
    • Command Line usage
      • Manage keys
      • Manage accounts
      • Manage a node
      • Make transactions
      • Use fee abstraction
  • đŸĻValidator Guides
    • Guide for validators
      • FAQs for validators
      • Optimising disk storage with pruning
      • Troubleshooting consistently high CPU/memory loads
      • Unjailing a jailed validator
      • Move validator to a different machine
      • Backup and restore node keys with Hashicorp Vault
    • Network-wide Software Upgrades
      • Upgrade Guides
        • Upgrade to v0.6.x
        • Upgrade to v2.x (with Ubuntu 24.04 LTS upgrade)
        • Upgrade to v3.x
        • Upgrade to v3.1.x
      • Creating a software upgrade proposal
      • Upgrade Process
  • 🧑‍đŸ’ģDeveloping on cheqd
    • Building from source
      • Build with Docker
      • Run a localnet with Docker
    • Indexers
      • SubQuery
  • Architecture
    • Architecture Decision Record (ADR) Process
    • Identity ADRs
    • List of ADRs
      • ADR 001: Payment mechanism for issuing credentials
      • ADR 002: Importing/exporting mnemonic keys from Cosmos
      • ADR 003: Command Line Interface (CLI) tools
      • ADR 004: Token fractions
      • ADR 005: Genesis parameters
      • ADR 006: Community tax
      • ADR 007: Revocation registry
      • ADR 011: AnonCreds
      • ADR Template
  • 🤝Contributing to cheqd
    • Contributor Guide
    • License
    • Code of Conduct
    • Security Policy
  • 🆘Support
    • System Status
    • Slack Channel
    • Discord
Powered by GitBook
LogoLogo

General

  • Website
  • Blog
  • Get $CHEQ

Product Docs

  • Product Docs
  • cheqd Studio
  • Creds.xyz
  • Bug/Feature Requests

Technical Docs

  • Node Docs
  • GitHub
  • Block Explorer

Learning Docs

  • Learning Docs
  • Governance Docs
  • Governance Forum
  • Governance Explorer
On this page
  • Context
  • Instructions
  • Check systemd service status
  • Switch to the cheqd user and configuration directory
  • Display current directory usage/size for the node data folder
  • Open the app.toml file for editing
  • Choose a Cosmos SDK pruning strategy
  • Choose a Tendermint pruning strategy
  • Save changes in the file
  • Switch user and restart service
  • Next steps
  • Third-Party Snapshots for Reference
  • Available Third-Party Snapshots

Was this helpful?

Edit on GitHub
Export as PDF
  1. Validator Guides
  2. Guide for validators

Optimising disk storage with pruning

Last updated 1 month ago

Was this helpful?

Context

Cosmos SDK and Tendermint has a concept of pruning, which allows reducing the disk utilisation and .

There are two kinds of pruning controls available on a node:

  1. Tendermint pruning: This impacts the ~/.cheqdnode/data/blockstore.db/ folder by only retaining the last n specified blocks. Controlled by the min-retain-blocks parameter in ~/.cheqdnode/config/app.toml.

  2. Cosmos SDK pruning: This impacts the ~/.cheqdnode/data/application.db/ folder and prunes Cosmos SDK app-level state (a logical layer higher than Tendermint, which is just peer-to-peer). These are set by the pruning parameters in the ~/.cheqdnode/config/app.toml file.

This can be done by modifying the pruning parameters inside /home/cheqd/.cheqdnode/config/app.toml file.

Instructions

âš ī¸ In order for either type of pruning to work, your node should be running the (at least v1.3.0+).

You can check which version of cheqd-noded you're running using:

cheqd-noded version

The output should be a version higher than v1.3.0. If you're on a lower version, you either manually upgrade the node binary or while retaining settings.

The instructions below assume that the home directory for the cheqd user is set to the default value of /home/cheqd. If this is not the case for your node, please modify the commands below to the correct path.

Check systemd service status

Follow to check systemd service status:

systemctl status cheqd-cosmovisor.service

(Substitute with cheqd-noded.service if you're running a standlone node rather than with Cosmovisor.)

Switch to the cheqd user and configuration directory

Switch to the cheqd user and then the .cheqdnode/config/ directory.

sudo su cheqd
cd ~

Display current directory usage/size for the node data folder

Before you make changes to pruning configuration, you might want to capture the existing usage first (only copy the command bit, not the full line):

root@hostname ~# du -h -d 1 /home/cheqd/.cheqdnode/data/ 2>/dev/null
60G     /home/cheqd/.cheqdnode/data/blockstore.db
80K     /home/cheqd/.cheqdnode/data/evidence.db
1021M   /home/cheqd/.cheqdnode/data/cs.wal
274G    /home/cheqd/.cheqdnode/data/application.db
50G     /home/cheqd/.cheqdnode/data/tx_index.db
72K     /home/cheqd/.cheqdnode/data/snapshots
45G     /home/cheqd/.cheqdnode/data/state.db
428G    /home/cheqd/.cheqdnode/data/

The du -h -d 1 ... command above prints the disk usage for the specified folder down to one folder level depth (-d 1 parameter) and prints the output in GB/MB (-h parameter, which prints in human-readable values).

Open the app.toml file for editing

Open the app.toml file once you've switched to the ~/.cheqdnode/config/ folder using your preferred text editor, such as nano:

cd ~/.cheqdnode/config/
nano app.toml

Choose a Cosmos SDK pruning strategy

âš ī¸ If your node was configured to work with release version v1.2.2 or earlier, you may have been advised to run in pruning="nothing" mode due to a bug in Cosmos SDK.

The file should already be populated with values. Edit the pruning parameter value to one of following:

  1. pruning="nothing" (highest disk usage): This will disable Cosmos SDK pruning and set your node to behave like an "archive" node. This mode consumes the highest disk usage.

  2. pruning="default" (recommended, moderate disk usage): This keeps the last 100 states in addition to every 500th state, and prunes on 10-block intervals. This configuration is safe to use on all types of nodes, especially validator nodes.

  3. pruning="everything" (lowest disk usage): This mode is not recommended when running validator nodes. This will keep the current state and also prune on 10 blocks intervals. This settings is useful for nodes such as seed/sentry nodes, as long as they are not used to query RPC/REST API requests.

  4. pruning="custom" (custom disk usage): If you set the pruning parameter to custom, you will have to modify two additional parameters:

    • pruning-keep-recent: This will define how many recent states are kept, e.g., 250 (contrast this against default).

    • pruning-interval: This will define how often state pruning happens, e.g., 50 (contrast against default, which does it every 10 blocks)

    • pruning-keep-every: This parameter is deprecated in newer versions of Cosmos SDK. You can delete this line if it's present in your app.toml file.

Although the paramters named pruning-* are only supposed to take effect if the pruning strategy is custom, in practice it seems that in Cosmos SDK v0.46.10 these settings still impact pruning. Therefore, you're advised to comment out these lines when using default pruning.

Example configuration file with recommended settings:

pruning = "default"

# These are applied if and only if the pruning strategy is custom.
#pruning-keep-recent = "0"
#pruning-interval = "0"

Choose a Tendermint pruning strategy

Configuring min-retain-blocks parameter to a non-zero value activates Tendermint pruning, which specifies minimum block height to retain. By default, this parameter is set to 0, which disables this feature.

Enabling this feature can reduce disk usage significantly. Be careful in setting a value, as it must be at least higher than 250,000 as calculated below:

  • ...divided by average block time = approx. 6s / block

  • = approx. 210,000 blocks

  • Adding a safety margin (in case average block time goes down) = approx. 250,000 blocks

Therefore, this setting must always be updated to carefully match a valid value in case the unbonding time on the network you're running on is different. (E.g., this value is different on mainnet vs testnet due to different unbonding period.)

Using the recommended values, on the current cheqd mainnet this section would look like the following:

# Note: Tendermint block pruning is dependant on this parameter in conunction
# with the unbonding (safety threshold) period, state pruning and state sync
# snapshot parameters to determine the correct minimum value of
# ResponseCommit.RetainHeight.
min-retain-blocks = 250000

Save changes in the file

Save and exit from the app.toml file. Working with text editors is outside the scope of this document, but in general under nano this would be Ctrl+X, "yes" to Save modified buffer, then Enter.

Switch user and restart service

â„šī¸ NOTE: You need root or at least a user with super-user privileges using the sudo prefix to the commands below when interact with systemd.

If you switched to the cheqd user, exit out to a root/super-user:

exit

Usually, this will switch you back to root or other super-user (e.g., ubuntu).

Restart systemd service:

sudo systemctl restart cheqd-cosmovisor.service

(Substitute with cheqd-noded.service above if you're running without Cosmovisor)

Check the systemd service status and confirm that it's running:

systemctl status cheqd-cosmovisor.service

Next steps

If you activate/modify any pruning configuration above, the changes to disk usage are NOT immediate. Typically, it may take 1-2 days over which the disk usage reduction is progressively applied.

If you've gone from a higher disk usage setting to a lower disk usage setting, re-run the disk usage command to comapre the breakdown of disk usage in the node data directory:

du -h -d 1 /home/cheqd/.cheqdnode/data/ 2>/dev/null

The output shown should show a difference in disk usage from the previous run before settings were changed for the application.db folder (if the pruning parameters were changed) and/or the blockstore.db folder (if min-retain-blocks) was changed.

Third-Party Snapshots for Reference

Instead of syncing a full node from scratch, validators can leverage pruned snapshots provided by trusted third-party services. These snapshots are substantially smaller (usually 3-10 GB compared to 100s of GBs for a full node), allowing faster setup and reduced storage requirements.

Available Third-Party Snapshots

  1. NodeStake

    • Instructions: Navigate to the Snapshot tab for detailed steps on downloading and using their snapshots.

  2. Lavender.Five Nodes

    • Visit the page for links and commands to restore a node from their pruned snapshots.

  3. STAVR

    1. Visit the page for links and commands to restore a node from their pruned snapshots.

Instructions on how to use text editors such as nano is out of the scope of this document. If you're unsure how to use it, consider following .

Ensure you've upgraded to the () or otherwise. When running a validator node, you're recommended to change this value to pruning="default".

(14 days) converted to seconds = 1,210,000 seconds

Our has a section on how to check service status.

Website:

Website:

Website:

đŸĻ
storage required on a node
latest stable release of cheqd-node
use the interactive installer to execute an upgrade
similar instructions as mentioned in the installer guide
guides on how to use nano
latest stable release
using the installer
Unbonding time
installer guide
https://nodestake.org/cheqd
https://services.lavenderfive.com/mainnet/cheqd/snapshot
https://stavr-team.gitbook.io/nodes-guides/mainnets/Cheqd/statesync-snapshot