Documentation

Overview

    Package txn enables creating, endorsing and sending transactions to Fabric peers and orderers.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func BroadcastPayload

    func BroadcastPayload(reqCtx reqContext.Context, payload *common.Payload, orderers []fab.Orderer) (*fab.TransactionResponse, error)

      BroadcastPayload will send the given payload to some orderer, picking random endpoints until all are exhausted

      func CreateChaincodeInvokeProposal

      func CreateChaincodeInvokeProposal(txh fab.TransactionHeader, request fab.ChaincodeInvokeRequest) (*fab.TransactionProposal, error)

        CreateChaincodeInvokeProposal creates a proposal for transaction.

        func CreateChannelHeader

        func CreateChannelHeader(headerType common.HeaderType, opts ChannelHeaderOpts) (*common.ChannelHeader, error)

          CreateChannelHeader is a utility method to build a common chain header (TODO refactor)

          TODO: Determine if this function should be exported after refactoring is completed.

          func CreatePayload

          func CreatePayload(txh *TransactionHeader, channelHeader *common.ChannelHeader, data []byte) (*common.Payload, error)

            CreatePayload creates a slice of payload bytes from a ChannelHeader and a data slice.

            func CreateSignatureHeader

            func CreateSignatureHeader(txh *TransactionHeader) (*common.SignatureHeader, error)

              CreateSignatureHeader creates a SignatureHeader based on the nonce and creator of the transaction header.

              func New

              func New(request fab.TransactionRequest) (*fab.Transaction, error)

                New create a transaction with proposal response, following the endorsement policy.

                func Send

                func Send(reqCtx reqContext.Context, tx *fab.Transaction, orderers []fab.Orderer) (*fab.TransactionResponse, error)

                  Send send a transaction to the chain’s orderer service (one or more orderer endpoints) for consensus and committing to the ledger.

                  func SendPayload

                  func SendPayload(reqCtx reqContext.Context, payload *common.Payload, orderers []fab.Orderer) (*common.Block, error)

                    SendPayload sends the given payload to each orderer and returns a block response

                    func SendProposal

                    func SendProposal(reqCtx reqContext.Context, proposal *fab.TransactionProposal, targets []fab.ProposalProcessor) ([]*fab.TransactionProposalResponse, error)

                      SendProposal sends a TransactionProposal to ProposalProcessor.

                      Types

                      type CCProposalType

                      type CCProposalType int

                        CCProposalType reflects transitions in the chaincode lifecycle

                        const (
                        	Instantiate CCProposalType = iota
                        	Upgrade
                        )

                          Define chaincode proposal types

                          type ChannelHeaderOpts

                          type ChannelHeaderOpts struct {
                          	TxnHeader   *TransactionHeader
                          	Epoch       uint64
                          	ChaincodeID string
                          	Timestamp   time.Time
                          	TLSCertHash []byte
                          }

                            ChannelHeaderOpts holds the parameters to create a ChannelHeader.

                            type TransactionHeader

                            type TransactionHeader struct {
                            	// contains filtered or unexported fields
                            }

                              TransactionHeader contains metadata for a transaction created by the SDK.

                              func NewHeader

                              func NewHeader(ctx contextApi.Client, channelID string, opts ...fab.TxnHeaderOpt) (*TransactionHeader, error)

                                NewHeader computes a TransactionID from the current user context and holds metadata to create transaction proposals.

                                func (*TransactionHeader) ChannelID

                                func (th *TransactionHeader) ChannelID() string

                                  ChannelID returns the transaction's target channel identifier.

                                  func (*TransactionHeader) Creator

                                  func (th *TransactionHeader) Creator() []byte

                                    Creator returns the transaction creator's identity bytes.

                                    func (*TransactionHeader) Nonce

                                    func (th *TransactionHeader) Nonce() []byte

                                      Nonce returns the transaction's generated nonce.

                                      func (*TransactionHeader) TransactionID

                                      func (th *TransactionHeader) TransactionID() fab.TransactionID

                                        TransactionID returns the transaction's computed identifier.