hyperledger-fabrichyperledger-fabric-sdk-js

What is the best way of storing the clients registration information off-chain in hyperledger fabric


I want to create an application with the Hyperledger fabric network and I'm unsure what the optimal way of processing and storing the clients information is. It is important for me that the personal information get stored off-chain to not slow down the network.
Right now this is the process I thought about:

  1. Client fills out form in frontend
  2. Application (backend) generates unique UUID
  3. (registering enrolling UUID in the wallet) unsure about this step
  4. Chaincode gets called which saves the UUID in the state database
  5. The UUID and the personal information like Username, email, password get encrypted and saved in an off-chain database like postgreSQL.

That way the UUID can be connected to the personal information because the UUID is also stored off-chain and it is still totally anonymous.
But is it necessary to register and enroll the user through the Node SDK with the enroll and register function before being able to access the chaincode, because without the registration there would be no identity for the client in the network?
And I'm also cunfused if this function from the fabcar samples is the same as the enroll and register function from the node SDK?

Thanks for your efforts and helping me understand this matter.


Solution

  • The enroll code of fabcar is the enroll of node-sdk.
    In other words, they are the same.

    const secret = await ca.register({
        affiliation: 'org1.department1',
        enrollmentID: 'appUser',
        role: 'client'
    }, adminUser);
    const enrollment = await ca.enroll({
        enrollmentID: 'appUser',
        enrollmentSecret: secret
    });
    

    First, let's talk about fabric's SDK.
    In general, in order to query/invoke chaincode on the fabric SDK, you need to obtain fabric client authority.
    Suppose you register a specific user UUID as a Client of Fabric and call the chaincode through that Client.
    In this case, the order you should perform is as follows.

    1. enroll admin-client to Fabric-CA
    2. register user-client by admin-client to Fabric-CA
    3. chaincode invoke by admin-client or user-client to Fabric-Network(peers, orderers)

    step 1, when Fabric-CA is first operated, the administrator ID and password can be specified through specified parameters. Based on the specified ID and password, a client key/certificate with admin authority is issued from Fabric-CA and stored. (Fabric-CA is recommended to be operated in an organizational unit, and client authority is organization dependent.)

    step 2, a new user can be registered through the admin-client key/certificate. Probably you would register the UUID as enrollmentID. When the registration process is finished, the user-client's key/certificate is issued by enrolling in Fabric-CA, and it is stored.

    step 3, the chaincode is query/invoke through the stored admin-client/user-client key/certificate. Of course, it can be performed only if the client is authorized, and this is defined in the genesis block of the channel in the blockchain network (that is, it must be set in the configtxgen process)

    Overall, if you look at the scenario, you can see the two processes divided.

    1. In case of separate authentication server
    1. When using an organization as an authentication server within Hyperledger Fabric

    [NOTE]
    If you are going to query/invoke the chaincode of the fabric network, fabric-client privileges are essential. Of course, you can do some tricks. for example)

    However, the authority on the blockchain is all dependent on external certification authorities.