Class Context


  • public class Context
    extends java.lang.Object
    This context is available to all 'transaction functions' and provides the transaction context. It also provides access to the APIs for the world state using getStub()

    Applications can implement their own versions if they wish to add functionality. All subclasses MUST implement a constructor, for example

     
    
     public MyContext extends Context {
    
         public MyContext(ChaincodeStub stub) {
            super(stub);
         }
     }
    
    
    
    • Constructor Detail

      • Context

        public Context​(ChaincodeStub stub)
        Constructor Creates new client identity and sets it as a property of the stub
        Parameters:
        stub - Instance of the ChaincodeStub to use
    • Method Detail

      • getStub

        public ChaincodeStub getStub()
        Returns:
        ChaincodeStub instance to use
      • getClientIdentity

        public ClientIdentity getClientIdentity()
        Returns:
        ClientIdentity object to use