Class: Shim

Shim

The shim class provides the service to register the chaincode with the target peer, and listen for incoming requests from the peer to dispatch to the chaincode in order to process transaction proposals or execute queries.

new Shim()

Methods


<static> error(msg)

Returns a standard response object with status code 200 and an optional payload
Parameters:
Name Type Description
msg string A message describing the error
Returns:
Type
ErrorResponse

<static> newLogger(name)

Returns a winston logger named after name
Parameters:
Name Type Description
name string Logger name used to label log messages produced by the returned logger
Returns:
winston based logger. See winston documentation for usage details
Type
Object

<static> server(chaincode, serverOpts)

Returns a new Chaincode server. Should be called when the chaincode is launched in a server mode.
Parameters:
Name Type Description
chaincode ChaincodeInterface User-provided object that must implement ChaincodeInterface
serverOpts ChaincodeServerOpts Chaincode server options

<static> start(chaincode)

Call this method to start the chaincode process. After constructing a chaincode object, pass the object to this function which will initiate a request to register the chaincode with the target peer. The address of the target peer must be provided via a program argument --peer.address
Parameters:
Name Type Description
chaincode ChaincodeInterface User-provided object that must implement the ChaincodeInterface

<static> success(payload)

Returns a standard response object with status code 200 and an optional payload
Parameters:
Name Type Description
payload Buffer Can be any content the chaincode wish to return to the client
Returns:
Type
SuccessResponse