iproto

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package iproto is a generated protocol buffer package.

It is generated from these files:

blockchain.proto
rpc.proto
utxo.proto

It has these top-level messages:

TxInputPb
TxOutputPb
TxPb
BlockHeaderPb
BlockPb
BlockIndex
PingMsg
PongMsg
BlockSync
BlockContainer
ViewChangeMsg
TestPayload
CreateRawTxRequest
CreateRawTxReply
SendTxRequest
SendTxReply
UtxoPb
UtxoEntryPb
UtxoMapPb

Index

Constants

View Source
const (
	// UnknownProtoMsgType is an unknown message type that is not expected
	UnknownProtoMsgType uint32 = 0
	// MsgTxProtoMsgType is for transactions broadcasted within the network
	MsgTxProtoMsgType uint32 = 1
	// MsgBlockProtoMsgType is for blocks broadcasted within the network
	MsgBlockProtoMsgType uint32 = 2
	// ViewChangeMsgType is for consensus flows within the network
	ViewChangeMsgType uint32 = 3
	// MsgBlockSyncReqType is for requests among peers to sync blocks
	MsgBlockSyncReqType uint32 = 4
	// MsgBlockSyncDataType is the response to messages of type MsgBlockSyncReqType
	MsgBlockSyncDataType uint32 = 5
	// TestPayloadType is a test payload message type
	TestPayloadType uint32 = 10001
)
View Source
const (
	MagicBroadcastMsgHeader uint32 = 4689
)

Magic header to identify IoTex traffic

View Source
const TxInputFixedSize = 44

TxInputFixedSize defines teh fixed size of transaction input

Variables

View Source
var ViewChangeMsg_ViewChangeType_name = map[int32]string{
	0: "INVALID_VIEW_CHANGE_TYPE",
	1: "PROPOSE",
	2: "PREVOTE",
	3: "VOTE",
}
View Source
var ViewChangeMsg_ViewChangeType_value = map[string]int32{
	"INVALID_VIEW_CHANGE_TYPE": 0,
	"PROPOSE":                  1,
	"PREVOTE":                  2,
	"VOTE":                     3,
}

Functions

func GetTypeFromProtoMsg

func GetTypeFromProtoMsg(msg proto.Message) (uint32, error)

GetTypeFromProtoMsg retrieves the proto message type

func RegisterChainServiceServer

func RegisterChainServiceServer(s *grpc.Server, srv ChainServiceServer)

func TypifyProtoMsg

func TypifyProtoMsg(tp uint32, msg []byte) (proto.Message, error)

TypifyProtoMsg unmarshal a proto message based on the given MessageType

Types

type BlockContainer

type BlockContainer struct {
	Block *BlockPb `protobuf:"bytes,1,opt,name=block" json:"block,omitempty"`
}

block container used to send old/existing blocks in block sync

func (*BlockContainer) Descriptor

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

func (*BlockContainer) GetBlock

func (m *BlockContainer) GetBlock() *BlockPb

func (*BlockContainer) ProtoMessage

func (*BlockContainer) ProtoMessage()

func (*BlockContainer) Reset

func (m *BlockContainer) Reset()

func (*BlockContainer) String

func (m *BlockContainer) String() string

type BlockHeaderPb

type BlockHeaderPb struct {
	Version       uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	ChainID       uint32 `protobuf:"varint,2,opt,name=chainID" json:"chainID,omitempty"`
	Height        uint32 `protobuf:"varint,3,opt,name=height" json:"height,omitempty"`
	Timestamp     uint64 `protobuf:"varint,4,opt,name=timestamp" json:"timestamp,omitempty"`
	PrevBlockHash []byte `protobuf:"bytes,5,opt,name=prevBlockHash,proto3" json:"prevBlockHash,omitempty"`
	MerkleRoot    []byte `protobuf:"bytes,6,opt,name=merkleRoot,proto3" json:"merkleRoot,omitempty"`
	TrnxNumber    uint32 `protobuf:"varint,7,opt,name=trnxNumber" json:"trnxNumber,omitempty"`
	TrnxDataSize  uint32 `protobuf:"varint,8,opt,name=trnxDataSize" json:"trnxDataSize,omitempty"`
}

header of a block

func (*BlockHeaderPb) Descriptor

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

func (*BlockHeaderPb) GetChainID

func (m *BlockHeaderPb) GetChainID() uint32

func (*BlockHeaderPb) GetHeight

func (m *BlockHeaderPb) GetHeight() uint32

func (*BlockHeaderPb) GetMerkleRoot

func (m *BlockHeaderPb) GetMerkleRoot() []byte

func (*BlockHeaderPb) GetPrevBlockHash

func (m *BlockHeaderPb) GetPrevBlockHash() []byte

func (*BlockHeaderPb) GetTimestamp

func (m *BlockHeaderPb) GetTimestamp() uint64

func (*BlockHeaderPb) GetTrnxDataSize

func (m *BlockHeaderPb) GetTrnxDataSize() uint32

func (*BlockHeaderPb) GetTrnxNumber

func (m *BlockHeaderPb) GetTrnxNumber() uint32

func (*BlockHeaderPb) GetVersion

func (m *BlockHeaderPb) GetVersion() uint32

func (*BlockHeaderPb) ProtoMessage

func (*BlockHeaderPb) ProtoMessage()

func (*BlockHeaderPb) Reset

func (m *BlockHeaderPb) Reset()

func (*BlockHeaderPb) String

func (m *BlockHeaderPb) String() string

type BlockIndex

type BlockIndex struct {
	Start  uint32   `protobuf:"varint,1,opt,name=start" json:"start,omitempty"`
	End    uint32   `protobuf:"varint,2,opt,name=end" json:"end,omitempty"`
	Offset []uint32 `protobuf:"varint,3,rep,packed,name=offset" json:"offset,omitempty"`
}

index of block raw data file

func (*BlockIndex) Descriptor

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

func (*BlockIndex) GetEnd

func (m *BlockIndex) GetEnd() uint32

func (*BlockIndex) GetOffset

func (m *BlockIndex) GetOffset() []uint32

func (*BlockIndex) GetStart

func (m *BlockIndex) GetStart() uint32

func (*BlockIndex) ProtoMessage

func (*BlockIndex) ProtoMessage()

func (*BlockIndex) Reset

func (m *BlockIndex) Reset()

func (*BlockIndex) String

func (m *BlockIndex) String() string

type BlockPb

type BlockPb struct {
	Header       *BlockHeaderPb `protobuf:"bytes,1,opt,name=Header" json:"Header,omitempty"`
	Transactions []*TxPb        `protobuf:"bytes,2,rep,name=Transactions" json:"Transactions,omitempty"`
}

block consists of header followed by transactions hash of current block can be computed from header hence not stored

func (*BlockPb) Descriptor

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

func (*BlockPb) GetHeader

func (m *BlockPb) GetHeader() *BlockHeaderPb

func (*BlockPb) GetTransactions

func (m *BlockPb) GetTransactions() []*TxPb

func (*BlockPb) ProtoMessage

func (*BlockPb) ProtoMessage()

func (*BlockPb) Reset

func (m *BlockPb) Reset()

func (*BlockPb) String

func (m *BlockPb) String() string

type BlockSync

type BlockSync struct {
	Start uint32 `protobuf:"varint,2,opt,name=start" json:"start,omitempty"`
	End   uint32 `protobuf:"varint,3,opt,name=end" json:"end,omitempty"`
}

func (*BlockSync) Descriptor

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

func (*BlockSync) GetEnd

func (m *BlockSync) GetEnd() uint32

func (*BlockSync) GetStart

func (m *BlockSync) GetStart() uint32

func (*BlockSync) ProtoMessage

func (*BlockSync) ProtoMessage()

func (*BlockSync) Reset

func (m *BlockSync) Reset()

func (*BlockSync) String

func (m *BlockSync) String() string

type ChainServiceClient

type ChainServiceClient interface {
	CreateRawTx(ctx context.Context, in *CreateRawTxRequest, opts ...grpc.CallOption) (*CreateRawTxReply, error)
	SendTx(ctx context.Context, in *SendTxRequest, opts ...grpc.CallOption) (*SendTxReply, error)
}

func NewChainServiceClient

func NewChainServiceClient(cc *grpc.ClientConn) ChainServiceClient

type ChainServiceServer

type ChainServiceServer interface {
	CreateRawTx(context.Context, *CreateRawTxRequest) (*CreateRawTxReply, error)
	SendTx(context.Context, *SendTxRequest) (*SendTxReply, error)
}

type CreateRawTxReply

type CreateRawTxReply struct {
	SerializedTx []byte `protobuf:"bytes,1,opt,name=serialized_tx,json=serializedTx,proto3" json:"serialized_tx,omitempty"`
}

func (*CreateRawTxReply) Descriptor

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

func (*CreateRawTxReply) GetSerializedTx

func (m *CreateRawTxReply) GetSerializedTx() []byte

func (*CreateRawTxReply) ProtoMessage

func (*CreateRawTxReply) ProtoMessage()

func (*CreateRawTxReply) Reset

func (m *CreateRawTxReply) Reset()

func (*CreateRawTxReply) String

func (m *CreateRawTxReply) String() string

type CreateRawTxRequest

type CreateRawTxRequest struct {
	From  string `protobuf:"bytes,1,opt,name=from" json:"from,omitempty"`
	To    string `protobuf:"bytes,2,opt,name=to" json:"to,omitempty"`
	Fee   uint64 `protobuf:"varint,3,opt,name=fee" json:"fee,omitempty"`
	Value uint64 `protobuf:"varint,4,opt,name=value" json:"value,omitempty"`
	Data  []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
}

func (*CreateRawTxRequest) Descriptor

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

func (*CreateRawTxRequest) GetData

func (m *CreateRawTxRequest) GetData() []byte

func (*CreateRawTxRequest) GetFee

func (m *CreateRawTxRequest) GetFee() uint64

func (*CreateRawTxRequest) GetFrom

func (m *CreateRawTxRequest) GetFrom() string

func (*CreateRawTxRequest) GetTo

func (m *CreateRawTxRequest) GetTo() string

func (*CreateRawTxRequest) GetValue

func (m *CreateRawTxRequest) GetValue() uint64

func (*CreateRawTxRequest) ProtoMessage

func (*CreateRawTxRequest) ProtoMessage()

func (*CreateRawTxRequest) Reset

func (m *CreateRawTxRequest) Reset()

func (*CreateRawTxRequest) String

func (m *CreateRawTxRequest) String() string

type PingMsg

type PingMsg struct {
	Nonce uint64 `protobuf:"varint,1,opt,name=nonce" json:"nonce,omitempty"`
}

////////////////////////////////////////////////////////////////////////////////////////////////// BELOW ARE DEFINITIONS FOR ON-WIRE MESSAGES! //////////////////////////////////////////////////////////////////////////////////////////////////

func (*PingMsg) Descriptor

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

func (*PingMsg) GetNonce

func (m *PingMsg) GetNonce() uint64

func (*PingMsg) ProtoMessage

func (*PingMsg) ProtoMessage()

func (*PingMsg) Reset

func (m *PingMsg) Reset()

func (*PingMsg) String

func (m *PingMsg) String() string

type PongMsg

type PongMsg struct {
	AckNonce uint64 `protobuf:"varint,1,opt,name=ack_nonce,json=ackNonce" json:"ack_nonce,omitempty"`
}

func (*PongMsg) Descriptor

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

func (*PongMsg) GetAckNonce

func (m *PongMsg) GetAckNonce() uint64

func (*PongMsg) ProtoMessage

func (*PongMsg) ProtoMessage()

func (*PongMsg) Reset

func (m *PongMsg) Reset()

func (*PongMsg) String

func (m *PongMsg) String() string

type SendTxReply

type SendTxReply struct {
}

func (*SendTxReply) Descriptor

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

func (*SendTxReply) ProtoMessage

func (*SendTxReply) ProtoMessage()

func (*SendTxReply) Reset

func (m *SendTxReply) Reset()

func (*SendTxReply) String

func (m *SendTxReply) String() string

type SendTxRequest

type SendTxRequest struct {
	SerializedTx []byte `protobuf:"bytes,1,opt,name=serialized_tx,json=serializedTx,proto3" json:"serialized_tx,omitempty"`
}

func (*SendTxRequest) Descriptor

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

func (*SendTxRequest) GetSerializedTx

func (m *SendTxRequest) GetSerializedTx() []byte

func (*SendTxRequest) ProtoMessage

func (*SendTxRequest) ProtoMessage()

func (*SendTxRequest) Reset

func (m *SendTxRequest) Reset()

func (*SendTxRequest) String

func (m *SendTxRequest) String() string

type TestPayload

type TestPayload struct {
	MsgBody []byte `protobuf:"bytes,1,opt,name=msg_body,json=msgBody,proto3" json:"msg_body,omitempty"`
}

////////////////////////////////////////////////////////////////////////////////////////////////// BELOW ARE DEFINITIONS FOR TEST-ONLY MESSAGES! //////////////////////////////////////////////////////////////////////////////////////////////////

func (*TestPayload) Descriptor

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

func (*TestPayload) GetMsgBody

func (m *TestPayload) GetMsgBody() []byte

func (*TestPayload) ProtoMessage

func (*TestPayload) ProtoMessage()

func (*TestPayload) Reset

func (m *TestPayload) Reset()

func (*TestPayload) String

func (m *TestPayload) String() string

type TxInputPb

type TxInputPb struct {
	TxHash           []byte `protobuf:"bytes,1,opt,name=txHash,proto3" json:"txHash,omitempty"`
	OutIndex         int32  `protobuf:"varint,2,opt,name=outIndex" json:"outIndex,omitempty"`
	UnlockScriptSize uint32 `protobuf:"varint,3,opt,name=unlockScriptSize" json:"unlockScriptSize,omitempty"`
	UnlockScript     []byte `protobuf:"bytes,4,opt,name=unlockScript,proto3" json:"unlockScript,omitempty"`
	Sequence         uint32 `protobuf:"varint,5,opt,name=sequence" json:"sequence,omitempty"`
}

func (*TxInputPb) ByteStream

func (in *TxInputPb) ByteStream() []byte

ByteStream returns a raw byte stream of transaction input

func (*TxInputPb) Descriptor

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

func (*TxInputPb) GetOutIndex

func (m *TxInputPb) GetOutIndex() int32

func (*TxInputPb) GetSequence

func (m *TxInputPb) GetSequence() uint32

func (*TxInputPb) GetTxHash

func (m *TxInputPb) GetTxHash() []byte

func (*TxInputPb) GetUnlockScript

func (m *TxInputPb) GetUnlockScript() []byte

func (*TxInputPb) GetUnlockScriptSize

func (m *TxInputPb) GetUnlockScriptSize() uint32

func (*TxInputPb) ProtoMessage

func (*TxInputPb) ProtoMessage()

func (*TxInputPb) Reset

func (m *TxInputPb) Reset()

func (*TxInputPb) String

func (m *TxInputPb) String() string

func (*TxInputPb) TotalSize

func (in *TxInputPb) TotalSize() uint32

TotalSize returns the total size (in bytes) of transaction input

func (*TxInputPb) UnlockSuccess

func (in *TxInputPb) UnlockSuccess(lockScript []byte) bool

UnlockSuccess checks whether the TxInput can unlock the provided script

type TxOutputPb

type TxOutputPb struct {
	Value          uint64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
	LockScriptSize uint32 `protobuf:"varint,2,opt,name=lockScriptSize" json:"lockScriptSize,omitempty"`
	LockScript     []byte `protobuf:"bytes,3,opt,name=lockScript,proto3" json:"lockScript,omitempty"`
}

TxOutput stores “coins”. It is indivisible, which means that you cannot reference a part of its value. When an output is referenced in a new transaction, it’s spent as a whole. And if its value is greater than required, a change is generated and sent back to the sender.

func (*TxOutputPb) Descriptor

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

func (*TxOutputPb) GetLockScript

func (m *TxOutputPb) GetLockScript() []byte

func (*TxOutputPb) GetLockScriptSize

func (m *TxOutputPb) GetLockScriptSize() uint32

func (*TxOutputPb) GetValue

func (m *TxOutputPb) GetValue() uint64

func (*TxOutputPb) ProtoMessage

func (*TxOutputPb) ProtoMessage()

func (*TxOutputPb) Reset

func (m *TxOutputPb) Reset()

func (*TxOutputPb) String

func (m *TxOutputPb) String() string

type TxPb

type TxPb struct {
	Version  uint32        `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	NumTxIn  uint32        `protobuf:"varint,2,opt,name=numTxIn" json:"numTxIn,omitempty"`
	TxIn     []*TxInputPb  `protobuf:"bytes,3,rep,name=txIn" json:"txIn,omitempty"`
	NumTxOut uint32        `protobuf:"varint,4,opt,name=numTxOut" json:"numTxOut,omitempty"`
	TxOut    []*TxOutputPb `protobuf:"bytes,5,rep,name=txOut" json:"txOut,omitempty"`
	LockTime uint32        `protobuf:"varint,6,opt,name=lockTime" json:"lockTime,omitempty"`
}

func (*TxPb) Descriptor

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

func (*TxPb) GetLockTime

func (m *TxPb) GetLockTime() uint32

func (*TxPb) GetNumTxIn

func (m *TxPb) GetNumTxIn() uint32

func (*TxPb) GetNumTxOut

func (m *TxPb) GetNumTxOut() uint32

func (*TxPb) GetTxIn

func (m *TxPb) GetTxIn() []*TxInputPb

func (*TxPb) GetTxOut

func (m *TxPb) GetTxOut() []*TxOutputPb

func (*TxPb) GetVersion

func (m *TxPb) GetVersion() uint32

func (*TxPb) ProtoMessage

func (*TxPb) ProtoMessage()

func (*TxPb) Reset

func (m *TxPb) Reset()

func (*TxPb) String

func (m *TxPb) String() string

type UtxoEntryPb

type UtxoEntryPb struct {
	Hash []byte    `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	Utxo []*UtxoPb `protobuf:"bytes,2,rep,name=utxo" json:"utxo,omitempty"`
}

func (*UtxoEntryPb) Descriptor

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

func (*UtxoEntryPb) GetHash

func (m *UtxoEntryPb) GetHash() []byte

func (*UtxoEntryPb) GetUtxo

func (m *UtxoEntryPb) GetUtxo() []*UtxoPb

func (*UtxoEntryPb) ProtoMessage

func (*UtxoEntryPb) ProtoMessage()

func (*UtxoEntryPb) Reset

func (m *UtxoEntryPb) Reset()

func (*UtxoEntryPb) String

func (m *UtxoEntryPb) String() string

type UtxoMapPb

type UtxoMapPb struct {
	UtxoEntry []*UtxoEntryPb `protobuf:"bytes,1,rep,name=utxoEntry" json:"utxoEntry,omitempty"`
}

func (*UtxoMapPb) Descriptor

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

func (*UtxoMapPb) GetUtxoEntry

func (m *UtxoMapPb) GetUtxoEntry() []*UtxoEntryPb

func (*UtxoMapPb) ProtoMessage

func (*UtxoMapPb) ProtoMessage()

func (*UtxoMapPb) Reset

func (m *UtxoMapPb) Reset()

func (*UtxoMapPb) String

func (m *UtxoMapPb) String() string

type UtxoPb

type UtxoPb struct {
	Value          uint64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
	Index          int32  `protobuf:"varint,2,opt,name=index" json:"index,omitempty"`
	LockScriptSize uint32 `protobuf:"varint,3,opt,name=lockScriptSize" json:"lockScriptSize,omitempty"`
	LockScript     []byte `protobuf:"bytes,4,opt,name=lockScript,proto3" json:"lockScript,omitempty"`
}

func (*UtxoPb) Descriptor

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

func (*UtxoPb) GetIndex

func (m *UtxoPb) GetIndex() int32

func (*UtxoPb) GetLockScript

func (m *UtxoPb) GetLockScript() []byte

func (*UtxoPb) GetLockScriptSize

func (m *UtxoPb) GetLockScriptSize() uint32

func (*UtxoPb) GetValue

func (m *UtxoPb) GetValue() uint64

func (*UtxoPb) ProtoMessage

func (*UtxoPb) ProtoMessage()

func (*UtxoPb) Reset

func (m *UtxoPb) Reset()

func (*UtxoPb) String

func (m *UtxoPb) String() string

type ViewChangeMsg

type ViewChangeMsg struct {
	Vctype     ViewChangeMsg_ViewChangeType `protobuf:"varint,1,opt,name=vctype,enum=iproto.ViewChangeMsg_ViewChangeType" json:"vctype,omitempty"`
	Block      *BlockPb                     `protobuf:"bytes,2,opt,name=block" json:"block,omitempty"`
	BlockHash  []byte                       `protobuf:"bytes,3,opt,name=blockHash,proto3" json:"blockHash,omitempty"`
	SenderAddr string                       `protobuf:"bytes,4,opt,name=senderAddr" json:"senderAddr,omitempty"`
}

func (*ViewChangeMsg) Descriptor

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

func (*ViewChangeMsg) GetBlock

func (m *ViewChangeMsg) GetBlock() *BlockPb

func (*ViewChangeMsg) GetBlockHash

func (m *ViewChangeMsg) GetBlockHash() []byte

func (*ViewChangeMsg) GetSenderAddr

func (m *ViewChangeMsg) GetSenderAddr() string

func (*ViewChangeMsg) GetVctype

func (*ViewChangeMsg) ProtoMessage

func (*ViewChangeMsg) ProtoMessage()

func (*ViewChangeMsg) Reset

func (m *ViewChangeMsg) Reset()

func (*ViewChangeMsg) String

func (m *ViewChangeMsg) String() string

type ViewChangeMsg_ViewChangeType

type ViewChangeMsg_ViewChangeType int32
const (
	ViewChangeMsg_INVALID_VIEW_CHANGE_TYPE ViewChangeMsg_ViewChangeType = 0
	ViewChangeMsg_PROPOSE                  ViewChangeMsg_ViewChangeType = 1
	ViewChangeMsg_PREVOTE                  ViewChangeMsg_ViewChangeType = 2
	ViewChangeMsg_VOTE                     ViewChangeMsg_ViewChangeType = 3
)

func (ViewChangeMsg_ViewChangeType) EnumDescriptor

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

func (ViewChangeMsg_ViewChangeType) String

Jump to

Keyboard shortcuts

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