Retrieving user identities and attributes in chaincode

In this step, we will retrieve a user's identity during the execution of the chaincode. The ABAC functionality available to chaincode is provided by the Client Identity Chaincode (CID) library.

Every transaction proposal submitted to the chaincode carries along with it the ecert of the invoker –the user submitting the transaction. The chaincode has access to the ecert through importing the CID library and invoking the library functions with the argument ChaincodeStubInterface, that is, the argument stub received in both the Init and Invoke methods.

The chaincode can use the certificate to extract information about the invoker, including:

  • The ID of the invoker
  • The unique ID of the Membership ...

Get Blockchain Development with Hyperledger now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.