utils

package
v0.0.0-...-fbe82ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelHeader

func ChannelHeader(env *cb.Envelope) (*cb.ChannelHeader, error)

channelheader返回给定*cb.envelope的*cb.channelheader。

func ChannelID

func ChannelID(env *cb.Envelope) (string, error)

channel id返回给定*cb.envelope的通道ID。

func CheckTxID

func CheckTxID(txid string, nonce, creator []byte) error

checktxid检查txid是否等于计算的哈希值 超越了nonce和creator的连接。

func ComputeProposalBinding

func ComputeProposalBinding(proposal *peer.Proposal) ([]byte, error)

计算提案绑定计算提案的绑定

func ComputeTxID

func ComputeTxID(nonce, creator []byte) (string, error)

computetxid将txid计算为哈希 超越了nonce和creator的连接。

func CopyBlockMetadata

func CopyBlockMetadata(src *cb.Block, dst *cb.Block)

copyblockmetadata将元数据从一个块复制到另一个块

func CreateChaincodeProposal

func CreateChaincodeProposal(typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)

CreateChaincodeProposal根据给定的输入创建建议。 它返回建议和与建议关联的事务ID

func CreateChaincodeProposalWithTransient

func CreateChaincodeProposalWithTransient(typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte, transientMap map[string][]byte) (*peer.Proposal, string, error)

CreateChaincodeProposalWithTransient从给定输入创建建议 它返回建议和与建议关联的事务ID

func CreateChaincodeProposalWithTxIDAndTransient

func CreateChaincodeProposalWithTxIDAndTransient(typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte, txid string, transientMap map[string][]byte) (*peer.Proposal, string, error)

CreateChaincodeProposalWithTxidAndTransient根据给定的 输入。它返回与 建议

func CreateChaincodeProposalWithTxIDNonceAndTransient

func CreateChaincodeProposalWithTxIDNonceAndTransient(txid string, typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, nonce, creator []byte, transientMap map[string][]byte) (*peer.Proposal, string, error)

CreateChaincodeProposalWithTxidUncleandTransient从创建建议 给定输入

func CreateDeployProposalFromCDS

func CreateDeployProposalFromCDS(
	chainID string,
	cds *peer.ChaincodeDeploymentSpec,
	creator []byte,
	policy []byte,
	escc []byte,
	vscc []byte,
	collectionConfig []byte) (*peer.Proposal, string, error)

createdDeployProposalFromCDS返回一个给定序列化的部署建议 标识和链代码部署

func CreateGetChaincodesProposal

func CreateGetChaincodesProposal(chainID string, creator []byte) (*peer.Proposal, string, error)

creategetchaincodesproposal返回给定的getchaincodes建议 序列化标识

func CreateGetInstalledChaincodesProposal

func CreateGetInstalledChaincodesProposal(creator []byte) (*peer.Proposal, string, error)

CreateGetInstalledChaincodesProposal返回GetInstalledChaincodes 提供了序列化标识的建议

func CreateInstallProposalFromCDS

func CreateInstallProposalFromCDS(ccpack proto.Message, creator []byte) (*peer.Proposal, string, error)

CreateSinstallProposalFromCDS返回一个给定序列化的安装建议 标识和链代码部署

func CreateNonce

func CreateNonce() ([]byte, error)

creatence使用common/crypto包生成一个nonce。

func CreateNonceOrPanic

func CreateNonceOrPanic() []byte

CreateNoncoorpanic使用公共/加密包生成一个nonce 如果这个操作失败的话会很恐慌。

func CreateProposalFromCIS

func CreateProposalFromCIS(typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)

CreateProposalFromCIS返回给定序列化标识和 链码调用spec

func CreateProposalFromCISAndTxid

func CreateProposalFromCISAndTxid(txid string, typ common.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)

CreateProposalFromCisandXid返回给定序列化标识的建议 以及一个链码调用pec

func CreateProposalResponse

func CreateProposalResponse(hdrbytes []byte, payl []byte, response *peer.Response, results []byte, events []byte, ccid *peer.ChaincodeID, visibility []byte, signingEndorser msp.SigningIdentity) (*peer.ProposalResponse, error)

CreateProposalResponse创建建议响应。

func CreateProposalResponseFailure

func CreateProposalResponseFailure(hdrbytes []byte, payl []byte, response *peer.Response, results []byte, events []byte, ccid *peer.ChaincodeID, visibility []byte) (*peer.ProposalResponse, error)

CreateProposalResponseFailure为以下情况创建建议响应: 背书提议因背书失败或 链码故障(链码响应状态>=Shim.ErrorThreshold)

func CreateSignedEnvelope

func CreateSignedEnvelope(txType common.HeaderType, channelID string, signer crypto.LocalSigner, dataMsg proto.Message, msgVersion int32, epoch uint64) (*common.Envelope, error)

CreateSignedDevelope创建所需类型的签名信封, 已封送datamsg并签名

func CreateSignedEnvelopeWithTLSBinding

func CreateSignedEnvelopeWithTLSBinding(txType common.HeaderType, channelID string, signer crypto.LocalSigner, dataMsg proto.Message, msgVersion int32, epoch uint64, tlsCertHash []byte) (*common.Envelope, error)

CreateSignedDevelopeWithtlsBinding创建所需的签名信封 键入,并用封送的datamsg对其进行签名。它还包括一个tls证书哈希 进入通道标题

func CreateSignedTx

func CreateSignedTx(proposal *peer.Proposal, signer msp.SigningIdentity, resps ...*peer.ProposalResponse) (*common.Envelope, error)

CreateSignedTx从建议、背书、 签名人。当客户端调用此函数时, 为建议收集足够的背书以创建交易和 提交同行订购

func CreateUpgradeProposalFromCDS

func CreateUpgradeProposalFromCDS(
	chainID string,
	cds *peer.ChaincodeDeploymentSpec,
	creator []byte,
	policy []byte,
	escc []byte,
	vscc []byte,
	collectionConfig []byte) (*peer.Proposal, string, error)

CreateUpgradeProposalFromCDS返回给定序列化的升级建议 标识和链代码部署

func EnvelopeToConfigUpdate

func EnvelopeToConfigUpdate(configtx *cb.Envelope) (*cb.ConfigUpdateEnvelope, error)

EnvelopeToConfigUpdate用于从 类型配置\更新

func ExtractEnvelope

func ExtractEnvelope(block *cb.Block, index int) (*cb.Envelope, error)

提取信封从给定的块中检索请求的信封,并 解封它

func ExtractEnvelopeOrPanic

func ExtractEnvelopeOrPanic(block *cb.Block, index int) *cb.Envelope

ExtractEnvelopeOrpanic从给定的块中检索请求的信封 取消标记——如果这些操作中的任何一个失败,它都会恐慌。

func ExtractPayload

func ExtractPayload(envelope *cb.Envelope) (*cb.Payload, error)

ExtractPayload检索给定信封的有效负载并将其取消标记。

func ExtractPayloadOrPanic

func ExtractPayloadOrPanic(envelope *cb.Envelope) *cb.Payload

extractpayloadorpanic检索给定信封的有效负载,并 取消标记——如果这些操作中的任何一个失败,它都会恐慌。

func GetActionFromEnvelope

func GetActionFromEnvelope(envBytes []byte) (*peer.ChaincodeAction, error)

GetActionFromEnvelope从 序列化信封 TODO:根据FAB-11831修复函数名

func GetActionFromEnvelopeMsg

func GetActionFromEnvelopeMsg(env *common.Envelope) (*peer.ChaincodeAction, error)

func GetBlockFromBlockBytes

func GetBlockFromBlockBytes(blockBytes []byte) (*cb.Block, error)

GetBlockFromBlockBytes将字节封送到块中

func GetBytesChaincodeActionPayload

func GetBytesChaincodeActionPayload(cap *peer.ChaincodeActionPayload) ([]byte, error)

GetBytesChainCodeActionPayload从 消息

func GetBytesChaincodeEvent

func GetBytesChaincodeEvent(event *peer.ChaincodeEvent) ([]byte, error)

GetByteschaincodeEvent获取chaincodeEvent的字节数

func GetBytesChaincodeProposalPayload

func GetBytesChaincodeProposalPayload(cpp *peer.ChaincodeProposalPayload) ([]byte, error)

GetBytesChainCodeProposalPayload获取链码建议负载

func GetBytesEnvelope

func GetBytesEnvelope(env *common.Envelope) ([]byte, error)

GetBytesInvelope从消息中获取信封的字节数

func GetBytesHeader

func GetBytesHeader(hdr *common.Header) ([]byte, error)

GetBytesHeader从消息中获取头的字节数

func GetBytesPayload

func GetBytesPayload(payl *common.Payload) ([]byte, error)

get bytes payload从消息中获取有效负载的字节数

func GetBytesProposal

func GetBytesProposal(prop *peer.Proposal) ([]byte, error)

GetBytesProposal返回建议消息的字节数

func GetBytesProposalPayloadForTx

func GetBytesProposalPayloadForTx(payload *peer.ChaincodeProposalPayload, visibility []byte) ([]byte, error)

GetBytesProposalPayloadfortx接受chaincodeProposalPayload并返回 它的序列化版本根据可见性字段

func GetBytesProposalResponse

func GetBytesProposalResponse(pr *peer.ProposalResponse) ([]byte, error)

GetBytesProposalResponse获取建议字节响应

func GetBytesProposalResponsePayload

func GetBytesProposalResponsePayload(hash []byte, response *peer.Response, result []byte, event []byte, ccid *peer.ChaincodeID) ([]byte, error)

GetBytesProposalResponsePayLoad获取建议响应负载

func GetBytesResponse

func GetBytesResponse(res *peer.Response) ([]byte, error)

GetBytesResponse获取响应字节数

func GetBytesSignatureHeader

func GetBytesSignatureHeader(hdr *common.SignatureHeader) ([]byte, error)

GetBytesSignatureHeader从消息中获取SignatureHeader的字节数

func GetBytesTransaction

func GetBytesTransaction(tx *peer.Transaction) ([]byte, error)

GetBytesTransaction从消息中获取事务的字节数

func GetChainIDFromBlock

func GetChainIDFromBlock(block *cb.Block) (string, error)

getchainidfromblock返回块中的链ID

func GetChainIDFromBlockBytes

func GetChainIDFromBlockBytes(bytes []byte) (string, error)

getchainidfromblockbytes返回给定字节数组的链ID,该数组表示 街区

func GetChaincodeAction

func GetChaincodeAction(caBytes []byte) (*peer.ChaincodeAction, error)

getchaincodeaction获取给定chaincode action字节的chaincodeaction

func GetChaincodeActionPayload

func GetChaincodeActionPayload(capBytes []byte) (*peer.ChaincodeActionPayload, error)

get chaincodeactionpayload从字节获取chaincodeactionpayload

func GetChaincodeDeploymentSpec

func GetChaincodeDeploymentSpec(code []byte, pr *platforms.Registry) (*peer.ChaincodeDeploymentSpec, error)

getchaincodedeploymentspec返回给定参数的chaincodedeploymentspec

func GetChaincodeEvents

func GetChaincodeEvents(eBytes []byte) (*peer.ChaincodeEvent, error)

getchaincodevents获取给定chaincode事件字节的chaincodeevents

func GetChaincodeHeaderExtension

func GetChaincodeHeaderExtension(hdr *common.Header) (*peer.ChaincodeHeaderExtension, error)

get chaincode header extension获取给定头段的链码头扩展

func GetChaincodeInvocationSpec

func GetChaincodeInvocationSpec(prop *peer.Proposal) (*peer.ChaincodeInvocationSpec, error)

get chaincodeinvocationspec从建议获取chaincodeinvocationspec

func GetChaincodeProposalContext

func GetChaincodeProposalContext(prop *peer.Proposal) ([]byte, map[string][]byte, error)

getchaincoderoposalContext返回creator和transient

func GetChaincodeProposalPayload

func GetChaincodeProposalPayload(bytes []byte) (*peer.ChaincodeProposalPayload, error)

getchaincodeProposalPayload从字节获取chaincodeProposalPayload

func GetEnvelopeFromBlock

func GetEnvelopeFromBlock(data []byte) (*common.Envelope, error)

GetEnvelopeFromBlock从块的数据字段获取信封。

func GetHeader

func GetHeader(bytes []byte) (*common.Header, error)

从字节获取头

func GetLastConfigIndexFromBlock

func GetLastConfigIndexFromBlock(block *cb.Block) (uint64, error)

GetLastConfigIndexFromBlock检索最后一个配置块的索引为 在块元数据中编码

func GetLastConfigIndexFromBlockOrPanic

func GetLastConfigIndexFromBlockOrPanic(block *cb.Block) uint64

GetLastConfigIndexFromBlockOrPanic检索最后一个配置的索引 块在块元数据中编码,或出错时死机

func GetMetadataFromBlock

func GetMetadataFromBlock(block *cb.Block, index cb.BlockMetadataIndex) (*cb.Metadata, error)

GetMetadataFromBlock在指定索引处检索元数据。

func GetMetadataFromBlockOrPanic

func GetMetadataFromBlockOrPanic(block *cb.Block, index cb.BlockMetadataIndex) *cb.Metadata

GetMetadataFromBlockOrpanic检索指定索引处的元数据,或者 关于错误的恐慌

func GetNonce

func GetNonce(prop *peer.Proposal) ([]byte, error)

getnonce返回建议中使用的nonce

func GetPayload

func GetPayload(e *common.Envelope) (*common.Payload, error)

从信封消息获取有效负载

func GetPayloads

getpayloads获取事务操作中的底层有效负载对象

func GetProposal

func GetProposal(propBytes []byte) (*peer.Proposal, error)

GetProposal从其字节返回建议消息

func GetProposalHash1

func GetProposalHash1(header *common.Header, ccPropPayl []byte, visibility []byte) ([]byte, error)

GetProposalHash1在清理 根据可见性规则的chaincode建议有效负载

func GetProposalHash2

func GetProposalHash2(header *common.Header, ccPropPayl []byte) ([]byte, error)

getProposalHash2获取建议哈希-此版本 由提交者调用,其中可见性策略 已经被强制执行了,所以我们已经得到了 我们得上车

func GetProposalResponse

func GetProposalResponse(prBytes []byte) (*peer.ProposalResponse, error)

GetProposalResponse给定的建议(字节)

func GetProposalResponsePayload

func GetProposalResponsePayload(prpBytes []byte) (*peer.ProposalResponsePayload, error)

GetProposalResponsePayLoad获取提案响应负载

func GetResponse

func GetResponse(resBytes []byte) (*peer.Response, error)

GetResponse获取给定响应字节的响应

func GetSignatureHeader

func GetSignatureHeader(bytes []byte) (*common.SignatureHeader, error)

GetSignatureHeader从字节获取SignatureHeader

func GetSignedProposal

func GetSignedProposal(prop *peer.Proposal, signer msp.SigningIdentity) (*peer.SignedProposal, error)

GetSignedProposal返回一个已签名的建议,给出建议消息和 签名身份

func GetTransaction

func GetTransaction(txBytes []byte) (*peer.Transaction, error)

GetTransaction从字节获取事务

func InitBlockMetadata

func InitBlockMetadata(block *cb.Block)

initblockmetadata将元数据从一个块复制到另一个块

func IsConfigBlock

func IsConfigBlock(block *cb.Block) bool

只要给定的块包含配置,isconfigBlock就会进行验证。 更新交易记录

func MakeChannelHeader

func MakeChannelHeader(headerType cb.HeaderType, version int32, chainID string, epoch uint64) *cb.ChannelHeader

makechannelheader创建一个channelheader。

func MakePayloadHeader

func MakePayloadHeader(ch *cb.ChannelHeader, sh *cb.SignatureHeader) *cb.Header

makePayloadHeader创建有效负载头。

func MakeSignatureHeader

func MakeSignatureHeader(serializedCreatorCertChain []byte, nonce []byte) *cb.SignatureHeader

MakeSignatureHeader创建一个SignatureHeader。

func Marshal

func Marshal(pb proto.Message) ([]byte, error)

marshal序列化protobuf消息。

func MarshalOrPanic

func MarshalOrPanic(pb proto.Message) []byte

marshalorpanic序列化protobuf消息,如果此 操作失败

func MockSignedEndorserProposal2OrPanic

func MockSignedEndorserProposal2OrPanic(chainID string, cs *peer.ChaincodeSpec, signer msp.SigningIdentity) (*peer.SignedProposal, *peer.Proposal)

func MockSignedEndorserProposalOrPanic

func MockSignedEndorserProposalOrPanic(chainID string, cs *peer.ChaincodeSpec, creator, signature []byte) (*peer.SignedProposal, *peer.Proposal)

mockSignedOnersProposalOrpanic使用 传递的参数

func NewSignatureHeaderOrPanic

func NewSignatureHeaderOrPanic(signer crypto.LocalSigner) *cb.SignatureHeader

NewSignatureHeaderOrpanic返回签名头并在出错时恐慌。

func SetTxID

func SetTxID(channelHeader *cb.ChannelHeader, signatureHeader *cb.SignatureHeader) error

setxid根据提供的签名头生成事务ID 并在通道标题中设置txid字段

func SignOrPanic

func SignOrPanic(signer crypto.LocalSigner, msg []byte) []byte

signorpanic对消息进行签名,并在出错时惊慌失措。

func UnmarshalBlock

func UnmarshalBlock(encoded []byte) (*cb.Block, error)

取消标记块将字节取消标记为块结构

func UnmarshalBlockOrPanic

func UnmarshalBlockOrPanic(encoded []byte) *cb.Block

将字节取消标记为块结构或panics 关于误差

func UnmarshalChaincodeDeploymentSpec

func UnmarshalChaincodeDeploymentSpec(cdsBytes []byte) (*peer.ChaincodeDeploymentSpec, error)

取消标记haincodedeploymentspec取消标记chaincodedeploymentspec自 提供的字节

func UnmarshalChaincodeID

func UnmarshalChaincodeID(bytes []byte) (*pb.ChaincodeID, error)

unmashalchaincodeid从字节返回chaincodeid

func UnmarshalChannelHeader

func UnmarshalChannelHeader(bytes []byte) (*cb.ChannelHeader, error)

UnmarshalChannelHeader从字节返回ChannelHeader

func UnmarshalChannelHeaderOrPanic

func UnmarshalChannelHeaderOrPanic(bytes []byte) *cb.ChannelHeader

取消对频道头或频道头的标记将字节取消对频道头或频道头的标记 关于误差

func UnmarshalEnvelope

func UnmarshalEnvelope(encoded []byte) (*cb.Envelope, error)

将字节取消标记为信封结构

func UnmarshalEnvelopeOfType

func UnmarshalEnvelopeOfType(envelope *cb.Envelope, headerType cb.HeaderType, message proto.Message) (*cb.ChannelHeader, error)

unmashlendevelopeoftype取消标记指定类型的信封, 包括有效载荷数据的解组

func UnmarshalEnvelopeOrPanic

func UnmarshalEnvelopeOrPanic(encoded []byte) *cb.Envelope

将字节取消标记为信封结构或panics 关于误差

func UnmarshalPayload

func UnmarshalPayload(encoded []byte) (*cb.Payload, error)

将字节取消标记为有效负载结构

func UnmarshalPayloadOrPanic

func UnmarshalPayloadOrPanic(encoded []byte) *cb.Payload

将字节取消标记为有效负载结构或PANIC 关于误差

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL