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 Hands-On Blockchain with Hyperledger now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.