Hyperledger Fabric: IoT use case - hyperledger-fabric

Use case: a smart home which gathers raw data from all the sensors within it, processes them and extracts high level information from them. The owner of the house might want to share these information with other people, such as doctors, family members, friends... So, I'm trying to figure out which would be the best way to handle the access permissions on these data. Right now all the information are carefully encrypted and stored in a database (untrusted) and only the people with the right keys can properly decrypt those data.
My idea: I want to use Hyperledger Fabric to store and manage the access permissions to these files and also to store the hash digest of the gathered information for immutability purposes. Once the smart home generates an high level information from the raw data, it stores it inside the database and then it issues a transaction to Hyperledger Fabric with the timestamp and the hash digest of the data.
The smart home owner can share these information with other people, issuing a transaction with the ID of this person and an identifier of the data he would have the access rights on.
So before accessing the information stored inside the encrypted database, the application would check if the requester has the valid permissions stored within the blockchain.
My doubts and questions: since I'm really new on this topic, even though I've read a lot about it, I don't know if this would be an improper use of the Hyperledger Fabric. All the use cases I read about it, store all the data with Hyperledger Fabric, without relying on an external cloud storage service.
Since all the transactions would be stored in the blockchain and the blockchain is maintained by all the peers inside the same channel (btw I would use just one channel to keep everything), they may be able to access to the Hyperledger Fabric database and extract information about the smart home. Am I wrong? If not, how can I solve this issue? I could use the identity mixer feature to "hide" the transaction issuer, but still the transaction would be visible to all of the peers who keep the blockchain available.

I understand your questions. We could not hide all information from Peers, but you can encrypt sensitive information and allow specific people to decrypt it as you mentioned. In addition, even you cannot prevent malicious access on time, but you can collect malicious access activities for auditing in the future. for example: using access control on each world state database of peers.

Related

Maintaining application level data privacy

Is it possible to have application level data privacy in Hyperlegder Fabric v2.2
We have the first network (as referenced in the fabric-samples) in place (Org1 and Org2 with peer0 and peer1 each). I am aware that data privacy can be ensured between 2 organizations using Private Data Collections. Looking at the case where peers in the network can run multiple user applications, consider that, there is app1 and app2 connected to the network via peer0 belonging to Org1. The cause for concern is that despite using private data collections, app1 could access the private data logged by app2 in Org1 private data collection. Is there a way in hyperledger fabric to ensure privacy between apps connected to the network via the same peer.
No, there is not.
You can develop your own authorization routines at smart contract level so that read related operations only return data to authorized users. This way you prevent other clients from accessing data through read operations, but the data is not protected from the peers themselves.
You can also encrypt your data in your client before sending it in a transaction. You can use your own Fabric certificate to encrypt data via ECIES or ECDH encryption schemas (or use any other encryption schema you want). But this way the contract is not going to be able to interpret your data. It will be only able to store it and return it...
In other cases, you may be interested in storing your data in your own private storage system outside Fabric and save only a hash of the data in the channel state as a proof that can be used later if necessary for whatever it is intended to.
These are things you can do to preserve privacy at user level. You can think of other solutions. But Fabric does not provide specific ways to do it. From a blockchain point of view, it is difficult to preserve data privacy at user-level while peers try to reach consensus over that data.

Assesment of a production network in Hyperledger Fabric

I have some questions regarding the deployment of a HLF use case. Suppose we build a platform in which users sell items. The users and their items are stored on the ledger via chaincode. The purpose is to also enforce access control on the items via the chaincode, so that another user for example cannot see a specific item. Then the 2 options regarding the whole identity management are:
The users do not have certificates in Fabric, and all transactions made by the users are forwarded to a single registered Client who interacts with the chaincode. Therefore, the transaction context will always have this client's ID. So from my point of view the username should be always passed to each transaction and implement access control using this username, though a registered Client has full authority over their data.
Every user is registered and enrolled and have their own identity. Every user makes a transaction directly on the blockchain via the chaincode, and access control can be implemented easily by using the stub.ID() and other attributes. That would mean that >100k users would be registered on a CA or multiple CAs.
The questions are:
Is HLF intended and suitable for the 2nd option, or is it made solely for the purpose of interaction between clients of organizations?
Is there a best way to handle this matter?
A ledger stores facts about the history of transactions that led to the current state of an object. The history also stores the users responsible for the current state of the object. If the state of an object is being changed, the admin/authorized user of an organization must be able to see who performed that change.
In the first approach, if you want to see the details of the user doing the "transaction", you'll have to store it somewhere different from the blockchain. While that can be a use-case of your project, it defeats the purpose of storing all facts about the history of a transaction of an object as every time the same user would be doing the transaction.
The second approach fulfills all the motives of incorporating blockchain in a project. Sure, you'll have to register and enroll every user who's creating/modifying an asset but then Access Control Management can be done in a better way. Please read about ACL to know about the granular access you can achieve in Hyperledger Fabric.
Also, you can also encode some information about a user in its x509 certificate with ASN.1
Second option is more preferred and Hyperledger Fabric ca could handled number of user registrations. There is Attribute access control also available which you can use at chaincode level to control use access.
https://www.youtube.com/watch?v=CAXRMJ-quhg

hyperledger for uncentralized database

I am trying to implement a tamper proof uncentralized database of some records. these record are static and they cannot be transferred between participants, i.e, not like some currency or a stock. i just want them to be stored as they are. Identity is an important thing with my project. only certain people can add blocks to the chain, rest of them should be only there to verify the chain. Can i implement a blockchain for this usecase? if it is possible should i use an ethereum chain or hyperledger fabric?
According to your use case which is, certain people, add records and certain query records. A typical normal access control application and the database can solve your issue but,
If you deal with untrusted people and need complete transparency with identity-based access control and equal rights of all participants then hyperledger fabric is best.

How to prevent third party to seeing the data on same channel in Hyperledger Fabric?

So basically in Hyperledger Fabric the third party information provider have to be a part of the channel and once they become the part of the channel they get to see all the information on the channel which can be data security breach. Is there a way we can prevent them seeing the whole data but still give us the required information.
example - Market data provider for a trading system when two banks are trading each other do they need to share that trade information with the market data provider or they can just get the prices from the market data provider without sharing that trade information and Corda is achieving this through oracle so is that something similar on hyper ledger fabric.
#Rahul Singh
You can use private data concept
Earlier it was people use to create multiple channels but now private data concept
one channel you can control data between members
All you have to do is create collections
Read from here
Doc: https://hyperledger-fabric.readthedocs.io/en/release-1.4/private_data_tutorial.html
Chaincode: https://github.com/hyperledger/fabric-samples/tree/release-1.4/chaincode/marbles02_private
Node-sdk: https://fabric-sdk-node.github.io/tutorial-private-data.html

How to secure participants card in hyperledger composer?

Every time an Id is issued to a participant in hyperledger, a card gets generated and imported to the network. by default imported card gets stored in home/.composer/cards directory. So, anyone having access to machine can have access to those cards. Similar with the case when cards get stored on the cloud storage. Is there any provision in hyperledger to restrict the access to those card?
No there isn't. You need to choose the appropriate way for you for storing cards and secure that location in whatever way you deem necessary. As you have seen there are various cloud wallets to provide alternative locations of storage, but you can also develop your own cloud wallet which meets your needs if required.
Examples of cloud wallet implementations can be found at
https://github.com/hyperledger/composer-tools

Resources