{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package utils\n\n## Functions\n\n```go\nfunc ChannelHeader(env *cb.Envelope) (*cb.ChannelHeader, error)\n```\nChannelHeader returns the \\*cb.ChannelHeader for a given \\*cb.Envelope.\n\n```go\nfunc ChannelID(env *cb.Envelope) (string, error)\n```\nChannelID returns the Channel ID for a given \\*cb.Envelope.\n\n```go\nfunc CheckTxID(txid string, nonce, creator []byte) error\n```\nCheckTxID checks that txid is equal to the Hash computed over the concatenation of nonce and creator.\n\n```go\nfunc ComputeProposalBinding(proposal *peer.Proposal) ([]byte, error)\n```\nComputeProposalBinding computes the binding of a proposal\n\n```go\nfunc ComputeTxID(nonce, creator []byte) (string, error)\n```\nComputeTxID computes TxID as the Hash computed over the concatenation of nonce and creator.\n\n```go\nfunc CopyBlockMetadata(src *cb.Block, dst *cb.Block)\n```\nCopyBlockMetadata copies metadata from one block into another\n\n```go\nfunc CreateChaincodeProposal(typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)\n```\nCreateChaincodeProposal creates a proposal from given input. It returns the proposal and the transaction id associated to the proposal\n\n```go\nfunc CreateChaincodeProposalWithTransient(typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte, transientMap map[string][]byte) (*peer.Proposal, string, error)\n```\nCreateChaincodeProposalWithTransient creates a proposal from given input It returns the proposal and the transaction id associated to the proposal\n\n```go\nfunc CreateChaincodeProposalWithTxIDAndTransient(typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte, txid string, transientMap map[string][]byte) (*peer.Proposal, string, error)\n```\nCreateChaincodeProposalWithTxIDAndTransient creates a proposal from given input. It returns the proposal and the transaction id associated with the proposal\n\n```go\nfunc CreateChaincodeProposalWithTxIDNonceAndTransient(txid string, typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, nonce, creator []byte, transientMap map[string][]byte) (*peer.Proposal, string, error)\n```\nCreateChaincodeProposalWithTxIDNonceAndTransient creates a proposal from given input\n\n```go\nfunc CreateDeployProposalFromCDS(\n\tchainID string,\n\tcds *peer.ChaincodeDeploymentSpec,\n\tcreator []byte,\n\tpolicy []byte,\n\tescc []byte,\n\tvscc []byte,\n\tcollectionConfig []byte) (*peer.Proposal, string, error)\n```\nCreateDeployProposalFromCDS returns a deploy proposal given a serialized identity and a ChaincodeDeploymentSpec\n\n```go\nfunc CreateGetChaincodesProposal(chainID string, creator []byte) (*peer.Proposal, string, error)\n```\nCreateGetChaincodesProposal returns a GETCHAINCODES proposal given a serialized identity\n\n```go\nfunc CreateGetInstalledChaincodesProposal(creator []byte) (*peer.Proposal, string, error)\n```\nCreateGetInstalledChaincodesProposal returns a GETINSTALLEDCHAINCODES proposal given a serialized identity\n\n```go\nfunc CreateInstallProposalFromCDS(ccpack proto.Message, creator []byte) (*peer.Proposal, string, error)\n```\nCreateInstallProposalFromCDS returns a install proposal given a serialized identity and a ChaincodeDeploymentSpec\n\n```go\nfunc CreateNonce() ([]byte, error)\n```\nCreateNonce generates a nonce using the common/crypto package.\n\n```go\nfunc CreateNonceOrPanic() []byte\n```\nCreateNonceOrPanic generates a nonce using the common/crypto package and panics if this operation fails.\n\n```go\nfunc CreateProposalFromCIS(typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)\n```\nCreateProposalFromCIS returns a proposal given a serialized identity and a ChaincodeInvocationSpec\n\n```go\nfunc CreateProposalFromCISAndTxid(txid string, typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)\n```\nCreateProposalFromCISAndTxid returns a proposal given a serialized identity and a ChaincodeInvocationSpec\n\n```go\nfunc CreateProposalResponse(hdrbytes []byte, payl []byte, response *peer.Response, results []byte, events []byte, ccid *peer.ChaincodeID, visibility []byte, signingEndorser msp.SigningIdentity) (*peer.ProposalResponse, error)\n```\nCreateProposalResponse creates a proposal response.\n\n```go\nfunc CreateProposalResponseFailure(hdrbytes []byte, payl []byte, response *peer.Response, results []byte, events []byte, ccid *peer.ChaincodeID, visibility []byte) (*peer.ProposalResponse, error)\n```\nCreateProposalResponseFailure creates a proposal response for cases where endorsement proposal fails either due to a endorsement failure or a chaincode failure (chaincode response status \u003e= shim.ERRORTHRESHOLD)\n\n```go\nfunc CreateSignedEnvelope(txType common.HeaderType, channelID string, signer crypto.LocalSigner, dataMsg proto.Message, msgVersion int32, epoch uint64) (*common.Envelope, error)\n```\nCreateSignedEnvelope creates a signed envelope of the desired type, with marshaled dataMsg and signs it\n\n```go\nfunc CreateSignedEnvelopeWithTLSBinding(txType common.HeaderType, channelID string, signer crypto.LocalSigner, dataMsg proto.Message, msgVersion int32, epoch uint64, tlsCertHash []byte) (*common.Envelope, error)\n```\nCreateSignedEnvelopeWithTLSBinding creates a signed envelope of the desired type, with marshaled dataMsg and signs it. It also includes a TLS cert hash into the channel header\n\n```go\nfunc CreateSignedTx(proposal *peer.Proposal, signer msp.SigningIdentity, resps ...*peer.ProposalResponse) (*common.Envelope, error)\n```\nCreateSignedTx assembles an Envelope message from proposal, endorsements, and a signer. This function should be called by a client when it has collected enough endorsements for a proposal to create a transaction and submit it to peers for ordering\n\n```go\nfunc CreateUpgradeProposalFromCDS(\n\tchainID string,\n\tcds *peer.ChaincodeDeploymentSpec,\n\tcreator []byte,\n\tpolicy []byte,\n\tescc []byte,\n\tvscc []byte,\n\tcollectionConfig []byte) (*peer.Proposal, string, error)\n```\nCreateUpgradeProposalFromCDS returns a upgrade proposal given a serialized identity and a ChaincodeDeploymentSpec\n\n```go\nfunc EnvelopeToConfigUpdate(configtx *cb.Envelope) (*cb.ConfigUpdateEnvelope, error)\n```\nEnvelopeToConfigUpdate is used to extract a ConfigUpdateEnvelope from an envelope of type CONFIG\\_UPDATE\n\n```go\nfunc ExtractEnvelope(block *cb.Block, index int) (*cb.Envelope, error)\n```\nExtractEnvelope retrieves the requested envelope from a given block and unmarshals it\n\n```go\nfunc ExtractEnvelopeOrPanic(block *cb.Block, index int) *cb.Envelope\n```\nExtractEnvelopeOrPanic retrieves the requested envelope from a given block and unmarshals it -- it panics if either of these operations fail\n\n```go\nfunc ExtractPayload(envelope *cb.Envelope) (*cb.Payload, error)\n```\nExtractPayload retrieves the payload of a given envelope and unmarshals it.\n\n```go\nfunc ExtractPayloadOrPanic(envelope *cb.Envelope) *cb.Payload\n```\nExtractPayloadOrPanic retrieves the payload of a given envelope and unmarshals it -- it panics if either of these operations fail\n\n```go\nfunc GetActionFromEnvelope(envBytes []byte) (*peer.ChaincodeAction, error)\n```\nGetActionFromEnvelope extracts a ChaincodeAction message from a serialized Envelope TODO: fix function name as per FAB-11831\n\n```go\nfunc GetActionFromEnvelopeMsg(env *common.Envelope) (*peer.ChaincodeAction, error)\n```\n\n```go\nfunc GetBlockFromBlockBytes(blockBytes []byte) (*cb.Block, error)\n```\nGetBlockFromBlockBytes marshals the bytes into Block\n\n```go\nfunc GetBytesChaincodeActionPayload(cap *peer.ChaincodeActionPayload) ([]byte, error)\n```\nGetBytesChaincodeActionPayload get the bytes of ChaincodeActionPayload from the message\n\n```go\nfunc GetBytesChaincodeEvent(event *peer.ChaincodeEvent) ([]byte, error)\n```\nGetBytesChaincodeEvent gets the bytes of ChaincodeEvent\n\n```go\nfunc GetBytesChaincodeProposalPayload(cpp *peer.ChaincodeProposalPayload) ([]byte, error)\n```\nGetBytesChaincodeProposalPayload gets the chaincode proposal payload\n\n```go\nfunc GetBytesEnvelope(env *common.Envelope) ([]byte, error)\n```\nGetBytesEnvelope get the bytes of Envelope from the message\n\n```go\nfunc GetBytesHeader(hdr *common.Header) ([]byte, error)\n```\nGetBytesHeader get the bytes of Header from the message\n\n```go\nfunc GetBytesPayload(payl *common.Payload) ([]byte, error)\n```\nGetBytesPayload get the bytes of Payload from the message\n\n```go\nfunc GetBytesProposal(prop *peer.Proposal) ([]byte, error)\n```\nGetBytesProposal returns the bytes of a proposal message\n\n```go\nfunc GetBytesProposalPayloadForTx(payload *peer.ChaincodeProposalPayload, visibility []byte) ([]byte, error)\n```\nGetBytesProposalPayloadForTx takes a ChaincodeProposalPayload and returns its serialized version according to the visibility field\n\n```go\nfunc GetBytesProposalResponse(pr *peer.ProposalResponse) ([]byte, error)\n```\nGetBytesProposalResponse gets proposal bytes response\n\n```go\nfunc GetBytesProposalResponsePayload(hash []byte, response *peer.Response, result []byte, event []byte, ccid *peer.ChaincodeID) ([]byte, error)\n```\nGetBytesProposalResponsePayload gets proposal response payload\n\n```go\nfunc GetBytesResponse(res *peer.Response) ([]byte, error)\n```\nGetBytesResponse gets the bytes of Response\n\n```go\nfunc GetBytesSignatureHeader(hdr *common.SignatureHeader) ([]byte, error)\n```\nGetBytesSignatureHeader get the bytes of SignatureHeader from the message\n\n```go\nfunc GetBytesTransaction(tx *peer.Transaction) ([]byte, error)\n```\nGetBytesTransaction get the bytes of Transaction from the message\n\n```go\nfunc GetChainIDFromBlock(block *cb.Block) (string, error)\n```\nGetChainIDFromBlock returns chain ID in the block\n\n```go\nfunc GetChainIDFromBlockBytes(bytes []byte) (string, error)\n```\nGetChainIDFromBlockBytes returns chain ID given byte array which represents the block\n\n```go\nfunc GetChaincodeAction(caBytes []byte) (*peer.ChaincodeAction, error)\n```\nGetChaincodeAction gets the ChaincodeAction given chaicnode action bytes\n\n```go\nfunc GetChaincodeActionPayload(capBytes []byte) (*peer.ChaincodeActionPayload, error)\n```\nGetChaincodeActionPayload Get ChaincodeActionPayload from bytes\n\n```go\nfunc GetChaincodeDeploymentSpec(code []byte, pr *platforms.Registry) (*peer.ChaincodeDeploymentSpec, error)\n```\nGetChaincodeDeploymentSpec returns a ChaincodeDeploymentSpec given args\n\n```go\nfunc GetChaincodeEvents(eBytes []byte) (*peer.ChaincodeEvent, error)\n```\nGetChaincodeEvents gets the ChaincodeEvents given chaincode event bytes\n\n```go\nfunc GetChaincodeHeaderExtension(hdr *common.Header) (*peer.ChaincodeHeaderExtension, error)\n```\nGetChaincodeHeaderExtension get chaincode header extension given header\n\n```go\nfunc GetChaincodeInvocationSpec(prop *peer.Proposal) (*peer.ChaincodeInvocationSpec, error)\n```\nGetChaincodeInvocationSpec get the ChaincodeInvocationSpec from the proposal\n\n```go\nfunc GetChaincodeProposalContext(prop *peer.Proposal) ([]byte, map[string][]byte, error)\n```\nGetChaincodeProposalContext returns creator and transient\n\n```go\nfunc GetChaincodeProposalPayload(bytes []byte) (*peer.ChaincodeProposalPayload, error)\n```\nGetChaincodeProposalPayload Get ChaincodeProposalPayload from bytes\n\n```go\nfunc GetEnvelopeFromBlock(data []byte) (*common.Envelope, error)\n```\nGetEnvelopeFromBlock gets an envelope from a block's Data field.\n\n```go\nfunc GetHeader(bytes []byte) (*common.Header, error)\n```\nGetHeader Get Header from bytes\n\n```go\nfunc GetLastConfigIndexFromBlock(block *cb.Block) (uint64, error)\n```\nGetLastConfigIndexFromBlock retrieves the index of the last config block as encoded in the block metadata\n\n```go\nfunc GetLastConfigIndexFromBlockOrPanic(block *cb.Block) uint64\n```\nGetLastConfigIndexFromBlockOrPanic retrieves the index of the last config block as encoded in the block metadata, or panics on error\n\n```go\nfunc GetMetadataFromBlock(block *cb.Block, index cb.BlockMetadataIndex) (*cb.Metadata, error)\n```\nGetMetadataFromBlock retrieves metadata at the specified index.\n\n```go\nfunc GetMetadataFromBlockOrPanic(block *cb.Block, index cb.BlockMetadataIndex) *cb.Metadata\n```\nGetMetadataFromBlockOrPanic retrieves metadata at the specified index, or panics on error\n\n```go\nfunc GetNonce(prop *peer.Proposal) ([]byte, error)\n```\nGetNonce returns the nonce used in Proposal\n\n```go\nfunc GetOrComputeTxIDFromEnvelope(txEnvelopBytes []byte) (string, error)\n```\nGetOrComputeTxIDFromEnvelope gets the txID present in a given transaction envelope. If the txID is empty, it constructs the txID from nonce and creator fields in the envelope.\n\n```go\nfunc GetPayload(e *common.Envelope) (*common.Payload, error)\n```\nGetPayload Get Payload from Envelope message\n\n```go\nfunc GetPayloads(txActions *peer.TransactionAction) (*peer.ChaincodeActionPayload, *peer.ChaincodeAction, error)\n```\nGetPayloads gets the underlying payload objects in a TransactionAction\n\n```go\nfunc GetProposal(propBytes []byte) (*peer.Proposal, error)\n```\nGetProposal returns a Proposal message from its bytes\n\n```go\nfunc GetProposalHash1(header *common.Header, ccPropPayl []byte, visibility []byte) ([]byte, error)\n```\nGetProposalHash1 gets the proposal hash bytes after sanitizing the chaincode proposal payload according to the rules of visibility\n\n```go\nfunc GetProposalHash2(header *common.Header, ccPropPayl []byte) ([]byte, error)\n```\nGetProposalHash2 gets the proposal hash - this version is called by the committer where the visibility policy has already been enforced and so we already get what we have to get in ccPropPayl\n\n```go\nfunc GetProposalResponse(prBytes []byte) (*peer.ProposalResponse, error)\n```\nGetProposalResponse given proposal in bytes\n\n```go\nfunc GetProposalResponsePayload(prpBytes []byte) (*peer.ProposalResponsePayload, error)\n```\nGetProposalResponsePayload gets the proposal response payload\n\n```go\nfunc GetResponse(resBytes []byte) (*peer.Response, error)\n```\nGetResponse gets the Response given response bytes\n\n```go\nfunc GetSignatureHeader(bytes []byte) (*common.SignatureHeader, error)\n```\nGetSignatureHeader Get SignatureHeader from bytes\n\n```go\nfunc GetSignedProposal(prop *peer.Proposal, signer msp.SigningIdentity) (*peer.SignedProposal, error)\n```\nGetSignedProposal returns a signed proposal given a Proposal message and a signing identity\n\n```go\nfunc GetTransaction(txBytes []byte) (*peer.Transaction, error)\n```\nGetTransaction Get Transaction from bytes\n\n```go\nfunc InitBlockMetadata(block *cb.Block)\n```\nInitBlockMetadata copies metadata from one block into another\n\n```go\nfunc IsConfigBlock(block *cb.Block) bool\n```\nIsConfigBlock validates whenever given block contains configuration update transaction\n\n```go\nfunc MakeChannelHeader(headerType cb.HeaderType, version int32, chainID string, epoch uint64) *cb.ChannelHeader\n```\nMakeChannelHeader creates a ChannelHeader.\n\n```go\nfunc MakePayloadHeader(ch *cb.ChannelHeader, sh *cb.SignatureHeader) *cb.Header\n```\nMakePayloadHeader creates a Payload Header.\n\n```go\nfunc MakeSignatureHeader(serializedCreatorCertChain []byte, nonce []byte) *cb.SignatureHeader\n```\nMakeSignatureHeader creates a SignatureHeader.\n\n```go\nfunc Marshal(pb proto.Message) ([]byte, error)\n```\nMarshal serializes a protobuf message.\n\n```go\nfunc MarshalOrPanic(pb proto.Message) []byte\n```\nMarshalOrPanic serializes a protobuf message and panics if this operation fails\n\n```go\nfunc MockSignedEndorserProposal2OrPanic(chainID string, cs *peer.ChaincodeSpec, signer msp.SigningIdentity) (*peer.SignedProposal, *peer.Proposal)\n```\n\n```go\nfunc MockSignedEndorserProposalOrPanic(chainID string, cs *peer.ChaincodeSpec, creator, signature []byte) (*peer.SignedProposal, *peer.Proposal)\n```\nMockSignedEndorserProposalOrPanic creates a SignedProposal with the passed arguments\n\n```go\nfunc NewSignatureHeaderOrPanic(signer crypto.LocalSigner) *cb.SignatureHeader\n```\nNewSignatureHeaderOrPanic returns a signature header and panics on error.\n\n```go\nfunc SetTxID(channelHeader *cb.ChannelHeader, signatureHeader *cb.SignatureHeader) error\n```\nSetTxID generates a transaction id based on the provided signature header and sets the TxId field in the channel header\n\n```go\nfunc SignOrPanic(signer crypto.LocalSigner, msg []byte) []byte\n```\nSignOrPanic signs a message and panics on error.\n\n```go\nfunc UnmarshalBlock(encoded []byte) (*cb.Block, error)\n```\nUnmarshalBlock unmarshals bytes to an Block structure\n\n```go\nfunc UnmarshalBlockOrPanic(encoded []byte) *cb.Block\n```\nUnmarshalBlockOrPanic unmarshals bytes to an Block structure or panics on error\n\n```go\nfunc UnmarshalChaincodeDeploymentSpec(cdsBytes []byte) (*peer.ChaincodeDeploymentSpec, error)\n```\nUnmarshalChaincodeDeploymentSpec unmarshals a ChaincodeDeploymentSpec from the provided bytes\n\n```go\nfunc UnmarshalChaincodeID(bytes []byte) (*pb.ChaincodeID, error)\n```\nUnmarshalChaincodeID returns a ChaincodeID from bytes\n\n```go\nfunc UnmarshalChannelHeader(bytes []byte) (*cb.ChannelHeader, error)\n```\nUnmarshalChannelHeader returns a ChannelHeader from bytes\n\n```go\nfunc UnmarshalChannelHeaderOrPanic(bytes []byte) *cb.ChannelHeader\n```\nUnmarshalChannelHeaderOrPanic unmarshals bytes to a ChannelHeader or panics on error\n\n```go\nfunc UnmarshalEnvelope(encoded []byte) (*cb.Envelope, error)\n```\nUnmarshalEnvelope unmarshals bytes to an Envelope structure\n\n```go\nfunc UnmarshalEnvelopeOfType(envelope *cb.Envelope, headerType cb.HeaderType, message proto.Message) (*cb.ChannelHeader, error)\n```\nUnmarshalEnvelopeOfType unmarshals an envelope of the specified type, including unmarshaling the payload data\n\n```go\nfunc UnmarshalEnvelopeOrPanic(encoded []byte) *cb.Envelope\n```\nUnmarshalEnvelopeOrPanic unmarshals bytes to an Envelope structure or panics on error\n\n```go\nfunc UnmarshalPayload(encoded []byte) (*cb.Payload, error)\n```\nUnmarshalPayload unmarshals bytes to a Payload structure\n\n```go\nfunc UnmarshalPayloadOrPanic(encoded []byte) *cb.Payload\n```\nUnmarshalPayloadOrPanic unmarshals bytes to a Payload structure or panics on error\n\n```go\nfunc UnmarshalSignatureHeader(bytes []byte) (*cb.SignatureHeader, error)\n```\nUnmarshalSignatureHeader unmarshals bytes to a SignatureHeader.\n\n```go\nfunc UnmarshalSignatureHeaderOrPanic(bytes []byte) *cb.SignatureHeader\n```\nUnmarshalSignatureHeaderOrPanic unmarshals bytes to a SignatureHeader.\n\n","path":"github.com/eric-erki/https-hyperledger.org/protos/utils","name":"utils","synopsis":"","isRedistributable":true}
