fabric-sdk-go: github.com/hyperledger/fabric-sdk-go/pkg/fab/txn Index | Files

package txn

import "github.com/hyperledger/fabric-sdk-go/pkg/fab/txn"

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


Package Files

env.go proposal.go txn.go

func BroadcastPayload Uses

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 Uses

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

CreateChaincodeInvokeProposal creates a proposal for transaction.

func CreateChannelHeader Uses

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 Uses

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 Uses

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

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

func New Uses

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

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

func Send Uses

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 Uses

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 Uses

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

SendProposal sends a TransactionProposal to ProposalProcessor.

type CCProposalType Uses

type CCProposalType int

CCProposalType reflects transitions in the chaincode lifecycle

const (
    Instantiate CCProposalType = iota

Define chaincode proposal types

type ChannelHeaderOpts Uses

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

ChannelHeaderOpts holds the parameters to create a ChannelHeader.

type TransactionHeader Uses

type TransactionHeader struct {
    // contains filtered or unexported fields

TransactionHeader contains metadata for a transaction created by the SDK.

func NewHeader Uses

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 Uses

func (th *TransactionHeader) ChannelID() string

ChannelID returns the transaction's target channel identifier.

func (*TransactionHeader) Creator Uses

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

Creator returns the transaction creator's identity bytes.

func (*TransactionHeader) Nonce Uses

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

Nonce returns the transaction's generated nonce.

func (*TransactionHeader) TransactionID Uses

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

TransactionID returns the transaction's computed identifier.

Package txn imports 19 packages (graph) and is imported by 5 packages. Updated 2020-01-07. Refresh now. Tools for package owners.