Questions tagged [database]

Questions pertaining to runtime storage and chain databases, including querying storage, database back-ups and archiving.

Filter by
Sorted by
Tagged with
1 vote
1 answer
21 views

How to generate database weights?

As a chain grows the DB operations should get costlier. Is there a standard procedure that outlines how to generate these weights? Or should we continue using the default substrate weights for this ...
Purple_Turtle's user avatar
3 votes
2 answers
39 views

Is it possible to bootstrap a parachain node from pre-existing solo chainstate?

Let's imagine a scenario where a team is running a substrate private network and have all their chainstate that they want to move to a parachain after acquiring a slot. My question is, when the team ...
Purple_Turtle's user avatar
3 votes
0 answers
29 views

ink dapp asking to sign transactions everytime i reload

so i am building a dapp with ink it has messages to get data and put data and on FE when i logged in with the polkadot-js extension wallet everytime i reload the page it asks me to sign the ...
rahul's user avatar
  • 133
2 votes
0 answers
16 views

Offchain Storage lock vs compare-set/mutate function

While using offchain workers when do we want to use a StorageLock and when would we want to use a mutate function on StorageValueRef since both of them are kind of lock on db.
Rusty Pythonic Script's user avatar
3 votes
1 answer
47 views

How to store offchain mutable values

Are there offchain storage options in substrate? Like a regular mongodb- or mysql database, I don't want to use something else and just stick with something supported with substrate stack. The only ...
dadzerlaze's user avatar
  • 1,073
4 votes
1 answer
176 views

State Pruning: Archive-Canonical vs Archive-Finalized

Currently in substrate there is a possibility to set state pruning to "archive-canonical" or "number". In docs it states, that these values will cause to: archive-canonical - Keep ...
mnems's user avatar
  • 41
0 votes
1 answer
62 views

Caching functions

My rust is limited, I would like to simplify some of my code, and it would be helpful if I could have a caching function to cache database reads in memory. Are there any helpers that I can use for ...
Yatusabes's user avatar
  • 766
0 votes
1 answer
65 views

What is the best available way to take substrate DB backup without stopping the service? [duplicate]

I have the substrate setup on AWS EC2 with EBS volume attached to it. I wonder what would be the best way to take substrate DB backup.
Nitesh B.'s user avatar
  • 101
0 votes
1 answer
119 views

What is the best practice for storing a hash?

I am about to make the decision on how to store some hash value inside the blockchain. A hash value is the best practice to minimise the size of the blockchain, but still allows people to verify ...
Chralt's user avatar
  • 503
3 votes
1 answer
156 views

Export state of a running chain and run it as alice

Hello everyone, I'm trying to spin up a test chain(with imported real chain data) with alice(so I can start it from genesis and start producing blocks with --alice flag) and after dumping the state of ...
flipchan's user avatar
  • 319
3 votes
1 answer
199 views

How to prune sibling blocks?

Testing some behaviors on a collator, I often end-up with [🌗] Block import error: State Database error: Too many sibling blocks inserted Is there way to remove those siblings from the database ?
Crystalin's user avatar
  • 781
1 vote
2 answers
275 views

How can I purging chain database between tests of a development testnet?

I am running a few tests using Jest and Polkadot.js, and I need to reset the state before each test. Should I do that or spawn a new node each time? And if so, what's the best way to do it? I am using ...
John Hilkinson's user avatar
4 votes
1 answer
127 views

How to to run the substrate-node-template with parity-db instead of rockdb?

I'm looking for a how-to-guide, or an example that runs the substrate-node-template using parity-db instead of rockdb.
Pablo Buitrago's user avatar
8 votes
1 answer
102 views

Get block height from database snapshot, without running a node

I have synced a Substrate-based parachain (Moonbase Alpha) and stopped the node to take a snapshot of the database directory. I would like to know what's the best block (block height, last finalized ...
mhSangar's user avatar
  • 181
4 votes
2 answers
70 views

Is there a way for a validator node to store relay chain db and parachain data in different partitions

Is there a way to tell the validator node to store db/full/parachains on a different partition/location. Or is it safe to rsync it to a folder on another partition and then simlink it for a live ...
Syed's user avatar
  • 278
9 votes
1 answer
204 views

Is there a way to prune blocks/transactions from the database

My understanding is that --pruning remove the old trie nodes but does not delete the content of the blocks, is there a way to also delete the blocks/transaction up to some point and only keep states ...
Syed's user avatar
  • 278
5 votes
2 answers
318 views

Why does Substrate use rocksdb & paritydb over leveldb?

What are the benefits of rocksdb over leveldb? Can Substrate use leveldb? I understand that rocksdb was the database of choice for Parity Ethereum client, and paritydb aims to fix a lot of the ...
Hoon Kim's user avatar
  • 123
6 votes
0 answers
67 views

How do I create a snapshot of the substrate database and load it on future runs? [duplicate]

I am making use of JS tests to check my contract calls however there is a large amount of setup required before each test. This means the tests take a very long time to run. I know the substrate ...
forgetso's user avatar
  • 1,462
2 votes
1 answer
65 views

Off-chain DB indexing example

Where can I find Tomasz Drwięga Off-chain DB indexing example, implementing the following runtime function? fn on_finalize(_n: BlockNumberFor<T>){} TIA
Pablo Buitrago's user avatar
4 votes
1 answer
72 views

DB backup and restarting the node with the DB backed up file is not working as expected

We are trying to restart the nodes with the DB backup file such as chain data DB, keystore etc these are backed up regularly. But we are getting the below error : Error: Service(Client(Backend("...
Immanuel John's user avatar
11 votes
1 answer
275 views

How expensive is it to access storage items?

How expensive are storage reads and writes? Does the cost depend on the size of the item?
Oliver Tale-Yazdi's user avatar
3 votes
2 answers
109 views

Persistent Offchain Worker Storage

Offchain workers storage comes in two flavors: Persistent and Local. pub enum StorageKind { /// Persistent storage is non-revertible and not fork-aware. It means that any value /// set by the ...
Alejandro Martínez's user avatar
10 votes
4 answers
348 views

How to configure a Substrate Network with Injected Block History from a snapshot or database backup?

Is it possible to use the chain specification file or some other mechanism to configure a Substrate network with injected block history? In this case, the motivation is CI/CD/testing, but I can see ...
Dan Forbes's user avatar
4 votes
2 answers
92 views

Does each block save a copy of a Storage item?

This is what I read from the substrate storage docs: https://docs.substrate.io/v3/runtime/storage/ Runtime storage allows you to store data in your blockchain that is persisted between blocks and can ...
Minh Mốc's user avatar