Hyperledger Explorer: how to prevent participants from accessing transaction history - hyperledger-fabric

In my Hyperledger-Fabric application (developed with Hyperledger Composer), I want to prevent participants from being able to look at the old transactions.
Old transactions can be viewed either in the Hyperledger Composer Historian or in the Hyperledger Explorer.
I know how to make old transactions non-visible to participants in the case of Hyperledger Composer Historian (namely in the file permissions.acl). But preventing participants from looking at old transactions in the Hyperledger Composer Historian is not of any use, as long as they can instead view the transaction history in the Hyperledger Explorer.
So my question is this: how can I make the transaction history non-visible to participants in the case of the Hyperledger Explorer?
UPDATE:
Is it possible at all for an organisation to use Hyperledger Explorer without the knowledge of other members of the network?
If it is not possible for one member to use Hyperledger Explorer on the network without the other members allowing it, then the problem is gone anyway.

You can't make participants not being able to access data they have already seen, thus you can't make transaction history disappear from the channel members local peers.
I know how to make old transactions non-visible to participants in the
case of Hyperledger Composer Historian (namely in the file
permissions.acl).
Even if you define access control for clients in the application layer:
All peers in the channel can still see the transactions
Every client that has permission to pull blocks from peers or orderers, can still see the transactions via pulling them itself.
But preventing participants from looking at old transactions in the
Hyperledger Composer Historian is not of any use, as long as they can
instead view the transaction history in the Hyperledger Explorer.
Such a fact should instill doubt in the mind of anyone, and make him/her wonder whether the hiding is of any use, to someone that has access to the blockchain itself.

Related

How to congfigure access rights for consortium members on channel level in Hyperledger Fabric

I'm developing a blockchain solution on Hyperledger Fabric. This solution should be used to provide the interactions bewtween manufacturers and suppliers. I supposed that in this case there should be a single blockchain ledger with information about manufactured goods. This ledger should be used both by manufacturers (to register new goods) and by suppliers (to update goods: for example, mark some item as delivered).
The Hyperledger Fabric official documentation (https://hyperledger-fabric.readthedocs.io/en/release-2.0/fabric_model.html#privacy) says that the ledger is strictly linked with a channel:
Blockquote
Hyperledger Fabric employs an immutable ledger on a per-channel basis, as well as chaincode that can manipulate and modify the current state of assets.
So I intended to create a single channel and install 2 different chaincodes on:
chaincode for manufacturers (to register manufactured goods)
chaincode for suppliers (to mark registered goods as delivered)
But when I prepared a demo application, I revealed, that the second chaincode cannot query the items created with the first one (i.e. each chaincode has an isolated ledger).
How can I deploy the ledger, which should be shared between organizations having various roles (access rights), if I don't want to force all of them (manufacturers and suppliers) to install the full chaincode (containing both 'register goods' and 'mark as delivered' operations) on their environment?
Thanks & Regards
Igor Egorov

User transaction history hyperledger fabric

I am building a hyperledger fabric blockchain application where several users interact. It seems to be working. Using hyperledger explorer I can also view the blocks and transactions in the blockchain.
However, it is not clear to me how to see get the transaction history for 1 user (based on his / her identity key)?
Basically, like for a customer of a bank, I would like to get only the transactions relevant to a particular user to provide him/her with a transaction overview.
Is there a tool for this? Is it integrated into Fabric?
There are several different ways to go about this.
On-chain: You'd write a chaincode function to return the corresponding transactions. To do this you need to keep track of each user's submitted transactions by storing the transaction UUIDs in the chaincode state (stub.PutState). With stub.getState you can later retrieve the state and return the transaction list. (inspired by this StackOverflow answer)
Peer SDK: As far as chaincode-independent transaction history goes I'm not aware of any API calls that support this. You can only get a transaction by its UUID.
Off-chain: Since you're already using Hyperledger Explorer, you should have a Postgres database containing indexed transaction data. You can query the transactions table from your application by filtering for the creator_id_bytes. Since Hyperledger Explorer needs to fetch new transactions from the peer first, there is some additional latency with this approach compared to 1/2.

Hyperledger Fabric design

I am new to the area of DLTs or "blockchain" and I am trying to create an application on top of Hyperledger Fabric. Before I describe my use case, I need to mention that due to my use case's nature I need a private & permissioned "blockchain" which justifies the choice of Fabric (I am aware of other platforms e.g. Corda, private Ethereum, but Fabric seems to match my use case better).
Use Case
My use case consists of two different types of participants. A number of organizations (which upload and share information about individuals on the distributed ledger) and a client who can query information about an individual.
The client should not be able to see the transactions uploaded by the organizations and will not have write rights on the DL. He has read-only rights. Moreover, the organizations trust each other and there is also a level of trust between them and the client.
Design thoughts
Based on what I've read, I was thinking of creating a DL network that includes all of these parties and use channels which, based on the documentation, can be used to create a grouping among a number of participants (the organizations in my case) thus "hiding" the transactions from the parties which are not included in this group (the client in my case).
However, later I read about chaincode (a.k.a. smart contracts) which:
can be invoked by an application external to the blockchain when that
application needs to interact with the ledger
which confused me since if the "blockchain" can be queried from an external entity, that probably means that the client should not be included in the trusted network.
Am I headed in the wrong direction (design-wise)?
Based on your description, Hyperledger Fabric channels sound like a good solution. You should also familiarise yourself with private data collections, as this is another way of hiding some of the data from some peers. Which option is best for your scenario will depend on how your datasets are structured, and whether you also need to keep the data private from the orderer.
Clients are not part of the network. They query the blockchain by connecting to a peer and then requesting data from that peer. They can then only access the data visible to that peer (which is stored locally by that peer). So, it is not possible for a client to access more data than is available to the peer the client is connected to.
In your example, you would have a "client" organisation, with at least one peer. This peer would be part of the network, and your client application would then connect to it for access to data on the ledger (typically using the Hyperledger Fabric Node SDK).
There are two types of chaincode in Hyperledger Fabric.
User Chaincode (often just referred to as "chaincode") is used to update the ledger for a channel, and is only installed on those peers which require it (i.e. endorsing peers). Since your "client" peer would not be an endorsing peer, it would not have access to the user chaincode for the channel.
System Chaincode which all peers have access to, provides (among other things) an interface to allow queries to be run against the ledger.

Hyperledger fabric: An org can only see some details of the transaction

I am working on a dapp project only using Hyperledger Fabric. The situation is, a bank transfers money from account A to account B. This transaction is recorded in the blockchain. The thing is there will be a role similar to a supervisor. I just want the supervisor to know there was such a transaction and know some detail while some other details are hidden to the supervisor. Can HL Fabric achieve this? Or how can I achieve this?
You can use Hyperledger Fabric 'private data collections’ when participants need to transact on the same blockchain, but keep data private to a subset of transactors (and potentially regulators/auditors). Private data is shared peer-to-peer, with hashes stored on the blockchain as evidence so that all peers can validate transactions.
With private data collections, you can keep the entire state private, or make part of the state public, and part of the state private.
See the Fabric private data documentation and a tutorial.

How would Hyperledger Composer work?

I am new to composer, and now practicing some of the tutorials and examples. But while doing this I can not understand some of the features, so here are the questions which I do not clearly understand:
Are queries restricted by .acl file (when, for example, we use them in rest server)?
Do the rules written in the .acl restrict some of the transactions which are allowed for certain participant to submit? (For example, for participantA it is not allowed to CREATE new participants, but what happens if participantA submits the transaction(which is allowed for him to submit)which creates another participant, will this transaction fail?
Could cards be created by rest api server?(I know that participants could be created using JS api, but is it possible to create and issue the identity for those participants through RestServerApi?)
What happens when PeerAdmin upgrade certain node to a new version? How do other nodes act in this case? Do they upgrade themself automaticly?(Also found that upgrade takes a lot of time(2-4 minutes) when deployed locally, whereas in browser for local connection it takes 3-4 seconds)
Does Hyperledger fabric allow some of the ledger data be stored in one private network, whereas other network connected to the private one would not store this part of ledger( or the data will be simply crypted)? The same question regarding the transactions: will the be executed on outer networks?
Yes Composer Queries (and therein, results) are subject to ACL restrictions or filters.
It will still fail due to ACL rule restriction. Once denied to create, always denied as that is the final operation (in this scenario). The actual transaction would fail.
Yes of course use POST /system/identities/issue REST endpoint (eg http://localhost:3001/api/system/identities/issue) - see an example here -> https://medium.com/#CazChurchUk/developing-multi-user-application-using-the-hyperledger-composer-rest-server-b3b88e857ccc
An administrator with PeerAdmin capability has responsibility to install new version on his peers (in his Org). The other Org peer Admins are responsible for theirs, that's how a blockchain consortium with different Orgs will work. They will agree the 'what' and when but will need to install the new version on own Org's peers, so the new version can be started on the same channel. Of course, there will be a difference between a Fabric infrastructure response time, and that of a web connection using local storage.
Channels in Fabric implement privacy. You can have one or more business networks on that channel (ledger), therefore transactions in that business network are private to that ledger. It is the client's responsibility to encrypt data or not. Hyperledger Composer can allow call one business network from another, on the same channel, or if permitted to do so, on different channels too - see https://hyperledger.github.io/composer/latest/tutorials/invoke-composer-network

Resources