6

In the substrate archive wiki, they showed how to archive the polkadot chain's data. Now I want to get other chains' data (like a substrate template node or Astar, Moonbeam, etc). How can I do that?

In the node-template-archive/archive.toml file, I changed the network rockdb directory appropriately. This is the command I used for Shiden network (Astar testnet)

./node-template-archive -c /home/minhnd/Documents/substrate/substrate-archive/bin/node-template-archive/archive.toml

The log:

[14:51] DEBUG Archive Config: ArchiveConfig { chain: ChainConfig { data_path: Some("/home/minhnd/Documents/substrate/Astar/freshdi_shibuya/chains/shiden/db/full"), cache_size: 128, rocksdb_secondary_path: Some("./substrate_archive/rocksdb_secondary"), spec: Some(ChainSpec(name = "Development", id = "dev")) }, runtime: RuntimeConfig { exec_method: Interpreted, block_workers: 4, wasm_pages: Some(2048), wasm_runtime_overrides: None, code_substitutes: {}, storage_mode: BlockBody }, database: Some(DatabaseConfig { url: "postgres://localhost?dbname=polkadot-archive&user=postgres&password=123" }), control: ControlConfig { task_timeout: 20, max_block_load: 100000, task_url: "amqp://localhost:5672", storage_indexing: true }, log: LoggerConfig { std: Debug, file: None }, wasm_tracing: Some(TracingConfig { targets: "wasm_tracing,pallet,frame,state", folder: None }) }
[14:51] INFO Open RocksDB at /home/minhnd/Documents/substrate/Astar/freshdi_shibuya/chains/shiden/db/full, state column budget: 115 MiB, others(11) column cache: 1 MiB
[14:51] DEBUG DB Opened blockchain db, fetched best = 0xe1b8d4c234012350df9aa4ff6b26585d8b7ad431929d4bb958d280f403069492 (313726)
[14:51] DEBUG DB Opened blockchain db, fetched final = 0xf1cf9022c7ebb34b162d5b5e34e705a5a740b2d0ecc1009fb89023e62a488108 (0)
[14:51] DEBUG DB Opened blockchain db, fetched final_state = 0xf1cf9022c7ebb34b162d5b5e34e705a5a740b2d0ecc1009fb89023e62a488108 (0)
[14:51] DEBUG block_gap=None
[14:51] DEBUG DB Opened blockchain db, fetched best = 0xe1b8d4c234012350df9aa4ff6b26585d8b7ad431929d4bb958d280f403069492 (313726)
[14:51] DEBUG DB Opened blockchain db, fetched final = 0xf1cf9022c7ebb34b162d5b5e34e705a5a740b2d0ecc1009fb89023e62a488108 (0)
[14:51] DEBUG DB Opened blockchain db, fetched final_state = 0xf1cf9022c7ebb34b162d5b5e34e705a5a740b2d0ecc1009fb89023e62a488108 (0)
[14:51] DEBUG block_gap=None
[14:51] DEBUG allocator being destroyed, max_total_size 416, max_bumper 1104128
[14:51] DEBUG Prepared new runtime version Some(RuntimeVersion { spec_name: RuntimeString::Owned("shiden"), impl_name: RuntimeString::Owned("shiden"), authoring_version: 1, spec_version: 1, impl_version: 0, apis: [([223, 106, 203, 104, 153, 7, 96, 155], 3), ([55, 227, 151, 252, 124, 145, 245, 228], 1), ([64, 254, 58, 212, 1, 248, 149, 154], 5), ([210, 188, 152, 151, 238, 208, 143, 21], 2), ([247, 139, 39, 139, 229, 63, 69, 76], 2), ([188, 157, 137, 144, 79, 91, 146, 63], 1), ([55, 200, 187, 19, 80, 169, 162, 168], 1), ([171, 60, 5, 114, 41, 31, 235, 139], 1), ([234, 147, 227, 241, 111, 61, 105, 98], 1)], transaction_version: 1, state_version: 0 }) in 86 ms.
[14:51] DEBUG Allocated WASM instance 1/4
[14:51] INFO Running archive for 🔗 `shiden`, implementation `shiden`. Latest known runtime version: 1. Latest finalized block 0xf1cf…8108 🛡️
[14:51] DEBUG No cached session for DNSNameRef("localhost")
[14:51] DEBUG Not resuming any session
[14:51] DEBUG No cached session for DNSNameRef("localhost")
[14:51] DEBUG Not resuming any session
[14:51] DEBUG Using ciphersuite TLS13_AES_256_GCM_SHA384
[14:51] DEBUG Not resuming
[14:51] DEBUG TLS1.3 encrypted extensions: []
[14:51] DEBUG ALPN protocol is None
[14:51] DEBUG Ticket saved
[14:51] DEBUG Ticket saved
[14:51] INFO relation "_sqlx_migrations" already exists, skipping
Error: Expected chain polkadot got shiden

So I got this Expected chain polkadot got shiden error message. I really don't know what to do and how to solve this.

3
  • 2
    What have you tried? What problem are you running into? Please post a Minimal, Reproducible Example
    – Shawn Tabrizi
    Mar 15, 2022 at 22:49
  • 1
    @dvdplm's answer is right, node-template archive is the place to get started with this. If you want to index a custom chain like Shiden you will also want to edit the imported runtime to reflect shiden's RuntimeApi and Block type to point to the ones from shiden github.com/paritytech/substrate-archive/blob/…
    – insipx
    Mar 23, 2022 at 19:54
  • The error is a safety check to make sure that whatever runtime archive is running is the one it expects. It checks the runtime of the locally-run chain and the runtime that polkadot-archive is using and found a mismatch
    – insipx
    Mar 23, 2022 at 19:55

2 Answers 2

5

The substrate template node is available here and you can run it with cargo run --release --bin node-template-archive. As for indexing parachains I am actually not sure but I believe it could be as easy as simply providing the chain spec and point it to the rocksdb folder. If that doesn't work feel free to open a feature request!

0
3

I solved the problem. Before I had run the Shiden network, I run the command for polkadot network and I forgot to delete the postgres db (or change the path in the config file to the new db). After creating a new postgres db and change the uri in the config file, the problem solved.

Your Answer

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

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