in the substrate-node-template case , I don't want to compile rocks-db at all. how it would be possible compile parity-db instead of rocks-db?

  • 1
    That would be so cool. Then you would need less things natively installed on your machine to get started.
    – Squirrel
    Commented Dec 15, 2022 at 14:26

1 Answer 1


To compile the Substrate Node Template with Parity DB instead of RocksDB, you'll need to make the following changes:

  1. Update Cargo.toml: Open the Cargo.toml file in the Substrate Node Template project and modify the dependencies section. Remove the rocksdb dependency and add the parity-db dependency instead. Your Cargo.toml file should look something like this:

    # Remove the rocksdb dependency
    # rocksdb = { version = "0.6", optional = true, features = ["full"] }
    # Add the parity-db dependency
    parity-db = { version = "2.1", optional = true }
  2. Update lib.rs: Open the lib.rs file (or the main file of your substrate node) and update the storage configuration. Replace the RocksDb storage configuration with ParityDb. Here's an example:

    use substrate_node_template_runtime::{
        // Replace `RocksDb` with `ParityDb`
        ParityDb, Runtime,
    const PARITY_DB_CONFIG: &'static str = r#"
        "path": "./parity_db",
        "cache_size": 536870912,
        "write_buffer_size": 268435456,
        "max_open_files": 10000,
        "block_cache_size": 268435456,
        "disable_block_cache": false,
        "max_table_size": 268435456,
        "block_size": 4096,
        "paranoid_checks": false,
        "verify_checksums": true,
        "max_background_compactions": 10,
        "num_levels": 7,
        "level_compaction_dynamic_level_bytes": true,
        "level_compaction_trigger": 4,
        "level_compaction_files": 10,
        "disable_auto_compactions": false,
        "soft_pending_compaction_bytes_limit": 68719476736,
        "hard_pending_compaction_bytes_limit": 274877906944,
        "force_consistency_checks": false,
        "use_fsync": false,
        "db_log_path": "",
        "read_amp_bytes_per_bit": 0
    async fn main() -> Result<(), Box<dyn std::error::Error>> {
        // Replace `RocksDb` with `ParityDb` in the storage configuration
        let _ = SubstrateNodeTemplateRuntime::from_storage(
            ParityDb::open(Path::new("./parity_db"), PARITY_DB_CONFIG.parse().unwrap())?,
        // Rest of your code

    In this example, the ParityDb storage configuration is used instead of RocksDb. Adjust the path and other configuration options based on your requirements.

  • if it's possible to build the substrate-node-template without Rocksdb using your solution, then why is there still this open issue github.com/paritytech/substrate/issues/13354 that claims we can't build Substrate without having to pull in Rocksdb and all of its native dependencies? Commented Jul 10, 2023 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.