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 aryya
• 7,450 points

1 answer to this question.

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,400 points

Great info here.

How would you go about re-processing the ledger? 

Would you happen to know how long this would take?


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?


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?

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
+1 vote
1 answer

What are the differences between coin and token?

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

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

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
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
• 26,740 points
+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 8, 2018 in Blockchain by Shashank
• 10,400 points
+1 vote
1 answer
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP