Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Chaincode

The Chaincode class is a base class containing handlers for the Invoke() and Init() function which are required by fabric-shim. The Init() function can be overwritten by just implementing it in your Chaincode implementation class.

Hierarchy

  • Chaincode

Implements

  • ChaincodeInterface

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Chaincode(logLevel?: string): Chaincode

Properties

logger

logger: LoggerInstance

Accessors

name

  • get name(): string
  • the name of the current chaincode.

    readonly
    type

    {string}

    memberof

    Chaincode

    Returns string

Methods

Init

  • Init(stub: ChaincodeStub): Promise<ChaincodeResponse>
  • The Init method is called when the Smart Contract is instantiated by the blockchain network Best practice is to have any Ledger initialization in separate function -- see initLedger()

    memberof

    Chaincode

    Parameters

    • stub: ChaincodeStub

    Returns Promise<ChaincodeResponse>

Invoke

  • Invoke(stub: ChaincodeStub): Promise<ChaincodeResponse>
  • The Invoke method is called as a result of an application request to run the Smart Contract. The calling application program has also specified the particular smart contract function to be called, with arguments

    memberof

    Chaincode

    Parameters

    • stub: ChaincodeStub

    Returns Promise<ChaincodeResponse>

Generated using TypeDoc