{"modulePath":"https-1xa.pages.dev/hyperledger/fabric","version":"v2.1.1+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package chaincode\n\n## Functions\n\n```go\nfunc ChaincodeInvokeOrQuery(\n\tspec *pb.ChaincodeSpec,\n\tcID string,\n\ttxID string,\n\tinvoke bool,\n\tsigner identity.SignerSerializer,\n\tcertificate tls.Certificate,\n\tendorserClients []pb.EndorserClient,\n\tdeliverClients []pb.DeliverClient,\n\tbc common.BroadcastClient,\n) (*pb.ProposalResponse, error)\n```\nChaincodeInvokeOrQuery invokes or queries the chaincode. If successful, the INVOKE form prints the ProposalResponse to STDOUT, and the QUERY form prints the query result on STDOUT. A command-line flag (-r, --raw) determines whether the query result is output as raw bytes, or as a printable string. The printable form is optionally (-x, --hex) a hexadecimal representation of the query response. If the query response is NIL, nothing is output.\n\nNOTE - Query will likely go away as all interactions with the endorser are Proposal and ProposalResponses\n\n```go\nfunc Cmd(cf *ChaincodeCmdFactory, cryptoProvider bccsp.BCCSP) *cobra.Command\n```\nCmd returns the cobra command for Chaincode\n\n```go\nfunc GetCollectionConfigFromFile(ccFile string) (*pb.CollectionConfigPackage, []byte, error)\n```\nGetCollectionConfigFromFile retrieves the collection configuration from the supplied file; the supplied file must contain a json-formatted array of collectionConfigJson elements\n\n## Types\n\n```go\ntype ChaincodeCmdFactory struct {\n\tEndorserClients []pb.EndorserClient\n\tDeliverClients  []pb.DeliverClient\n\tCertificate     tls.Certificate\n\tSigner          identity.SignerSerializer\n\tBroadcastClient common.BroadcastClient\n}\n```\nChaincodeCmdFactory holds the clients used by ChaincodeCmd\n\n```go\nfunc InitCmdFactory(cmdName string, isEndorserRequired, isOrdererRequired bool, cryptoProvider bccsp.BCCSP) (*ChaincodeCmdFactory, error)\n```\nInitCmdFactory init the ChaincodeCmdFactory with default clients\n\n```go\ntype DeliverClient struct {\n\tClient     pb.DeliverClient\n\tConnection pb.Deliver_DeliverClient\n\tAddress    string\n}\n```\nDeliverClient holds the client/connection related to a specific peer. The address is included for logging purposes\n\n```go\ntype DeliverGroup struct {\n\tClients     []*DeliverClient\n\tCertificate tls.Certificate\n\tChannelID   string\n\tTxID        string\n\tSigner      identity.SignerSerializer\n\n\tError error\n\t// contains filtered or unexported fields\n}\n```\nDeliverGroup holds all of the information needed to connect to a set of peers to wait for the interested txid to be committed to the ledgers of all peers. This functionality is currently implemented via the peer's DeliverFiltered service. An error from any of the peers/deliver clients will result in the invoke command returning an error. Only the first error that occurs will be set\n\n```go\nfunc NewDeliverGroup(\n\tdeliverClients []pb.DeliverClient,\n\tpeerAddresses []string,\n\tsigner identity.SignerSerializer,\n\tcertificate tls.Certificate,\n\tchannelID string,\n\ttxid string,\n) *DeliverGroup\n```\n\n```go\nfunc (dg *DeliverGroup) ClientConnect(ctx context.Context, dc *DeliverClient)\n```\nClientConnect sends a deliver seek info envelope using the provided deliver client, setting the deliverGroup's Error field upon any error\n\n```go\nfunc (dg *DeliverGroup) ClientWait(dc *DeliverClient)\n```\nClientWait waits for the specified deliver client to receive a block event with the requested txid\n\n```go\nfunc (dg *DeliverGroup) Connect(ctx context.Context) error\n```\nConnect waits for all deliver clients in the group to connect to the peer's deliver service, receive an error, or for the context to timeout. An error will be returned whenever even a single deliver client fails to connect to its peer\n\n```go\nfunc (dg *DeliverGroup) Wait(ctx context.Context) error\n```\nWait waits for all deliver client connections in the group to either receive a block with the txid, an error, or for the context to timeout\n\n```go\nfunc (dg *DeliverGroup) WaitForWG(readyCh chan struct{})\n```\nWaitForWG waits for the deliverGroup's wait group and closes the channel when ready\n\n```go\ntype InstallInput struct {\n\tName        string\n\tVersion     string\n\tLanguage    string\n\tPackageFile string\n\tPath        string\n}\n```\nInstallInput holds the input parameters for installing a chaincode\n\n```go\ntype Installer struct {\n\tCommand         *cobra.Command\n\tEndorserClients []pb.EndorserClient\n\tInput           *InstallInput\n\tSigner          identity.SignerSerializer\n\tCryptoProvider  bccsp.BCCSP\n}\n```\nInstaller holds the dependencies needed to install a chaincode\n\n```go\ntype PackageInput struct {\n\tName                  string\n\tVersion               string\n\tInstantiationPolicy   string\n\tCreateSignedCCDepSpec bool\n\tSignCCDepSpec         bool\n\tOutputFile            string\n\tPath                  string\n\tType                  string\n}\n```\nPackageInput holds the input parameters for packaging a ChaincodeInstallPackage\n\n```go\ntype Packager struct {\n\tCDSFactory          ccDepSpecFactory\n\tChaincodeCmdFactory *ChaincodeCmdFactory\n\tCommand             *cobra.Command\n\tInput               *PackageInput\n\tCryptoProvider      bccsp.BCCSP\n}\n```\nPackager holds the dependencies needed to package a chaincode and write it\n\n","path":"https-1xa.pages.dev/hyperledger/fabric/internal/peer/chaincode","name":"chaincode","synopsis":"","isRedistributable":true}
