Documentation ¶
Index ¶
- Constants
- func ComputeProposalTxID(nonce, creator []byte) (string, error)
- func ComputeProposalTxIDByGenerator(generator []byte) (string, error)
- func ComputeSHA256(data []byte) (hash []byte)
- func CreateChaincodeProposal(typ cb.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, ...) (*peer.Proposal, string, error)
- func CreateChaincodeProposalWithTransient(typ cb.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, ...) (*peer.Proposal, string, error)
- func CreateChaincodeProposalWithTxIDGeneratorAndTransient(typ cb.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, ...) (*peer.Proposal, string, error)
- func CreateChaincodeProposalWithTxIDNonceAndTransient(txid string, typ cb.HeaderType, chainID string, ...) (*peer.Proposal, string, error)
- func CreateProposalFromCIS(typ cb.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, ...) (*peer.Proposal, string, error)
- func CreateSignedTx(proposal *peer.Proposal, signer *ecdsa.PrivateKey, creator []byte, ...) (*cb.Envelope, error)
- func CreateUtcTimestamp() *timestamp.Timestamp
- func DERToPrivateKey(der []byte) (key interface{}, err error)
- func GetBytesChaincodeActionPayload(cap *peer.ChaincodeActionPayload) ([]byte, error)
- func GetBytesChaincodeProposalPayload(cpp *peer.ChaincodeProposalPayload) ([]byte, error)
- func GetBytesPayload(payl *cb.Payload) ([]byte, error)
- func GetBytesProposal(prop *peer.Proposal) ([]byte, error)
- func GetBytesProposalPayloadForTx(payload *peer.ChaincodeProposalPayload, visibility []byte) ([]byte, error)
- func GetBytesTransaction(tx *peer.Transaction) ([]byte, error)
- func GetChaincodeAction(caBytes []byte) (*peer.ChaincodeAction, error)
- func GetChaincodeActionPayload(capBytes []byte) (*peer.ChaincodeActionPayload, error)
- func GetChaincodeEvents(eBytes []byte) (*peer.ChaincodeEvent, error)
- func GetChaincodeHeaderExtension(hdr *cb.Header) (*peer.ChaincodeHeaderExtension, error)
- func GetChaincodeProposalPayload(bytes []byte) (*peer.ChaincodeProposalPayload, error)
- func GetChaincodeSpecification(chaincodeName string, chaincodeVersion string, funcName string, ...) (*peer.ChaincodeSpec, error)
- func GetCurveHalfOrdersAt(c elliptic.Curve) *big.Int
- func GetEnvelopeFromBlock(data []byte) (*cb.Envelope, error)
- func GetHash() hash.Hash
- func GetHeader(bytes []byte) (*cb.Header, error)
- func GetPayload(e *cb.Envelope) (*cb.Payload, error)
- func GetProposalResponsePayload(prpBytes []byte) (*peer.ProposalResponsePayload, error)
- func GetRandomBytes(len int) ([]byte, error)
- func GetRandomNonce() ([]byte, error)
- func GetSignatureHeader(bytes []byte) (*cb.SignatureHeader, error)
- func GetSignedEvent(evt *peer.Event, signer *ecdsa.PrivateKey) (*peer.SignedEvent, error)
- func GetSignedProposal(prop *peer.Proposal, signer *ecdsa.PrivateKey) (*peer.SignedProposal, error)
- func GetTransaction(txBytes []byte) (*peer.Transaction, error)
- func IsLowS(k *ecdsa.PublicKey, s *big.Int) (bool, error)
- func MarshalECDSASignature(r, s *big.Int) ([]byte, error)
- func MarshalOrPanic(pb proto.Message) []byte
- func PEMtoPrivateKey(raw []byte, pwd []byte) (interface{}, error)
- func ReadCertFile(filepath string) ([]byte, error)
- func ReadPrivateKey(filename string, pwd []byte) (interface{}, error)
- func SerializeCert(certPEM []byte) ([]byte, error)
- func Sign(k *ecdsa.PrivateKey, message []byte) (signature []byte, err error)
- func ToChaincodeArgs(args ...string) [][]byte
- func ToLowS(k *ecdsa.PublicKey, s *big.Int) (*big.Int, bool, error)
- func UnmarshalChannelHeader(bytes []byte) (*cb.ChannelHeader, error)
- func UnmarshalECDSASignature(raw []byte) (*big.Int, *big.Int, error)
- func UnmarshalValidateCodeFromProposalResponse(response *peer.ProposalResponse) (string, error)
- func Verify(k *ecdsa.PublicKey, signature, message []byte) (valid bool, err error)
- type ECDSASignature
- type SerializedIdentity
- type TxValidationFlags
- func (obj TxValidationFlags) Flag(txIndex int) peer.TxValidationCode
- func (obj TxValidationFlags) IsInvalid(txIndex int) bool
- func (obj TxValidationFlags) IsSetTo(txIndex int, flag peer.TxValidationCode) bool
- func (obj TxValidationFlags) IsValid(txIndex int) bool
- func (obj TxValidationFlags) SetFlag(txIndex int, flag peer.TxValidationCode)
Constants ¶
const (
// NonceSize is the default NonceSize
NonceSize = 24
)
Variables ¶
This section is empty.
Functions ¶
func ComputeProposalTxID ¶
ComputeProposalTxID computes TxID as the Hash computed over the concatenation of nonce and creator.
func ComputeSHA256 ¶
ComputeSHA256 returns SHA2-256 on data
func CreateChaincodeProposal ¶
func CreateChaincodeProposal(typ cb.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)
CreateChaincodeProposal creates a proposal from given input. It returns the proposal and the transaction id associated to the proposal
func CreateChaincodeProposalWithTransient ¶
func CreateChaincodeProposalWithTransient(typ cb.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte, transientMap map[string][]byte) (*peer.Proposal, string, error)
CreateChaincodeProposalWithTransient creates a proposal from given input It returns the proposal and the transaction id associated to the proposal
func CreateChaincodeProposalWithTxIDGeneratorAndTransient ¶
func CreateChaincodeProposalWithTxIDGeneratorAndTransient(typ cb.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte, generator []byte, transientMap map[string][]byte) (*peer.Proposal, string, error)
CreateChaincodeProposalWithTransient creates a proposal from given input It returns the proposal and the transaction id associated to the proposal
func CreateChaincodeProposalWithTxIDNonceAndTransient ¶
func CreateChaincodeProposalWithTxIDNonceAndTransient(txid string, typ cb.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, nonce, creator []byte, transientMap map[string][]byte) (*peer.Proposal, string, error)
CreateChaincodeProposalWithTxIDNonceAndTransient creates a proposal from given input
func CreateProposalFromCIS ¶
func CreateProposalFromCIS(typ cb.HeaderType, chainID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)
CreateProposalFromCIS returns a proposal given a serialized identity and a ChaincodeInvocationSpec
func CreateSignedTx ¶
func CreateSignedTx(proposal *peer.Proposal, signer *ecdsa.PrivateKey, creator []byte, resps ...*peer.ProposalResponse) (*cb.Envelope, error)
CreateSignedTx 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
func CreateUtcTimestamp ¶
CreateUtcTimestamp returns a google/protobuf/Timestamp in UTC
func DERToPrivateKey ¶
DERToPrivateKey unmarshals a der to private key
func GetBytesChaincodeActionPayload ¶
func GetBytesChaincodeActionPayload(cap *peer.ChaincodeActionPayload) ([]byte, error)
GetBytesChaincodeActionPayload get the bytes of ChaincodeActionPayload from the message
func GetBytesChaincodeProposalPayload ¶
func GetBytesChaincodeProposalPayload(cpp *peer.ChaincodeProposalPayload) ([]byte, error)
GetBytesChaincodeProposalPayload gets the chaincode proposal payload
func GetBytesPayload ¶
GetBytesPayload get the bytes of Payload from the message
func GetBytesProposal ¶
GetBytesProposal returns the bytes of a proposal message
func GetBytesProposalPayloadForTx ¶
func GetBytesProposalPayloadForTx(payload *peer.ChaincodeProposalPayload, visibility []byte) ([]byte, error)
GetBytesProposalPayloadForTx takes a ChaincodeProposalPayload and returns its serialized version according to the visibility field
func GetBytesTransaction ¶
func GetBytesTransaction(tx *peer.Transaction) ([]byte, error)
GetBytesTransaction get the bytes of Transaction from the message
func GetChaincodeAction ¶
func GetChaincodeAction(caBytes []byte) (*peer.ChaincodeAction, error)
GetChaincodeAction gets the ChaincodeAction given chaicnode action bytes
func GetChaincodeActionPayload ¶
func GetChaincodeActionPayload(capBytes []byte) (*peer.ChaincodeActionPayload, error)
GetChaincodeActionPayload Get ChaincodeActionPayload from bytes
func GetChaincodeEvents ¶
func GetChaincodeEvents(eBytes []byte) (*peer.ChaincodeEvent, error)
GetChaincodeEvents gets the ChaincodeEvents given chaincode event bytes
func GetChaincodeHeaderExtension ¶
func GetChaincodeHeaderExtension(hdr *cb.Header) (*peer.ChaincodeHeaderExtension, error)
GetChaincodeHeaderExtension get chaincode header extension given header
func GetChaincodeProposalPayload ¶
func GetChaincodeProposalPayload(bytes []byte) (*peer.ChaincodeProposalPayload, error)
GetChaincodeProposalPayload Get ChaincodeProposalPayload from bytes
func GetEnvelopeFromBlock ¶
GetEnvelopeFromBlock gets an envelope from a block's Data field.
func GetPayload ¶
GetPayload Get Payload from Envelope message
func GetProposalResponsePayload ¶
func GetProposalResponsePayload(prpBytes []byte) (*peer.ProposalResponsePayload, error)
GetProposalResponsePayload gets the proposal response payload
func GetRandomBytes ¶
GetRandomBytes returns len random looking bytes
func GetRandomNonce ¶
GetRandomNonce returns a random byte array of length NonceSize
func GetSignatureHeader ¶
func GetSignatureHeader(bytes []byte) (*cb.SignatureHeader, error)
GetSignatureHeader Get SignatureHeader from bytes
func GetSignedEvent ¶
func GetSignedEvent(evt *peer.Event, signer *ecdsa.PrivateKey) (*peer.SignedEvent, error)
GetSignedEvent returns a signed event given an Event message and a signing identity
func GetSignedProposal ¶
func GetSignedProposal(prop *peer.Proposal, signer *ecdsa.PrivateKey) (*peer.SignedProposal, error)
GetSignedProposal returns a signed proposal given a Proposal message and a signing identity
func GetTransaction ¶
func GetTransaction(txBytes []byte) (*peer.Transaction, error)
GetTransaction Get Transaction from bytes
func MarshalOrPanic ¶
MarshalOrPanic serializes a protobuf message and panics if this operation fails.
func PEMtoPrivateKey ¶
PEMtoPrivateKey unmarshals a pem to private key
func ReadCertFile ¶
func ReadPrivateKey ¶
func SerializeCert ¶
Serialize returns a byte array representation of this identity
func ToChaincodeArgs ¶
ToChaincodeArgs converts string args to []byte args
func UnmarshalChannelHeader ¶
func UnmarshalChannelHeader(bytes []byte) (*cb.ChannelHeader, error)
UnmarshalChannelHeader returns a ChannelHeader from bytes
func UnmarshalValidateCodeFromProposalResponse ¶
func UnmarshalValidateCodeFromProposalResponse(response *peer.ProposalResponse) (string, error)
Types ¶
type ECDSASignature ¶
type SerializedIdentity ¶
type SerializedIdentity struct { // The identifier of the associated membership service provider Mspid string `protobuf:"bytes,1,opt,name=mspid" json:"mspid,omitempty"` // the Identity, serialized according to the rules of its MPS IdBytes []byte `protobuf:"bytes,2,opt,name=id_bytes,json=idBytes,proto3" json:"id_bytes,omitempty"` }
This struct represents an Identity (with its MSP identifier) to be used to serialize it and deserialize it
func (*SerializedIdentity) GetIdBytes ¶
func (m *SerializedIdentity) GetIdBytes() []byte
func (*SerializedIdentity) GetMspid ¶
func (m *SerializedIdentity) GetMspid() string
func (*SerializedIdentity) ProtoMessage ¶
func (*SerializedIdentity) ProtoMessage()
func (*SerializedIdentity) Reset ¶
func (m *SerializedIdentity) Reset()
func (*SerializedIdentity) String ¶
func (m *SerializedIdentity) String() string
type TxValidationFlags ¶
type TxValidationFlags []uint8
TxValidationFlags is array of transaction validation codes. It is used when committer validates block.
func NewTxValidationFlags ¶
func NewTxValidationFlags(size int) TxValidationFlags
NewTxValidationFlags Create new object-array of validation codes with target size. Default values: valid.
func (TxValidationFlags) Flag ¶
func (obj TxValidationFlags) Flag(txIndex int) peer.TxValidationCode
Flag returns validation code at specified transaction
func (TxValidationFlags) IsInvalid ¶
func (obj TxValidationFlags) IsInvalid(txIndex int) bool
IsInvalid checks if specified transaction is invalid
func (TxValidationFlags) IsSetTo ¶
func (obj TxValidationFlags) IsSetTo(txIndex int, flag peer.TxValidationCode) bool
IsSetTo returns true if the specified transaction equals flag; false otherwise.
func (TxValidationFlags) IsValid ¶
func (obj TxValidationFlags) IsValid(txIndex int) bool
IsValid checks if specified transaction is valid
func (TxValidationFlags) SetFlag ¶
func (obj TxValidationFlags) SetFlag(txIndex int, flag peer.TxValidationCode)
SetFlag assigns validation code to specified transaction