Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data storage within hyperledger

I have started learning hyperledger. Became familiarised with it by creating a sample app using the composer playground. My doubt is regarding the decentralized storage using hyperledger. I have read some few docs which mentions about :

  • Saving the hash of the data within the blockchain to ensure the immutability.

  • Saving the image within the blockchain(as an asset) through the base64 string.

Some of the things were clear but a large portion still remains uncertain. They are :

  • Where is the data stored within the blockchain? Is it in couchdb ?
  • Suppose the data is stored within the couchdb and via multipeer a new peer gets added to the channel, then does it mean that all the couchdb's of the peers get synced ?

Any resources/tutorials that mention about data storage with the blockchain, decentralized storage etc. would be very helpful.

Thanks!

like image 508
Sooraj Avatar asked Nov 05 '18 10:11

Sooraj


People also ask

How does Hyperledger store data?

the actual private data; data is stored in a private database on the peer nodes of authorized organizations and is accessed from chaincode on these authorized peers; and. a hash of that private data; endorsed, ordered, and written to the ledgers of every peer on the channel.

Where is data stored in Hyperledger Fabric?

This data is stored in a private state database on the peers of authorized organizations, which can be accessed from chaincode on these authorized peers.

What database does Hyperledger use?

CouchDB is a state database in Managed Blockchain that models ledger data as JSON. It is the default peer state database for Hyperledger Fabric 1.4 or later network on Managed Blockchain because CouchDB supports rich queries and indexing for more efficient queries over large datasets.

Where are blocks stored in Hyperledger Fabric?

Blockchain is a log of transactions grouped in blocks, ordered by ordering service. It is physically stored in the peer nodes and immutable. It cannot be changed.


1 Answers

the blockchain data, aka the ledger, is stored as a physical file. it contains linked blocks, each block consisting of a set of transactions. Each state change is stored there.

By contrast, the world state only contains the current state of every asset as that's what applications need.

The world state is implemented as a database, couchdb being a good option, there is a simpler one available but that one offers much less in terms of querying capability.

Of course what this means is that the world state can be easily recreated from the ledger at any point in time.

when a new peer gets added to a channel, its own world state is created from the ledger.

a good read describing all this is here: https://hyperledger-fabric.readthedocs.io/en/release-1.3/ledger/ledger.html

like image 195
Andrei Dragotoniu Avatar answered Sep 22 '22 21:09

Andrei Dragotoniu