Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (12.7k points)
edited by

 In Hyperledger Fabric:

  1. Where are the physical block files stored on a peer instance?
  2. How Often or when is the World State validated against the underlying ledger/blockchain?

I know that LevelDB is used for the World State and it can be switched to CouchDB and I read somewhere that the ledger is also indexed in LevelDB but that again could refer to the World State and no one seems to know the location of the ledger.

I have explored the peer instance and the location /var/hyperledger/production/ledgersData which further contains directories like chains, historyLeveldb, ledgerProvider, pvtdataStore and the chains directory do contain the channels and then each channel directory has a file blockfile_000000 and based on my current configurations I have executed number of transactions with some delay in between but I don't see any new blocks created under the location I have mentioned.

What freaks me more is that on every peer I have completely removed the ledger directories recursively and my block chain is still working perfectly fine, which begs the question does the world state actually gets validated or do we have to provide our own implementation to validate the world state against the ledger based on our own needs?

1 Answer

0 votes
by (29.5k points)
edited by

The blockchain is stored in the ledgersData/chains directory in the blockfiles. Each time a block is committed the blockfile will be written to and fsynced.

The state database is saved in LevelDB (ledgersData/stateLeveldb directory) or an external CouchDB. Each time a block is committed the state updates for the block will be committed to the state database.

If the data somehow gets tampered or out of sync between the blockchain and the state database, then endorsement requests to this peer would identify the bad data based on inconsistencies with other peers. If there is any doubt about the integrity of the state database, the state database can be dropped and rebuilt from the blockchain.

Understand how this whole Blockchain system works. Enroll now in Blockchain Training.

Browse Categories

...