burrow: github.com/hyperledger/burrow/txs Index | Files | Directories

package txs

import "github.com/hyperledger/burrow/txs"

Index

Package Files

envelope.go json_codec.go protobuf_codec.go tx.go txs.pb.go

Constants

const (
    HashLength    = 32
    HashLengthHex = HashLength * 2
)

Variables

var (
    ErrInvalidLengthTxs        = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowTxs          = fmt.Errorf("proto: integer overflow")
    ErrUnexpectedEndOfGroupTxs = fmt.Errorf("proto: unexpected end of group")
)
var Envelope_EncodingType_name = map[int32]string{
    0:  "JSON",
    1:  "RLP",
}
var Envelope_EncodingType_value = map[string]int32{
    "JSON": 0,
    "RLP":  1,
}

func NewJSONCodec Uses

func NewJSONCodec() *jsonCodec

func NewProtobufCodec Uses

func NewProtobufCodec() *protobufCodec

func RLPEncode Uses

func RLPEncode(seq, gasPrice, gasLimit uint64, address, amount, data []byte) ([]byte, error)

type Codec Uses

type Codec interface {
    Encoder
    Decoder
}

type Decoder Uses

type Decoder interface {
    DecodeTx(txBytes []byte) (*Envelope, error)
}

type Encoder Uses

type Encoder interface {
    EncodeTx(envelope *Envelope) ([]byte, error)
}

type Envelope Uses

type Envelope struct {
    Signatories []Signatory `protobuf:"bytes,1,rep,name=Signatories,proto3" json:"Signatories"`
    // Canonical bytes of the Tx ready to be signed
    Tx                   *Tx                   `protobuf:"bytes,2,opt,name=Tx,proto3,customtype=Tx" json:"Tx,omitempty"`
    Encoding             Envelope_EncodingType `protobuf:"varint,3,opt,name=Encoding,proto3,enum=txs.Envelope_EncodingType" json:"Encoding,omitempty"`
    XXX_NoUnkeyedLiteral struct{}              `json:"-"`
    XXX_unrecognized     []byte                `json:"-"`
    XXX_sizecache        int32                 `json:"-"`
}

An envelope contains both the signable Tx and the signatures for each input (in signatories)

func Enclose Uses

func Enclose(chainID string, payload payload.Payload) *Envelope

Enclose a Payload in an Envelope so it is ready to be signed by first wrapping the Payload as a Tx (including ChainID) and writing it to the Tx field of the Envelope

func EnvelopeFromAny Uses

func EnvelopeFromAny(chainID string, p *payload.Any) *Envelope

func (*Envelope) Descriptor Uses

func (*Envelope) Descriptor() ([]byte, []int)

func (*Envelope) Get Uses

func (txEnv *Envelope) Get(key string) (interface{}, bool)

func (*Envelope) GetEncoding Uses

func (m *Envelope) GetEncoding() Envelope_EncodingType

func (*Envelope) GetSignatories Uses

func (m *Envelope) GetSignatories() []Signatory

func (*Envelope) Marshal Uses

func (m *Envelope) Marshal() (dAtA []byte, err error)

func (*Envelope) MarshalTo Uses

func (m *Envelope) MarshalTo(dAtA []byte) (int, error)

func (*Envelope) MarshalToSizedBuffer Uses

func (m *Envelope) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Envelope) ProtoMessage Uses

func (*Envelope) ProtoMessage()

func (*Envelope) Reset Uses

func (m *Envelope) Reset()

func (*Envelope) Sign Uses

func (txEnv *Envelope) Sign(signingAccounts ...acm.AddressableSigner) error

Sign the Tx Envelope by adding Signatories containing the signatures for each TxInput. signing accounts for each input must be provided (in any order).

func (*Envelope) Size Uses

func (m *Envelope) Size() (n int)

func (*Envelope) String Uses

func (txEnv *Envelope) String() string

func (*Envelope) Unmarshal Uses

func (m *Envelope) Unmarshal(dAtA []byte) error

func (*Envelope) Validate Uses

func (txEnv *Envelope) Validate() error

Returns an error if Envelope has a nil transaction or zero signatures (and therefore could not possibly be valid)

func (*Envelope) Verify Uses

func (txEnv *Envelope) Verify(chainID string) error

Verifies the validity of the Signatories' Signatures in the Envelope. The Signatories must appear in the same order as the inputs as returned by Tx.GetInputs().

func (*Envelope) XXX_DiscardUnknown Uses

func (m *Envelope) XXX_DiscardUnknown()

func (*Envelope) XXX_Marshal Uses

func (m *Envelope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Envelope) XXX_Merge Uses

func (m *Envelope) XXX_Merge(src proto.Message)

func (*Envelope) XXX_MessageName Uses

func (*Envelope) XXX_MessageName() string

func (*Envelope) XXX_Size Uses

func (m *Envelope) XXX_Size() int

func (*Envelope) XXX_Unmarshal Uses

func (m *Envelope) XXX_Unmarshal(b []byte) error

type Envelope_EncodingType Uses

type Envelope_EncodingType int32
const (
    Envelope_JSON Envelope_EncodingType = 0
    Envelope_RLP  Envelope_EncodingType = 1
)

func (Envelope_EncodingType) EnumDescriptor Uses

func (Envelope_EncodingType) EnumDescriptor() ([]byte, []int)

func (Envelope_EncodingType) String Uses

func (x Envelope_EncodingType) String() string

type Receipt Uses

type Receipt struct {
    // Transaction type
    TxType github_com_hyperledger_burrow_txs_payload.Type `protobuf:"varint,1,opt,name=TxType,proto3,casttype=github.com/hyperledger/burrow/txs/payload.Type" json:"TxType,omitempty"`
    // The hash of the transaction that caused this event to be generated
    TxHash github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,2,opt,name=TxHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"TxHash"`
    // Whether the transaction creates a contract
    CreatesContract bool `protobuf:"varint,3,opt,name=CreatesContract,proto3" json:"CreatesContract,omitempty"`
    // The address of the contract being called
    ContractAddress      github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,4,opt,name=ContractAddress,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"ContractAddress"`
    XXX_NoUnkeyedLiteral struct{}                                     `json:"-"`
    XXX_unrecognized     []byte                                       `json:"-"`
    XXX_sizecache        int32                                        `json:"-"`
}

BroadcastTx or Transaction receipt

func DecodeReceipt Uses

func DecodeReceipt(bs []byte) (*Receipt, error)

func (*Receipt) Descriptor Uses

func (*Receipt) Descriptor() ([]byte, []int)

func (*Receipt) Encode Uses

func (receipt *Receipt) Encode() ([]byte, error)

func (*Receipt) GetCreatesContract Uses

func (m *Receipt) GetCreatesContract() bool

func (*Receipt) GetTxType Uses

func (m *Receipt) GetTxType() github_com_hyperledger_burrow_txs_payload.Type

func (*Receipt) Marshal Uses

func (m *Receipt) Marshal() (dAtA []byte, err error)

func (*Receipt) MarshalTo Uses

func (m *Receipt) MarshalTo(dAtA []byte) (int, error)

func (*Receipt) MarshalToSizedBuffer Uses

func (m *Receipt) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Receipt) ProtoMessage Uses

func (*Receipt) ProtoMessage()

func (*Receipt) Reset Uses

func (m *Receipt) Reset()

func (*Receipt) Size Uses

func (m *Receipt) Size() (n int)

func (*Receipt) String Uses

func (m *Receipt) String() string

func (*Receipt) Unmarshal Uses

func (m *Receipt) Unmarshal(dAtA []byte) error

func (*Receipt) XXX_DiscardUnknown Uses

func (m *Receipt) XXX_DiscardUnknown()

func (*Receipt) XXX_Marshal Uses

func (m *Receipt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Receipt) XXX_Merge Uses

func (m *Receipt) XXX_Merge(src proto.Message)

func (*Receipt) XXX_MessageName Uses

func (*Receipt) XXX_MessageName() string

func (*Receipt) XXX_Size Uses

func (m *Receipt) XXX_Size() int

func (*Receipt) XXX_Unmarshal Uses

func (m *Receipt) XXX_Unmarshal(b []byte) error

type Signatory Uses

type Signatory struct {
    Address              *github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address,omitempty"`
    PublicKey            *crypto.PublicKey                             `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"`
    Signature            *crypto.Signature                             `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"`
    XXX_NoUnkeyedLiteral struct{}                                      `json:"-"`
    XXX_unrecognized     []byte                                        `json:"-"`
    XXX_sizecache        int32                                         `json:"-"`
}

Signatory contains signature and one or both of Address and PublicKey to identify the signer

func (*Signatory) Descriptor Uses

func (*Signatory) Descriptor() ([]byte, []int)

func (*Signatory) GetPublicKey Uses

func (m *Signatory) GetPublicKey() *crypto.PublicKey

func (*Signatory) GetSignature Uses

func (m *Signatory) GetSignature() *crypto.Signature

func (*Signatory) Marshal Uses

func (m *Signatory) Marshal() (dAtA []byte, err error)

func (*Signatory) MarshalTo Uses

func (m *Signatory) MarshalTo(dAtA []byte) (int, error)

func (*Signatory) MarshalToSizedBuffer Uses

func (m *Signatory) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Signatory) ProtoMessage Uses

func (*Signatory) ProtoMessage()

func (*Signatory) RealisePublicKey Uses

func (s *Signatory) RealisePublicKey(getter acmstate.AccountGetter) error

Attempts to 'realise' the PublicKey and Address of a Signatory possibly referring to state in the case where the Signatory contains an Address by no PublicKey. Checks consistency in other cases, possibly generating the Address from the PublicKey

func (*Signatory) Reset Uses

func (m *Signatory) Reset()

func (*Signatory) Size Uses

func (m *Signatory) Size() (n int)

func (*Signatory) String Uses

func (m *Signatory) String() string

func (*Signatory) Unmarshal Uses

func (m *Signatory) Unmarshal(dAtA []byte) error

func (*Signatory) Validate Uses

func (sig *Signatory) Validate() error

func (*Signatory) XXX_DiscardUnknown Uses

func (m *Signatory) XXX_DiscardUnknown()

func (*Signatory) XXX_Marshal Uses

func (m *Signatory) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Signatory) XXX_Merge Uses

func (m *Signatory) XXX_Merge(src proto.Message)

func (*Signatory) XXX_MessageName Uses

func (*Signatory) XXX_MessageName() string

func (*Signatory) XXX_Size Uses

func (m *Signatory) XXX_Size() int

func (*Signatory) XXX_Unmarshal Uses

func (m *Signatory) XXX_Unmarshal(b []byte) error

type Tx Uses

type Tx struct {
    ChainID string
    payload.Payload
    // contains filtered or unexported fields
}

Tx is the canonical object that we serialise to produce the SignBytes that we sign

func NewTx Uses

func NewTx(payload payload.Payload) *Tx

Wrap the Payload in Tx required for signing and serialisation

func (*Tx) Enclose Uses

func (tx *Tx) Enclose() *Envelope

Enclose this Tx in an Envelope to be signed

func (*Tx) GenerateReceipt Uses

func (tx *Tx) GenerateReceipt() *Receipt

Generate a transaction Receipt containing the Tx hash and other information if the Tx is call. Returned by ABCI methods.

func (*Tx) Get Uses

func (tx *Tx) Get(key string) (interface{}, bool)

func (*Tx) Hash Uses

func (tx *Tx) Hash() binary.HexBytes

Generate a Hash for this transaction based on the SignBytes. The hash is memoized over the lifetime of the Tx so repeated calls to Hash() are effectively free

func (*Tx) Marshal Uses

func (tx *Tx) Marshal() ([]byte, error)

Protobuf support

func (*Tx) MarshalJSON Uses

func (tx *Tx) MarshalJSON() ([]byte, error)

func (*Tx) MarshalTo Uses

func (tx *Tx) MarshalTo(data []byte) (int, error)

func (*Tx) MustSignBytes Uses

func (tx *Tx) MustSignBytes() []byte

Generate SignBytes, panicking on any failure

func (*Tx) Rehash Uses

func (tx *Tx) Rehash() []byte

Regenerate the Tx hash if it has been mutated or as called by Hash() in first instance

func (*Tx) Sign Uses

func (tx *Tx) Sign(signingAccounts ...acm.AddressableSigner) (*Envelope, error)

Encloses in Envelope and signs envelope

func (*Tx) SignBytes Uses

func (tx *Tx) SignBytes(enc Envelope_EncodingType) ([]byte, error)

Produces the canonical SignBytes (the Tx message that will be signed) for a Tx

func (*Tx) Size Uses

func (tx *Tx) Size() int

func (*Tx) String Uses

func (tx *Tx) String() string

func (*Tx) Type Uses

func (tx *Tx) Type() payload.Type

func (*Tx) Unmarshal Uses

func (tx *Tx) Unmarshal(data []byte) error

func (*Tx) UnmarshalJSON Uses

func (tx *Tx) UnmarshalJSON(data []byte) error

Directories

PathSynopsis
payload

Package txs imports 19 packages (graph) and is imported by 125 packages. Updated 2020-04-21. Refresh now. Tools for package owners.