Chaincode

The Chaincode class is used as a wrapper of controllers in a blockchain.

The chaincode must be initialized first with the list of controllers provided in the configuration object.

The controllers must follow the ConvectorController specification.

Hierarchy

  • Chaincode
    • Chaincode

Implements

  • ChaincodeInterface

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Chaincode(logLevel?: string): Chaincode
  • Parameters

    • Optional logLevel: string

    Returns Chaincode

Properties

logger

logger: LoggerInstance

name

name: string

the name of the current chaincode.

readonly
type

{string}

memberof

Chaincode

Methods

Init

  • Init(stub: Stub): Promise<object>

Invoke

  • Invoke(stub: Stub): Promise<object>
  • Standard Invoke from Hyperledger Fabric.

    This method is invoked when you want to call any function in the controller, it first calls this function

    Parameters

    • stub: Stub

    Returns Promise<object>

initControllers

  • initControllers(stub: StubHelper, args: string[]): Promise<void>
  • This is where the chaincode gets initialized. The list of controllers gets initialized and registered in this chaincode version.

    Notice that if you upgrade from/to another chaincode, you can change the controllers present without any problem

    Parameters

    • stub: StubHelper
    • args: string[]

    Returns Promise<void>