Uploaded image for project: 'Fabric'
  1. Fabric
  2. FAB-6089

API to retrieve info of submitter of the transaction


    • SDK Impact:
    • System Test Impact:
    • Documentation Impact:


      Currently chaincode developers have no easy way of retrieving information about the invoker/submitter of a transaction. The stub that is passed to the chaincode Invoke function has GetCreator function that return bytes representing the invoker. The chaincode needs to Unmarshal the bytes, read the cert and extract info from it. 

      The goal is to provide a chaincode API which allows chaincode to implement access control. We want to make these APIs as independent of MSP type as possible, while still allowing value-add for certain types of MSPs.

      	// GetID returns the ID associated with the invoking identity.  This ID
      	// is guaranteed to be unique within the MSP.
              // Supported for all MSP types.
      	GetID() (string, error)
      	// Return the MSP ID of the client
              // Supported for all MSP types.
      	GetMSPID() (string, error)
      	// GetAttributeValue returns the value of the client's attribute named `attrName`.
      	// If the client possesses the attribute, `found` is true and `value` equals the
      	// value of the attribute.
      	// If the client does not possess the attribute, `found` is false and `value`
      	// equals "".
              // Supported for all MSP types, though only fabric CA will likely issue certificates with the attributes extension.
      	GetAttributeValue(attrName string) (value string, found bool, err error)
      	// AssertAttributeValue verifies that the client has the attribute named `attrName`
      	// with a value of `attrValue`; otherwise, an error is returned.
              // Supported for all MSP types, though only fabric CA will likely issue certificates with the attributes extension.
      	AssertAttributeValue(attrName, attrValue string) error
      	// GetX509Certificate returns the X509 certificate associated with the client,
      	// or nil if it was not identified by an X509 certificate.
              // Supported for only the default MSP type, which is based on X509.
      	GetX509Certificate() (*x509.Certificate, error)

      For more info, pls see https://docs.google.com/document/d/1GP5tcN0oK9Zewed9h5pLiM2BowWPhtgFUGXEDKjeGGo/edit#


          Issue Links



              Enter your Toggl API token
              Mark as billable
              Apply JIRA issue labels

              {{ currentTimer.description|limitTo:35 }}...
              {{hours}} hour{{hoursS}}, {{minutes}} minute{{minutesS}}, {{seconds}} second{{secondsS}}


                • Assignee:
                  aambati AnilKumar Ambati
                  aambati AnilKumar Ambati
                • Votes:
                  1 Vote for this issue
                  3 Start watching this issue


                  • Created:

                    Git Source Code