{"modulePath":"github.com/blockc/fabric","version":"v0.0.0-20170805204507-c410d6675f30","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package chaincode\n\n## Constants\n\n```go\nconst (\n\t// DevModeUserRunsChaincode property allows user to run chaincode in development environment\n\tDevModeUserRunsChaincode string = \"dev\"\n\n\t//TXSimulatorKey is used to attach ledger simulation context\n\tTXSimulatorKey key = \"txsimulatorkey\"\n\n\t//HistoryQueryExecutorKey is used to attach ledger history query executor context\n\tHistoryQueryExecutorKey key = \"historyqueryexecutorkey\"\n)\n```\n\n## Functions\n\n```go\nfunc Execute(ctxt context.Context, cccid *ccprovider.CCContext, spec interface{}) (*pb.Response, *pb.ChaincodeEvent, error)\n```\nExecute - execute proposal, return original response of chaincode\n\n```go\nfunc ExecuteChaincode(ctxt context.Context, cccid *ccprovider.CCContext, args [][]byte) (*pb.Response, *pb.ChaincodeEvent, error)\n```\nExecuteChaincode executes a given chaincode given chaincode name and arguments\n\n```go\nfunc ExecuteWithErrorFilter(ctxt context.Context, cccid *ccprovider.CCContext, spec interface{}) ([]byte, *pb.ChaincodeEvent, error)\n```\nExecuteWithErrorFilter is similar to Execute, but filters error contained in chaincode response and returns Payload of response only. Mostly used by unit-test.\n\n```go\nfunc GetCDSFromLSCC(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) ([]byte, error)\n```\nGetCDSFromLSCC gets chaincode deployment spec from LSCC\n\n```go\nfunc GetChaincodeDataFromLSCC(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) (*ccprovider.ChaincodeData, error)\n```\nGetChaincodeDataFromLSCC gets chaincode data from LSCC given name\n\n```go\nfunc HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, ctxt context.Context, stream ccintf.ChaincodeStream) error\n```\nHandleChaincodeStream Main loop for handling the associated Chaincode stream\n\n```go\nfunc IsDevMode() bool\n```\nIsDevMode returns true if the peer was configured with development-mode enabled\n\n## Types\n\n```go\ntype ChaincodeSupport struct {\n\t// contains filtered or unexported fields\n}\n```\nChaincodeSupport responsible for providing interfacing with chaincodes from the Peer.\n\n```go\nfunc GetChain() *ChaincodeSupport\n```\nGetChain returns the chaincode framework support object\n\n```go\nfunc NewChaincodeSupport(getCCEndpoint func() (*pb.PeerEndpoint, error), userrunsCC bool, ccstartuptimeout time.Duration) *ChaincodeSupport\n```\nNewChaincodeSupport creates a new ChaincodeSupport instance\n\n```go\nfunc (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, cccid *ccprovider.CCContext, msg *pb.ChaincodeMessage, timeout time.Duration) (*pb.ChaincodeMessage, error)\n```\nExecute executes a transaction and waits for it to complete until a timeout value.\n\n```go\nfunc (chaincodeSupport *ChaincodeSupport) HandleChaincodeStream(ctxt context.Context, stream ccintf.ChaincodeStream) error\n```\nHandleChaincodeStream implements ccintf.HandleChaincodeStream for all vms to call with appropriate stream\n\n```go\nfunc (chaincodeSupport *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CCContext, spec interface{}) (*pb.ChaincodeID, *pb.ChaincodeInput, error)\n```\nLaunch will launch the chaincode if not running (if running return nil) and will wait for handler of the chaincode to get into FSM ready state.\n\n```go\nfunc (chaincodeSupport *ChaincodeSupport) Register(stream pb.ChaincodeSupport_RegisterServer) error\n```\nRegister the bidi stream entry point called by chaincode to register with the Peer.\n\n```go\nfunc (chaincodeSupport *ChaincodeSupport) Stop(context context.Context, cccid *ccprovider.CCContext, cds *pb.ChaincodeDeploymentSpec) error\n```\nStop stops a chaincode if running\n\n```go\ntype DuplicateChaincodeHandlerError struct {\n\tChaincodeID *pb.ChaincodeID\n}\n```\nDuplicateChaincodeHandlerError returned if attempt to register same chaincodeID while a stream already exists.\n\n```go\nfunc (d *DuplicateChaincodeHandlerError) Error() string\n```\n\n```go\ntype Handler struct {\n\tsync.RWMutex\n\n\tChatStream  ccintf.ChaincodeStream\n\tFSM         *fsm.FSM\n\tChaincodeID *pb.ChaincodeID\n\t// contains filtered or unexported fields\n}\n```\nHandler responsible for management of Peer's side of chaincode stream\n\n```go\nfunc (handler *Handler) HandleMessage(msg *pb.ChaincodeMessage) error\n```\nHandleMessage implementation of MessageHandler interface.  Peer's handling of Chaincode messages.\n\n```go\ntype MessageHandler interface {\n\tHandleMessage(msg *pb.ChaincodeMessage) error\n\tSendMessage(msg *pb.ChaincodeMessage) error\n}\n```\nMessageHandler interface for handling chaincode messages (common between Peer chaincode support and chaincode)\n\n","path":"github.com/blockc/fabric/core/chaincode","name":"chaincode","synopsis":"","isRedistributable":true}
