Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateFee(msgs []types.IMessage) uint64
- func EncodeRlpBlocks(rlpBlocks []*RlpBlock) ([]byte, error)
- func EncodeRlpMessages(msgs []*RlpMessage) []byte
- func MsgRoot(msgs []types.IMessage) arry.Hash
- func RlpBlocksToBlocks(rlpBlocks []*RlpBlock) []types.IBlock
- func Verify(hash arry.Hash, signScript types.ISignature) bool
- func VerifySigner(network string, signer arry.Address, pubKey []byte) bool
- type Account
- func (a *Account) Bytes() []byte
- func (a *Account) Check(msg types.IMessage, strict bool) error
- func (a *Account) EaterMessage(msg types.IMessage, height uint64) error
- func (a *Account) Exist() bool
- func (a *Account) FromMessage(msg types.IMessage, height uint64) error
- func (a *Account) GetAddress() arry.Address
- func (a *Account) GetBalance(tokenAddr arry.Address) uint64
- func (a *Account) NeedUpdate() bool
- func (a *Account) ToMessage(msg types.IMessage, height uint64) error
- func (a *Account) UpdateLocked(confirmed uint64) error
- type Block
- func (b *Block) Add(message types.IMessage)
- func (b *Block) BlockBody() types.IBody
- func (b *Block) BlockHeader() types.IHeader
- func (b *Block) CheckMsgRoot() bool
- func (b *Block) GetMsgIndexs() map[arry.Hash]*MsgIndex
- func (b *Block) Hash() arry.Hash
- func (b *Block) Height() uint64
- func (b *Block) MsgRoot() arry.Hash
- func (b *Block) Msgs() []types.IMessage
- func (b *Block) SetHash()
- func (b *Block) Sign(key *secp256k1.PrivateKey) error
- func (b *Block) Signer() arry.Address
- func (b *Block) Time() int64
- func (b *Block) ToRlpBlock() types.IRlpBlock
- func (b *Block) ToRlpHeader() types.IRlpHeader
- type Blocks
- type Body
- type CancelBody
- type CandidateBody
- type Candidates
- type Header
- func (h *Header) Bytes() []byte
- func (h *Header) GetActRoot() arry.Hash
- func (h *Header) GetCycle() uint64
- func (h *Header) GetDPosRoot() arry.Hash
- func (h *Header) GetHash() arry.Hash
- func (h *Header) GetHeight() uint64
- func (h *Header) GetMsgRoot() arry.Hash
- func (h *Header) GetPreHash() arry.Hash
- func (h *Header) GetSignature() types.ISignature
- func (h *Header) GetSigner() arry.Address
- func (h *Header) GetTime() uint64
- func (h *Header) GetTokenRoot() arry.Hash
- func (h *Header) SetHash()
- func (h *Header) Sign(key *secp256k1.PrivateKey) error
- func (h *Header) ToRlpHeader() types.IRlpHeader
- type IRpcMessageBody
- type InAmount
- type InList
- type Member
- type Message
- func (m *Message) Bytes() []byte
- func (m *Message) Check() error
- func (m *Message) CheckCoinBase(fee uint64, coinbase uint64) error
- func (m *Message) Fee() uint64
- func (m *Message) From() arry.Address
- func (m *Message) Hash() arry.Hash
- func (m *Message) IsCoinBase() bool
- func (m *Message) MsgAmount() uint64
- func (m *Message) MsgBody() types.IMessageBody
- func (m *Message) MsgTo() arry.Address
- func (m *Message) Nonce() uint64
- func (m *Message) PublicKey() string
- func (m *Message) SetHash() error
- func (m *Message) SignMessage(key *secp256k1.PrivateKey) error
- func (m *Message) SignMsg(key *secp256k1.PrivateKey) error
- func (m *Message) Signature() string
- func (m *Message) Time() uint64
- func (m *Message) ToRlp() types.IRlpMessage
- func (m *Message) Type() int
- type MessageType
- type Messages
- type MsgHeader
- type MsgIndex
- type Peer
- type Record
- type RecordList
- type RlpBlock
- type RlpBody
- type RlpHeader
- type RlpMessage
- type RpcCancelBody
- type RpcCandidateBody
- type RpcMessage
- type RpcMessageHeader
- type RpcMessageWithHeight
- type RpcSignature
- type RpcTokenBody
- type RpcTransactionBody
- type RpcVoteBody
- type Signature
- type SortableCandidates
- type Supers
- type TokenAccount
- type TokenBody
- type TokenRecord
- type Tokens
- type TransactionBody
- type TxOutList
- type VoteBody
Constants ¶
View Source
const ( PeerLength = 53 MaxName = 100 )
Variables ¶
View Source
var CoinBase = arry.StringToAddress("coinbase")
Functions ¶
func CalculateFee ¶
func EncodeRlpBlocks ¶
func EncodeRlpMessages ¶
func EncodeRlpMessages(msgs []*RlpMessage) []byte
func RlpBlocksToBlocks ¶
Types ¶
type Account ¶
type Account struct { Address arry.Address `json:"address"` Nonce uint64 `json:"nonce"` Tokens Tokens `json:"tokens"` Confirmed uint64 `json:"confirmed"` JournalIn *journalIn `json:"-"` JournalOut *journalOut `json:"-"` }
func DecodeAccount ¶
func NewAccount ¶
func NewAccount() *Account
func (*Account) EaterMessage ¶
func (*Account) FromMessage ¶
func (*Account) GetAddress ¶
func (*Account) NeedUpdate ¶
func (*Account) UpdateLocked ¶
Update through the account transfer log information
type Block ¶
func (*Block) BlockHeader ¶
func (*Block) CheckMsgRoot ¶
func (*Block) ToRlpBlock ¶
func (*Block) ToRlpHeader ¶
func (b *Block) ToRlpHeader() types.IRlpHeader
type CancelBody ¶
type CancelBody struct { }
func (*CancelBody) MsgAmount ¶
func (c *CancelBody) MsgAmount() uint64
func (*CancelBody) MsgTo ¶
func (c *CancelBody) MsgTo() arry.Address
func (*CancelBody) MsgToken ¶
func (c *CancelBody) MsgToken() arry.Address
type CandidateBody ¶
type CandidateBody struct {
Peer Peer
}
func RpcCandidateBodyToBody ¶
func RpcCandidateBodyToBody(rpcBody *RpcCandidateBody) (*CandidateBody, error)
func (*CandidateBody) MsgAmount ¶
func (c *CandidateBody) MsgAmount() uint64
func (*CandidateBody) MsgTo ¶
func (c *CandidateBody) MsgTo() arry.Address
func (*CandidateBody) MsgToken ¶
func (c *CandidateBody) MsgToken() arry.Address
type Candidates ¶
type Candidates struct {
Members []*Member
}
func NewCandidates ¶
func NewCandidates() *Candidates
func (*Candidates) Get ¶
func (c *Candidates) Get(i int) types.ICandidate
func (*Candidates) GetPreHash ¶
func (c *Candidates) GetPreHash() arry.Hash
func (*Candidates) Len ¶
func (c *Candidates) Len() int
func (*Candidates) List ¶
func (c *Candidates) List() []types.ICandidate
func (*Candidates) Remove ¶
func (c *Candidates) Remove(reMem *Member)
func (*Candidates) Set ¶
func (c *Candidates) Set(newMem *Member)
type Header ¶
type Header struct { Version uint32 Hash arry.Hash PreHash arry.Hash MsgRoot arry.Hash ActRoot arry.Hash DPosRoot arry.Hash TokenRoot arry.Hash Height uint64 Time uint64 Cycle uint64 Signer arry.Address Signature *Signature }
func DecodeHeader ¶
func (*Header) GetActRoot ¶
func (*Header) GetDPosRoot ¶
func (*Header) GetMsgRoot ¶
func (*Header) GetPreHash ¶
func (*Header) GetSignature ¶
func (h *Header) GetSignature() types.ISignature
func (*Header) GetTokenRoot ¶
func (*Header) ToRlpHeader ¶
func (h *Header) ToRlpHeader() types.IRlpHeader
type IRpcMessageBody ¶
type IRpcMessageBody interface { }
type Member ¶
type Member struct { Signer arry.Address PeerId string Weight uint64 MntCount uint32 Voters []arry.Address }
func DecodeMember ¶
type Message ¶
type Message struct { Header *MsgHeader Body types.IMessageBody }
func RpcMsgToMsg ¶
func RpcMsgToMsg(rpcMsg *RpcMessage) (*Message, error)
func (*Message) IsCoinBase ¶
func (*Message) MsgBody ¶
func (m *Message) MsgBody() types.IMessageBody
func (*Message) SignMessage ¶
func (m *Message) SignMessage(key *secp256k1.PrivateKey) error
func (*Message) ToRlp ¶
func (m *Message) ToRlp() types.IRlpMessage
type MessageType ¶
type MessageType uint8
const ( Transaction MessageType = iota Token Candidate Cancel Vote )
type MsgHeader ¶
type MsgIndex ¶
func DecodeTxIndex ¶
type Peer ¶
type Peer [PeerLength]byte
type RecordList ¶
type RecordList []*Record
func (*RecordList) Len ¶
func (r *RecordList) Len() int
func (*RecordList) Remove ¶
func (r *RecordList) Remove(height uint64)
func (*RecordList) Set ¶
func (r *RecordList) Set(newRecord *Record)
type RlpBody ¶
type RlpBody struct {
Msgs []*RlpMessage
}
func (*RlpBody) MsgList ¶
func (r *RlpBody) MsgList() []*RlpMessage
type RlpMessage ¶
func DecodeMessage ¶
func DecodeMessage(bytes []byte) (*RlpMessage, error)
func DecodeRlpMessages ¶
func DecodeRlpMessages(bytes []byte) ([]*RlpMessage, error)
func (*RlpMessage) Bytes ¶
func (r *RlpMessage) Bytes() []byte
func (*RlpMessage) ToMessage ¶
func (r *RlpMessage) ToMessage() types.IMessage
type RpcCancelBody ¶
type RpcCancelBody struct { }
type RpcCandidateBody ¶
type RpcCandidateBody struct {
PeerId string `json:"peerid"`
}
func (*RpcCandidateBody) PeerIdBytes ¶
func (r *RpcCandidateBody) PeerIdBytes() []byte
type RpcMessage ¶
type RpcMessage struct { MsgHeader *RpcMessageHeader `json:"msgheader"` MsgBody IRpcMessageBody `json:"msgbody"` }
func MsgToRpcMsg ¶
func MsgToRpcMsg(msg types.IMessage) (*RpcMessage, error)
type RpcMessageHeader ¶
type RpcMessageHeader struct { MsgHash string `json:"msghash"` Type MessageType `json:"type"` From string `json:"from"` Nonce uint64 `json:"nonce"` Fee uint64 `json:"fee"` Time uint64 `json:"time"` Signature *RpcSignature `json:"signscript"` }
type RpcMessageWithHeight ¶
type RpcMessageWithHeight struct { MsgHeader *RpcMessageHeader `json:"msgheader"` MsgBody IRpcMessageBody `json:"msgbody"` Height uint64 `json:"height"` Confirmed bool `json:"confirmed"` }
type RpcSignature ¶
type RpcTokenBody ¶
type RpcTransactionBody ¶
type RpcTransactionBody struct { Token string `json:"token"` To string `json:"to"` Amount uint64 `json:"amount"` }
func (*RpcTransactionBody) GetTo ¶
func (r *RpcTransactionBody) GetTo() []byte
type RpcVoteBody ¶
type RpcVoteBody struct {
To string `json:"to"`
}
type Signature ¶
Signature information, including the result of the signature and the public key.
func RpcSignatureToSignature ¶
func RpcSignatureToSignature(rpcSignScript *RpcSignature) (*Signature, error)
func (*Signature) PubKeyString ¶
func (*Signature) SignatureBytes ¶
func (*Signature) SignatureString ¶
type SortableCandidates ¶
type SortableCandidates []*Member
func (SortableCandidates) Len ¶
func (p SortableCandidates) Len() int
func (SortableCandidates) Less ¶
func (p SortableCandidates) Less(i, j int) bool
func (SortableCandidates) Swap ¶
func (p SortableCandidates) Swap(i, j int)
type Supers ¶
Super nodes
func (*Supers) GetPreHash ¶
func (*Supers) List ¶
func (s *Supers) List() []types.ICandidate
type TokenAccount ¶
type TokenBody ¶
type TokenBody struct { TokenAddress arry.Address Receiver arry.Address Name string Shorthand string IncreaseIssues bool Amount uint64 }
func RpcTokenBodyToBody ¶
func RpcTokenBodyToBody(rpcBody *RpcTokenBody) (*TokenBody, error)
type TokenRecord ¶
type TokenRecord struct { Address arry.Address Sender arry.Address Name string Shorthand string IncreaseIssues bool Records *RecordList }
token structure, issuing a contract with the same name is equivalent to reissuing the pass
func DecodeToken ¶
func DecodeToken(bytes []byte) (*TokenRecord, error)
func NewToken ¶
func NewToken() *TokenRecord
func (*TokenRecord) Bytes ¶
func (t *TokenRecord) Bytes() []byte
func (*TokenRecord) FallBack ¶
func (t *TokenRecord) FallBack(height uint64) error
func (*TokenRecord) IncreaseRecord ¶
func (t *TokenRecord) IncreaseRecord(record *Record)
type Tokens ¶
type Tokens []*TokenAccount
List of secondary accounts
func (*Tokens) Set ¶
func (t *Tokens) Set(newCoin *TokenAccount)
type TransactionBody ¶
func RpcTransactionBodyToBody ¶
func RpcTransactionBodyToBody(rpcBody *RpcTransactionBody) (*TransactionBody, error)
func (*TransactionBody) MsgAmount ¶
func (t *TransactionBody) MsgAmount() uint64
func (*TransactionBody) MsgTo ¶
func (t *TransactionBody) MsgTo() arry.Address
func (*TransactionBody) MsgToken ¶
func (t *TransactionBody) MsgToken() arry.Address
type VoteBody ¶
func RpcVoteBodyToBody ¶
func RpcVoteBodyToBody(rpcBody *RpcVoteBody) (*VoteBody, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.