utils

package
v0.9.21 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBlock

func DecodeBlock(block *common.Block) (*RawBlock, *Block, error)

func GetEvents

func GetEvents(block *common.Block) []*api.EventEntry

func UnmarshalChaincodeAction

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

UnmarshalChaincodeAction unmarshals bytes to a ChaincodeAction

func UnmarshalChaincodeActionPayload

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

UnmarshalChaincodeActionPayload unmarshals bytes to a ChaincodeActionPayload

func UnmarshalChaincodeEvents

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

UnmarshalChaincodeEvents unmarshals bytes to a ChaincodeEvent

func UnmarshalPayload

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

UnmarshalPayload unmarshals bytes to a Payload

func UnmarshalProposalResponsePayload

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

UnmarshalProposalResponsePayload unmarshals bytes to a ProposalResponsePayload

func UnmarshalTransaction

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

UnmarshalTransaction unmarshals bytes to a Transaction

Types

type Action added in v0.9.6

type Action struct {
	Header  *SignatureHeader `json:"header"`
	Payload *ActionPayload   `json:"payload"`
}

type ActionPayload added in v0.9.6

type ActionPayload struct {
	Action                   *ActionPayloadAction      `json:"action"`
	ChaincodeProposalPayload *ChaincodeProposalPayload `json:"chaincode_proposal_payload"`
}

type ActionPayloadAction added in v0.9.6

type ActionPayloadAction struct {
	// Endorsements are not parsed for now
	ProposalResponsePayload *ProposalResponsePayload `json:"proposal_response_payload"`
}

type Block added in v0.9.6

type Block struct {
	Number       uint64 `json:"block_number"`
	DataHash     string `json:"data_hash"`
	PreviousHash string `json:"previous_hash"`

	// only for endorser transaction blocks
	Transactions []*Transaction `json:"transactions,omitempty"`
	// only for Config blocks
	Config *ConfigRecord `json:"config,omitempty"`
}

type BlockData added in v0.9.6

type BlockData struct {
	Data []*BlockDataEnvelope `json:"data"`
}

type BlockDataEnvelope added in v0.9.6

type BlockDataEnvelope struct {
	Payload   *Payload `json:"payload"`
	Signature string   `json:"signature"`
}

type ChaincodeEvent added in v0.9.6

type ChaincodeEvent struct {
	ChaincodeID string      `json:"chaincodeId"`
	TxID        string      `json:"transactionId"`
	Timestamp   string      `json:"timestamp"`
	EventName   string      `json:"eventName"`
	Payload     interface{} `json:"payload"`
}

type ChaincodeProposalPayload added in v0.9.6

type ChaincodeProposalPayload struct {
	TransientMap *map[string][]byte    `json:"TransientMap"`
	Input        *ProposalPayloadInput `json:"input"`
}

type ChaincodeSpec added in v0.9.6

type ChaincodeSpec struct {
	ChaincodeID *peer.ChaincodeID   `json:"chaincode_id"`
	Input       *ChaincodeSpecInput `json:"input"`
	Type        string              `json:"type"`
}

type ChaincodeSpecInput added in v0.9.6

type ChaincodeSpecInput struct {
	Args   []interface{} `json:"args"`
	IsInit bool          `json:"is_init"`
}

type ChannelHeader added in v0.9.6

type ChannelHeader struct {
	ChannelID string `json:"channel_id"`
	Epoch     string `json:"epoch"`
	Timestamp int64  `json:"timestamp"`
	TxID      string `json:"tx_id"`
	Type      string `json:"type"`
	Version   int    `json:"version"`
}

type ConfigRecord added in v0.9.7

type ConfigRecord struct {
	Type      string         `json:"type"`
	Signature string         `json:"signature"`
	Timestamp int64          `json:"timestamp"` // unix nano
	Nonce     string         `json:"nonce"`     // hex string
	Creator   *Creator       `json:"creator"`
	Config    *common.Config `json:"config"`
}

type Creator added in v0.9.7

type Creator struct {
	MspID string `json:"msp_id"`
	Cert  string `json:"cert"`
}

type Extension added in v0.9.6

type Extension struct {
	ChaincodeID *peer.ChaincodeID `json:"chaincode_id"`
	Events      *ChaincodeEvent   `json:"events"`
}

type Payload added in v0.9.6

type Payload struct {
	Data   *PayloadData   `json:"data"`
	Header *PayloadHeader `json:"header"`
}

type PayloadData added in v0.9.6

type PayloadData struct {
	// Actions only exists in endorsement transaction blocks
	Actions []*Action `json:"actions,omitempty"`
	// Config only exists in config and config update blocks
	Config *common.Config `json:"config,omitempty"`
}

type PayloadHeader added in v0.9.6

type PayloadHeader struct {
	ChannelHeader   *ChannelHeader   `json:"channel_header"`
	SignatureHeader *SignatureHeader `json:"signature_header"`
}

type ProposalPayloadInput added in v0.9.6

type ProposalPayloadInput struct {
	ChaincodeSpec *ChaincodeSpec `json:"chaincode_spec"`
}

type ProposalResponsePayload added in v0.9.6

type ProposalResponsePayload struct {
	Extension    *Extension `json:"extension"`
	ProposalHash string     `json:"proposal_hash"`
}

type RawBlock added in v0.9.6

type RawBlock struct {
	Data     *BlockData            `json:"data"`
	Header   *common.BlockHeader   `json:"header"`
	Metadata *common.BlockMetadata `json:"metadata"`
}

func (*RawBlock) DecodeBlockDataEnvelope added in v0.9.6

func (block *RawBlock) DecodeBlockDataEnvelope(env *common.Envelope) (*BlockDataEnvelope, interface{}, error)

type SignatureHeader added in v0.9.6

type SignatureHeader struct {
	Creator *msp.SerializedIdentity `json:"creator"`
	Nonce   string                  `json:"nonce"`
}

type Transaction added in v0.9.6

type Transaction struct {
	Type      string               `json:"type"`
	TxID      string               `json:"tx_id"`
	Nonce     string               `json:"nonce"` // hex string
	Creator   *Creator             `json:"creator"`
	Status    string               `json:"status"`
	Signature string               `json:"signature"`
	Timestamp int64                `json:"timestamp"` // unix nano
	Actions   []*TransactionAction `json:"actions"`
}

type TransactionAction added in v0.9.7

type TransactionAction struct {
	Nonce        string              `json:"nonce"` // hex string
	Creator      *Creator            `json:"creator"`
	TransientMap *map[string][]byte  `json:"transient_map"`
	ChaincodeID  *peer.ChaincodeID   `json:"chaincode_id"`
	Input        *ChaincodeSpecInput `json:"input"`
	ProposalHash string              `json:"proposal_hash"` // hex string
	Event        *ChaincodeEvent     `json:"event"`
}

Jump to

Keyboard shortcuts

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