What are the differences between chain and state database in hyperledger fabric?

0 votes

What are the main difference between chain and state database in Hyperledger fabric. I'm confusing whether they both are same.

Jul 11, 2018 in Blockchain by ariaholic
• 7,320 points
274 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

There are two place which "store" data in Hyperledger Fabric:

1. the ledger
2. the state database

The ledger is the actual "blockchain". It is a file-based ledger which stores serialized blocks. Each block has one or more transactions. Each transaction contains a read-write set which modifies one or more key/value pairs. The ledger is the definitive source of data and is immutable. The state database holds the last known committed value for any given key. It is populated when each peers validates and commits a transaction.

The state database can always be rebuilt from re-processing the ledger. There are currently two options for the state database: an embedded LevelDB or an external CouchDB. As an aside, if you are familiar with Hyperledger Fabric channels, there is a separate ledger for each channel as well.

answered Jul 11, 2018 by Shashank
• 10,330 points

Great info here.

How would you go about re-processing the ledger? 

Would you happen to know how long this would take?

Thanks  

Well, that depends on the length of the chain. The lengthier the chain, the more time it takes.
Thanks for the reply.

Thats kind of what I thought. More of  a "how long is a length of string" question.

Are there no benchmark times out there?

Why I am asking is that I am looking for information into backing up the state DB, and is it worth it?

Would you need to backup the state DB, or if there is a corruption or hardware failure, would it be quicker to reprocess the ledger and rebuild the DB?

Thanks

There is no benchmark because it all depends on "Length of string"cheeky..

It would be quicker to reprocess the ledger but there are a lot of chances it wouldn't be successful (Lot of issues posted by people regarding this on the internet even after following the steps right)

The safer choice would be to backup the stateDB

That's great information, much appreciated.

If I were to conduct regular backups of the state DB, and a scenario came up that I did need to perform a restore, would the DB automatically sync with the ledger, or would there be a need for additional steps in order to bring the state DB up to the correct point in time?

Thanks

Hey.. This link should give all the details you need.. 

Thanks Omkar. Was really helpful information.
I'm glad I could help.

Related Questions In Blockchain

+1 vote
1 answer
+1 vote
1 answer

What are the differences between the hyperledger and Blockchain?

To answer your first query.. Blockchain is ...READ MORE

answered Apr 5, 2018 in Blockchain by anonymous
69 views
+1 vote
1 answer

What are the differences between coin and token?

Coins are cryptocurrencies that are independent and ...READ MORE

answered Jul 17, 2018 in Blockchain by Sahil
30 views
+1 vote
7 answers
0 votes
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 27,620 points
38 views
+1 vote
1 answer
0 votes
1 answer

What are the differences between tendermint and hashgraph?

Hashgraph uses Superior distributed ledger technology. Hashgraph ...READ MORE

answered Apr 7, 2018 in Blockchain by Shashank
• 10,330 points
115 views
+1 vote
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.