Documentation ¶
Overview ¶
Package proto is a generated protocol buffer package.
It is generated from these files:
block.proto message.proto transaction.proto
It has these top-level messages:
BlockHeader Block GetBlocksMsg StatusMsg GetInvMsg OnBlockMsg OnTransactionMsg GetDataMsg ContractSpec TxHeader Transaction
Index ¶
- Variables
- type Block
- func (*Block) Descriptor() ([]byte, []int)
- func (b *Block) Deserialize(data []byte) error
- func (m *Block) GetHeader() *BlockHeader
- func (m *Block) GetTransactions() []*Transaction
- func (b *Block) Hash() crypto.Hash
- func (b *Block) Height() uint32
- func (b *Block) PreviousHash() string
- func (*Block) ProtoMessage()
- func (m *Block) Reset()
- func (b *Block) Serialize() []byte
- func (m *Block) String() string
- type BlockHeader
- func (*BlockHeader) Descriptor() ([]byte, []int)
- func (bh *BlockHeader) Deserialize(data []byte) error
- func (m *BlockHeader) GetHeight() uint32
- func (m *BlockHeader) GetNonce() uint32
- func (m *BlockHeader) GetPreviousHash() string
- func (m *BlockHeader) GetStateHash() string
- func (m *BlockHeader) GetTimeStamp() uint32
- func (m *BlockHeader) GetTxsMerkleHash() string
- func (bh *BlockHeader) Hash() crypto.Hash
- func (*BlockHeader) ProtoMessage()
- func (m *BlockHeader) Reset()
- func (bh *BlockHeader) Serialize() []byte
- func (m *BlockHeader) String() string
- type ContractSpec
- type GetBlocksMsg
- func (*GetBlocksMsg) Descriptor() ([]byte, []int)
- func (m *GetBlocksMsg) GetHashStop() string
- func (m *GetBlocksMsg) GetLocatorHashes() []string
- func (m *GetBlocksMsg) GetVersion() uint32
- func (m *GetBlocksMsg) MarshalMsg() ([]byte, error)
- func (*GetBlocksMsg) ProtoMessage()
- func (m *GetBlocksMsg) Reset()
- func (m *GetBlocksMsg) String() string
- func (m *GetBlocksMsg) UnmarshalMsg(data []byte) error
- type GetDataMsg
- type GetInvMsg
- func (*GetInvMsg) Descriptor() ([]byte, []int)
- func (m *GetInvMsg) GetHashs() []string
- func (m *GetInvMsg) GetType() InvType
- func (m *GetInvMsg) MarshalMsg() ([]byte, error)
- func (*GetInvMsg) ProtoMessage()
- func (m *GetInvMsg) Reset()
- func (m *GetInvMsg) String() string
- func (m *GetInvMsg) UnmarshalMsg(data []byte) error
- type IInventory
- type IMsg
- type InvType
- type MsgType
- type OnBlockMsg
- type OnTransactionMsg
- func (*OnTransactionMsg) Descriptor() ([]byte, []int)
- func (m *OnTransactionMsg) GetTransaction() *Transaction
- func (m *OnTransactionMsg) MarshalMsg() ([]byte, error)
- func (*OnTransactionMsg) ProtoMessage()
- func (m *OnTransactionMsg) Reset()
- func (m *OnTransactionMsg) String() string
- func (m *OnTransactionMsg) UnmarshalMsg(data []byte) error
- type ProtoID
- type StatusMsg
- func (*StatusMsg) Descriptor() ([]byte, []int)
- func (m *StatusMsg) GetStartHeight() uint32
- func (m *StatusMsg) GetVersion() uint32
- func (m *StatusMsg) MarshalMsg() ([]byte, error)
- func (*StatusMsg) ProtoMessage()
- func (m *StatusMsg) Reset()
- func (m *StatusMsg) String() string
- func (m *StatusMsg) UnmarshalMsg(data []byte) error
- type Transaction
- func (tx *Transaction) Amount() int64
- func (tx *Transaction) AssetID() uint32
- func (tx *Transaction) Compare(v interface{}) int
- func (tx *Transaction) CreateTime() uint32
- func (*Transaction) Descriptor() ([]byte, []int)
- func (tx *Transaction) Deserialize(data []byte) error
- func (tx *Transaction) Fee() int64
- func (tx *Transaction) FromChain() string
- func (m *Transaction) GetContractSpec() *ContractSpec
- func (m *Transaction) GetHeader() *TxHeader
- func (m *Transaction) GetMeta() []byte
- func (m *Transaction) GetPayload() []byte
- func (tx *Transaction) GetType() TransactionType
- func (tx *Transaction) Hash() crypto.Hash
- func (tx *Transaction) IsLocalChain() bool
- func (tx *Transaction) Nonce() uint32
- func (*Transaction) ProtoMessage()
- func (tx *Transaction) Recipient() account.Address
- func (m *Transaction) Reset()
- func (tx *Transaction) Sender() account.Address
- func (tx *Transaction) Serialize() []byte
- func (tx *Transaction) SignHash() crypto.Hash
- func (m *Transaction) String() string
- func (tx *Transaction) ToChain() string
- func (tx *Transaction) Verfiy() (account.Address, error)
- func (tx *Transaction) WithSignature(sig *crypto.Signature)
- type TransactionType
- type Transactions
- type TxHeader
- func (*TxHeader) Descriptor() ([]byte, []int)
- func (m *TxHeader) GetAmount() int64
- func (m *TxHeader) GetAssetID() uint32
- func (m *TxHeader) GetCreateTime() uint32
- func (m *TxHeader) GetFee() int64
- func (m *TxHeader) GetFromChain() []byte
- func (m *TxHeader) GetNonce() uint32
- func (m *TxHeader) GetRecipient() string
- func (m *TxHeader) GetSender() string
- func (m *TxHeader) GetSignature() []byte
- func (m *TxHeader) GetToChain() []byte
- func (m *TxHeader) GetType() TransactionType
- func (*TxHeader) ProtoMessage()
- func (m *TxHeader) Reset()
- func (m *TxHeader) String() string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptySignature represents no signature ErrEmptySignature = errors.New("Signature Empty Error") )
var InvType_name = map[int32]string{
0: "block",
1: "transaction",
}
var InvType_value = map[string]int32{
"block": 0,
"transaction": 1,
}
var MsgType_name = map[int32]string{
0: "BC_GetBlocksMsg",
1: "BC_GetInvMsg",
2: "BC_GetDataMsg",
3: "BC_OnBlockMsg",
4: "BC_OnTransactionMsg",
5: "BC_OnStatusMSg",
6: "BC_OnConsensusMSg",
}
var MsgType_value = map[string]int32{
"BC_GetBlocksMsg": 0,
"BC_GetInvMsg": 1,
"BC_GetDataMsg": 2,
"BC_OnBlockMsg": 3,
"BC_OnTransactionMsg": 4,
"BC_OnStatusMSg": 5,
"BC_OnConsensusMSg": 6,
}
var ProtoID_name = map[int32]string{
0: "NA",
1: "SyncWorker",
2: "ConsensusWorker",
}
var ProtoID_value = map[string]int32{
"NA": 0,
"SyncWorker": 1,
"ConsensusWorker": 2,
}
var TransactionType_name = map[int32]string{
0: "Atomic",
1: "AcrossChain",
2: "Merged",
3: "Backfront",
4: "Distribut",
5: "Issue",
6: "IssueUpdate",
7: "JSContractInit",
8: "LuaContractInit",
9: "ContractInvoke",
10: "ContractQuery",
11: "Security",
}
var TransactionType_value = map[string]int32{
"Atomic": 0,
"AcrossChain": 1,
"Merged": 2,
"Backfront": 3,
"Distribut": 4,
"Issue": 5,
"IssueUpdate": 6,
"JSContractInit": 7,
"LuaContractInit": 8,
"ContractInvoke": 9,
"ContractQuery": 10,
"Security": 11,
}
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Header *BlockHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` Transactions []*Transaction `protobuf:"bytes,2,rep,name=transactions" json:"transactions,omitempty"` }
func NewBlock ¶
func NewBlock(prvHash, stateHash crypto.Hash, timeStamp, height, nonce uint32, txsHash crypto.Hash, Txs Transactions) *Block
NewBlock returns an new block
func (*Block) Descriptor ¶
func (*Block) Deserialize ¶
Deserialize deserializes bytes to Block
func (*Block) GetHeader ¶
func (m *Block) GetHeader() *BlockHeader
func (*Block) GetTransactions ¶
func (m *Block) GetTransactions() []*Transaction
func (*Block) PreviousHash ¶
PreviousHash returns the previous hash of the block
func (*Block) ProtoMessage ¶
func (*Block) ProtoMessage()
type BlockHeader ¶
type BlockHeader struct { PreviousHash string `protobuf:"bytes,1,opt,name=previousHash" json:"previousHash,omitempty"` StateHash string `protobuf:"bytes,2,opt,name=stateHash" json:"stateHash,omitempty"` TimeStamp uint32 `protobuf:"varint,3,opt,name=timeStamp" json:"timeStamp,omitempty"` Nonce uint32 `protobuf:"varint,4,opt,name=nonce" json:"nonce,omitempty"` TxsMerkleHash string `protobuf:"bytes,5,opt,name=txsMerkleHash" json:"txsMerkleHash,omitempty"` Height uint32 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"` }
func NewBlockHeader ¶
func NewBlockHeader(prvHash, stateHash crypto.Hash, timeStamp, height, nonce uint32, txsHash crypto.Hash) *BlockHeader
NewBlockHeader returns a blockheader
func (*BlockHeader) Descriptor ¶
func (*BlockHeader) Descriptor() ([]byte, []int)
func (*BlockHeader) Deserialize ¶
func (bh *BlockHeader) Deserialize(data []byte) error
Deserialize deserialize the input data to header
func (*BlockHeader) GetHeight ¶
func (m *BlockHeader) GetHeight() uint32
func (*BlockHeader) GetNonce ¶
func (m *BlockHeader) GetNonce() uint32
func (*BlockHeader) GetPreviousHash ¶
func (m *BlockHeader) GetPreviousHash() string
func (*BlockHeader) GetStateHash ¶
func (m *BlockHeader) GetStateHash() string
func (*BlockHeader) GetTimeStamp ¶
func (m *BlockHeader) GetTimeStamp() uint32
func (*BlockHeader) GetTxsMerkleHash ¶
func (m *BlockHeader) GetTxsMerkleHash() string
func (*BlockHeader) Hash ¶
func (bh *BlockHeader) Hash() crypto.Hash
Hash returns the hash of the blockheader
func (*BlockHeader) ProtoMessage ¶
func (*BlockHeader) ProtoMessage()
func (*BlockHeader) Reset ¶
func (m *BlockHeader) Reset()
func (*BlockHeader) Serialize ¶
func (bh *BlockHeader) Serialize() []byte
Serialize returns the serialized bytes of a blockheader
func (*BlockHeader) String ¶
func (m *BlockHeader) String() string
type ContractSpec ¶
type ContractSpec struct { Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` Code []byte `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` Params []string `protobuf:"bytes,3,rep,name=params" json:"params,omitempty"` }
func (*ContractSpec) Descriptor ¶
func (*ContractSpec) Descriptor() ([]byte, []int)
func (*ContractSpec) GetAddr ¶
func (m *ContractSpec) GetAddr() []byte
func (*ContractSpec) GetCode ¶
func (m *ContractSpec) GetCode() []byte
func (*ContractSpec) GetParams ¶
func (m *ContractSpec) GetParams() []string
func (*ContractSpec) ProtoMessage ¶
func (*ContractSpec) ProtoMessage()
func (*ContractSpec) Reset ¶
func (m *ContractSpec) Reset()
func (*ContractSpec) String ¶
func (m *ContractSpec) String() string
type GetBlocksMsg ¶
type GetBlocksMsg struct { Version uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` LocatorHashes []string `protobuf:"bytes,2,rep,name=locatorHashes" json:"locatorHashes,omitempty"` HashStop string `protobuf:"bytes,3,opt,name=hashStop" json:"hashStop,omitempty"` }
func (*GetBlocksMsg) Descriptor ¶
func (*GetBlocksMsg) Descriptor() ([]byte, []int)
func (*GetBlocksMsg) GetHashStop ¶
func (m *GetBlocksMsg) GetHashStop() string
func (*GetBlocksMsg) GetLocatorHashes ¶
func (m *GetBlocksMsg) GetLocatorHashes() []string
func (*GetBlocksMsg) GetVersion ¶
func (m *GetBlocksMsg) GetVersion() uint32
func (*GetBlocksMsg) MarshalMsg ¶
func (m *GetBlocksMsg) MarshalMsg() ([]byte, error)
func (*GetBlocksMsg) ProtoMessage ¶
func (*GetBlocksMsg) ProtoMessage()
func (*GetBlocksMsg) Reset ¶
func (m *GetBlocksMsg) Reset()
func (*GetBlocksMsg) String ¶
func (m *GetBlocksMsg) String() string
func (*GetBlocksMsg) UnmarshalMsg ¶
func (m *GetBlocksMsg) UnmarshalMsg(data []byte) error
type GetDataMsg ¶
type GetDataMsg struct {
InvList []*GetInvMsg `protobuf:"bytes,1,rep,name=InvList" json:"InvList,omitempty"`
}
func (*GetDataMsg) Descriptor ¶
func (*GetDataMsg) Descriptor() ([]byte, []int)
func (*GetDataMsg) GetInvList ¶
func (m *GetDataMsg) GetInvList() []*GetInvMsg
func (*GetDataMsg) MarshalMsg ¶
func (m *GetDataMsg) MarshalMsg() ([]byte, error)
func (*GetDataMsg) ProtoMessage ¶
func (*GetDataMsg) ProtoMessage()
func (*GetDataMsg) Reset ¶
func (m *GetDataMsg) Reset()
func (*GetDataMsg) String ¶
func (m *GetDataMsg) String() string
func (*GetDataMsg) UnmarshalMsg ¶
func (m *GetDataMsg) UnmarshalMsg(data []byte) error
type GetInvMsg ¶
type GetInvMsg struct { Type InvType `protobuf:"varint,1,opt,name=type,enum=proto.InvType" json:"type,omitempty"` Hashs []string `protobuf:"bytes,2,rep,name=hashs" json:"hashs,omitempty"` }
func (*GetInvMsg) Descriptor ¶
func (*GetInvMsg) MarshalMsg ¶
func (*GetInvMsg) ProtoMessage ¶
func (*GetInvMsg) ProtoMessage()
func (*GetInvMsg) UnmarshalMsg ¶
type IInventory ¶
IInventory defines interface that broadcast data should implements
type OnBlockMsg ¶
type OnBlockMsg struct {
Block *Block `protobuf:"bytes,1,opt,name=block" json:"block,omitempty"`
}
func (*OnBlockMsg) Descriptor ¶
func (*OnBlockMsg) Descriptor() ([]byte, []int)
func (*OnBlockMsg) GetBlock ¶
func (m *OnBlockMsg) GetBlock() *Block
func (*OnBlockMsg) MarshalMsg ¶
func (m *OnBlockMsg) MarshalMsg() ([]byte, error)
func (*OnBlockMsg) ProtoMessage ¶
func (*OnBlockMsg) ProtoMessage()
func (*OnBlockMsg) Reset ¶
func (m *OnBlockMsg) Reset()
func (*OnBlockMsg) String ¶
func (m *OnBlockMsg) String() string
func (*OnBlockMsg) UnmarshalMsg ¶
func (m *OnBlockMsg) UnmarshalMsg(data []byte) error
type OnTransactionMsg ¶
type OnTransactionMsg struct {
Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction" json:"transaction,omitempty"`
}
func (*OnTransactionMsg) Descriptor ¶
func (*OnTransactionMsg) Descriptor() ([]byte, []int)
func (*OnTransactionMsg) GetTransaction ¶
func (m *OnTransactionMsg) GetTransaction() *Transaction
func (*OnTransactionMsg) MarshalMsg ¶
func (m *OnTransactionMsg) MarshalMsg() ([]byte, error)
func (*OnTransactionMsg) ProtoMessage ¶
func (*OnTransactionMsg) ProtoMessage()
func (*OnTransactionMsg) Reset ¶
func (m *OnTransactionMsg) Reset()
func (*OnTransactionMsg) String ¶
func (m *OnTransactionMsg) String() string
func (*OnTransactionMsg) UnmarshalMsg ¶
func (m *OnTransactionMsg) UnmarshalMsg(data []byte) error
type StatusMsg ¶
type StatusMsg struct { Version uint32 `protobuf:"varint,1,opt,name=Version" json:"Version,omitempty"` StartHeight uint32 `protobuf:"varint,2,opt,name=StartHeight" json:"StartHeight,omitempty"` }
func (*StatusMsg) Descriptor ¶
func (*StatusMsg) GetStartHeight ¶
func (*StatusMsg) GetVersion ¶
func (*StatusMsg) MarshalMsg ¶
func (*StatusMsg) ProtoMessage ¶
func (*StatusMsg) ProtoMessage()
func (*StatusMsg) UnmarshalMsg ¶
type Transaction ¶
type Transaction struct { Header *TxHeader `protobuf:"bytes,1,opt,name=Header" json:"Header,omitempty"` Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` Meta []byte `protobuf:"bytes,3,opt,name=meta,proto3" json:"meta,omitempty"` ContractSpec *ContractSpec `protobuf:"bytes,4,opt,name=contractSpec" json:"contractSpec,omitempty"` }
func NewTransaction ¶
func NewTransaction(from, to account.ChainCoordinate, txType TransactionType, nonce uint32, sender, recipient account.Address, assetID uint32, amount, fee int64, createTime uint32) *Transaction
NewTransaction initialization transaction
func (*Transaction) Amount ¶
func (tx *Transaction) Amount() int64
Amount returns the transfer �amount of the transaction
func (*Transaction) AssetID ¶
func (tx *Transaction) AssetID() uint32
AssetID returns the transfer asset of the transaction
func (*Transaction) Compare ¶
func (tx *Transaction) Compare(v interface{}) int
Compare implements interface consensus need
func (*Transaction) CreateTime ¶
func (tx *Transaction) CreateTime() uint32
CreateTime returns the create time of the transaction
func (*Transaction) Descriptor ¶
func (*Transaction) Descriptor() ([]byte, []int)
func (*Transaction) Deserialize ¶
func (tx *Transaction) Deserialize(data []byte) error
Deserialize deserializes bytes to a transaction
func (*Transaction) Fee ¶
func (tx *Transaction) Fee() int64
Fee returns the nonce of the transaction
func (*Transaction) FromChain ¶
func (tx *Transaction) FromChain() string
FromChain returns the chain coordinate of the sender
func (*Transaction) GetContractSpec ¶
func (m *Transaction) GetContractSpec() *ContractSpec
func (*Transaction) GetHeader ¶
func (m *Transaction) GetHeader() *TxHeader
func (*Transaction) GetMeta ¶
func (m *Transaction) GetMeta() []byte
func (*Transaction) GetPayload ¶
func (m *Transaction) GetPayload() []byte
func (*Transaction) GetType ¶
func (tx *Transaction) GetType() TransactionType
GetType returns transaction type
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() crypto.Hash
Hash returns the hash of a transaction
func (*Transaction) IsLocalChain ¶
func (tx *Transaction) IsLocalChain() bool
IsLocalChain returns whether or not local chain
func (*Transaction) Nonce ¶
func (tx *Transaction) Nonce() uint32
Nonce returns the nonce of the transaction
func (*Transaction) ProtoMessage ¶
func (*Transaction) ProtoMessage()
func (*Transaction) Recipient ¶
func (tx *Transaction) Recipient() account.Address
Recipient returns the address of the recipient
func (*Transaction) Reset ¶
func (m *Transaction) Reset()
func (*Transaction) Sender ¶
func (tx *Transaction) Sender() account.Address
Sender returns the address of the sender.
func (*Transaction) Serialize ¶
func (tx *Transaction) Serialize() []byte
Serialize marshal txData proto message
func (*Transaction) SignHash ¶
func (tx *Transaction) SignHash() crypto.Hash
SignHash returns the hash of a raw transaction before sign
func (*Transaction) String ¶
func (m *Transaction) String() string
func (*Transaction) ToChain ¶
func (tx *Transaction) ToChain() string
ToChain returns the chain coordinate of the recipient
func (*Transaction) Verfiy ¶
func (tx *Transaction) Verfiy() (account.Address, error)
Verfiy Also can use this method verify signature
func (*Transaction) WithSignature ¶
func (tx *Transaction) WithSignature(sig *crypto.Signature)
WithSignature returns a new transaction with the given signature.
type TransactionType ¶
type TransactionType int32
const ( TransactionType_Atomic TransactionType = 0 TransactionType_AcrossChain TransactionType = 1 TransactionType_Merged TransactionType = 2 TransactionType_Backfront TransactionType = 3 TransactionType_Distribut TransactionType = 4 TransactionType_Issue TransactionType = 5 TransactionType_IssueUpdate TransactionType = 6 TransactionType_JSContractInit TransactionType = 7 TransactionType_LuaContractInit TransactionType = 8 TransactionType_ContractInvoke TransactionType = 9 TransactionType_ContractQuery TransactionType = 10 TransactionType_Security TransactionType = 11 )
func (TransactionType) EnumDescriptor ¶
func (TransactionType) EnumDescriptor() ([]byte, []int)
func (TransactionType) String ¶
func (x TransactionType) String() string
type Transactions ¶
type Transactions []*Transaction
Transactions represents transaction slice type for basic sorting.
func (Transactions) Less ¶
func (s Transactions) Less(i, j int) bool
Less compares nonce of the i'th and the j'th element in s
func (Transactions) Swap ¶
func (s Transactions) Swap(i, j int)
Swap swaps the i'th and the j'th element in s
type TxHeader ¶
type TxHeader struct { FromChain []byte `protobuf:"bytes,1,opt,name=fromChain,proto3" json:"fromChain,omitempty"` ToChain []byte `protobuf:"bytes,2,opt,name=toChain,proto3" json:"toChain,omitempty"` Type TransactionType `protobuf:"varint,3,opt,name=type,enum=proto.TransactionType" json:"type,omitempty"` Nonce uint32 `protobuf:"varint,4,opt,name=nonce" json:"nonce,omitempty"` Sender string `protobuf:"bytes,5,opt,name=sender" json:"sender,omitempty"` Recipient string `protobuf:"bytes,6,opt,name=recipient" json:"recipient,omitempty"` AssetID uint32 `protobuf:"varint,7,opt,name=assetID" json:"assetID,omitempty"` Amount int64 `protobuf:"varint,8,opt,name=amount" json:"amount,omitempty"` Fee int64 `protobuf:"varint,9,opt,name=fee" json:"fee,omitempty"` Signature []byte `protobuf:"bytes,10,opt,name=signature,proto3" json:"signature,omitempty"` CreateTime uint32 `protobuf:"varint,11,opt,name=createTime" json:"createTime,omitempty"` }
func (*TxHeader) Descriptor ¶
func (*TxHeader) GetAssetID ¶
func (*TxHeader) GetCreateTime ¶
func (*TxHeader) GetFromChain ¶
func (*TxHeader) GetRecipient ¶
func (*TxHeader) GetSignature ¶
func (*TxHeader) GetToChain ¶
func (*TxHeader) GetType ¶
func (m *TxHeader) GetType() TransactionType
func (*TxHeader) ProtoMessage ¶
func (*TxHeader) ProtoMessage()