Before Private Data Collection was introduced with Hyperledger Fabric 1.2, it was very difficult to share data only with selected organizations. That led to the creation of highly complex channels between organizations in the network and was limited by the scalability.
Private Data Collections allows us to build disjoints collections of data where only participating organizations can see the actual data included. All the other organizations that are not included in that collection will only see the encrypted Hash version of the transaction. Therefore, the feature in Hyperledger Fabric 1.2 was a game-changer in the industry with private data collection. And it is now used by all the sophisticated Hyperledger Fabric solutions.
The newest version of Hyperledger Fabric (2.0) introduces implicit private data collections and show us new changes. In this update, each organization owns a collection as a single participant. So, every organization has by default his own private data collection where he is the only one participating in it.
The figure illustrates how implicit Private Data Collections will be handled in the couch DB of the fabric. Information is separated in P_implicit_org_n and H_implicit_org_n, where the P_implicit_org_n element tells us that the DB contains all the actual data for the transaction of the participating organization.
The H_implicit_org_n is a private data collection that contains the encrypted hash version of the actual data of each entry of P_implicit_org_n and this will be spread around the member of the channel. In order to understand this concept better, let's dive into a quick demo.
Demonstration in Hyperledger Fabric 2.0
In order to do the demonstration from your end, please make sure you install the required tools (if not, feel free to check my prerequisites post here). Once you have installed the prerequisites, follow the simple steps below.
First of all, we will set up our network using the test-network from the fabric-samples. And we will do some additional preparation on the sample chain code in order to add dependencies:
cd fabric-samples/asset-transfer-private-data/chaincode-go GO111MODULE=on go mod vendor cd ../../test-network
Then we have to bring up the network with the automatic creation in “joining of a channel“
./network.sh up createChannel -ca -s couchdb
The last step in setting up the environment is the “deployment of the smart contract“
The Docker should show you something like this:
Now the environment is up and running! We can now easily check the CouchDB of each organization. In order to do this, you should Open http://localhost:5984/_utils to see the data of Org1. Org2 is analogous with port 7984.
The screenshot shows the explained implicit Private Data Collections for Org1.
Because the demonstration network has two organizations, you can see the implicit private data collection which holds the actual data of Org1.
You can also see the implicit private data collections which are holding the encrypted hash values of the transactions of Org1 and Org2.
As you can see, there are additional data that are not covered in this article. But in our future post, we will give you more pieces of information about them.
The implicit private data collection functionalities that improve the management of data. It took data privacy to a whole new level. But, there is still a question of performance that we didn't cover in this article. Every additional organization leads to n+1 implicit collections for each organization. I will be glad to share more of this topic in my upcoming articles and keep you updated. I will also be very happy to get your feedback about this article, so please leave a comment!!