Class Context

java.lang.Object
org.hyperledger.fabric.contract.Context

public class Context extends 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);
     }
 }

 
  • Field Details

  • Constructor Details

    • Context

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

    • getStub

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

      public ClientIdentity getClientIdentity()
      Returns:
      ClientIdentity object to use