types

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 18 Imported by: 17

Documentation

Index

Constants

View Source
const (
	// AddressPrefix is the prefix of qlc addresses.
	AddressPrefix = "qlc_"
	// AddressSize represents the binary size of a qlc address (a public key).
	AddressSize = ed25519.PublicKeySize

	// AddressLen represents the string length of a qlc address.
	AddressLen = 60
)
View Source
const (
	AddressExtensionType   = 99
	BalanceExtensionType   = 100
	HashExtensionType      = 101
	SeedExtensionType      = 102
	SignatureExtensionType = 103
	WorkExtensionType      = 104
	AbiExtensionType       = 105
)
View Source
const (
	// BalanceMaxPrecision  balance max precision
	BalanceMaxPrecision = 11
)
View Source
const (
	FrontierSize = AddressSize + HashSize
)
View Source
const (
	//HashSize size of hash
	HashSize = blake2b.Size256
)
View Source
const (
	// SeedSize size of the seed
	SeedSize = 32
)
View Source
const (
	//SignatureSize size of signature
	SignatureSize = ed25519.SignatureSize
)
View Source
const (
	//WorkSize work size
	WorkSize = 8
)

Variables

View Source
var (
	// ZeroAddress
	ZeroAddress = Address{}

	MintageAddress, _    = HexToAddress("qlc_3qjky1ptg9qkzm8iertdzrnx9btjbaea33snh1w4g395xqqczye4kgcfyfs1")
	NEP5PledgeAddress, _ = HexToAddress("qlc_3fwi6r1fzjwmiys819pw8jxrcmcottsj4iq56kkgcmzi3b87596jwskwqrr5")
	RewardsAddress, _    = HexToAddress("qlc_3oinqggowa7f1rsjfmib476ggz6s4fp8578odjzerzztkrifqkqdz5zjztb3")
	MinerAddress, _      = GenerateBuiltinContractAddress(3)

	ChainContractAddressList = []Address{NEP5PledgeAddress, MintageAddress, RewardsAddress, MinerAddress}

	// AddressEncoding is a base32 encoding using addressEncodingAlphabet as its
	// alphabet.
	AddressEncoding = base32.NewEncoding(addressEncodingAlphabet)
)
View Source
var (
	ErrBadBlockType = errors.New("bad block type")
	ErrNotABlock    = errors.New("block type is not_a_block")
)
View Source
var WorkThreshold = uint64(0xfffffe0000000000)
View Source
var (
	// ZeroBalance zero
	ZeroBalance = Balance{big.NewInt(0)}
)
View Source
var ZeroHash = Hash{}
View Source
var ZeroSeed = Seed{}

ZeroAddress

View Source
var ZeroSignature = Signature{}

Functions

func IsChainContractAddress

func IsChainContractAddress(address Address) bool

func IsContractAddress

func IsContractAddress(address Address) bool

func IsValidHexAddress

func IsValidHexAddress(hexStr string) bool

IsValidHexAddress check Hex address string is valid

func KeypairFromPrivateKey

func KeypairFromPrivateKey(privateKey string) (ed25519.PublicKey, ed25519.PrivateKey)

KeypairFromPrivateKey generate key pair from private key

func KeypairFromSeed

func KeypairFromSeed(seed string, index uint32) (ed25519.PublicKey, ed25519.PrivateKey, error)

KeypairFromSeed generate key pair from seed

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

func NewAccount

func NewAccount(key ed25519.PrivateKey) *Account

NewAccount creates a new account with the given private key.

func (*Account) Address

func (a *Account) Address() Address

Address returns the public key of this account as an Address type.

func (*Account) DecodeMsg

func (z *Account) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Account) EncodeMsg

func (z Account) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Account) MarshalMsg

func (z Account) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Account) Msgsize

func (z Account) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Account) PrivateKey

func (a *Account) PrivateKey() ed25519.PrivateKey

func (*Account) Sign

func (a *Account) Sign(hash Hash) Signature

func (*Account) String

func (a *Account) String() string

String implements the fmt.Stringer interface.

func (*Account) UnmarshalMsg

func (z *Account) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AccountMeta

type AccountMeta struct {
	Address     Address      `msg:"account,extension" json:"account"`
	CoinBalance Balance      `msg:"balance,extension" json:"balance"`
	CoinVote    Balance      `msg:"vote,extension" json:"vote"`
	CoinNetwork Balance      `msg:"network,extension" json:"network"`
	CoinStorage Balance      `msg:"storage,extension" json:"storage"`
	CoinOracle  Balance      `msg:"oracle,extension" json:"oracle"`
	Tokens      []*TokenMeta `msg:"tokens" json:"tokens"`
}

func (*AccountMeta) DecodeMsg

func (z *AccountMeta) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*AccountMeta) EncodeMsg

func (z *AccountMeta) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*AccountMeta) GetBalance

func (a *AccountMeta) GetBalance() Balance

func (*AccountMeta) GetNetwork

func (a *AccountMeta) GetNetwork() Balance

func (*AccountMeta) GetOracle

func (a *AccountMeta) GetOracle() Balance

func (*AccountMeta) GetStorage

func (a *AccountMeta) GetStorage() Balance

func (*AccountMeta) GetVote

func (a *AccountMeta) GetVote() Balance

func (*AccountMeta) MarshalMsg

func (z *AccountMeta) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*AccountMeta) Msgsize

func (z *AccountMeta) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AccountMeta) Token

func (am *AccountMeta) Token(tt Hash) *TokenMeta

Token get token meta by token type hash

func (*AccountMeta) TotalBalance

func (a *AccountMeta) TotalBalance() Balance

func (*AccountMeta) UnmarshalMsg

func (z *AccountMeta) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

func (*AccountMeta) VoteWeight

func (a *AccountMeta) VoteWeight() Balance

type Address

type Address [AddressSize]byte

Address of account

func BytesToAddress

func BytesToAddress(b []byte) (Address, error)

BytesToAddress convert byte array to Address

func GenerateAddress

func GenerateAddress() (Address, ed25519.PrivateKey, error)

GenerateAddress generate qlc address

func GenerateBuiltinContractAddress

func GenerateBuiltinContractAddress(suffix byte) (Address, error)

func HexToAddress

func HexToAddress(hexStr string) (Address, error)

HexToAddress convert hex address string to Address

func PubToAddress

func PubToAddress(pub ed25519.PublicKey) Address

PubToAddress convert ed25519.PublicKey to Address

func (Address) Bytes

func (addr Address) Bytes() []byte

Bytes get Address byte array

func (Address) Checksum

func (addr Address) Checksum() []byte

Checksum calculates the checksum for this address' public key.

func (*Address) DecodeMsg

func (z *Address) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Address) EncodeMsg

func (z *Address) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Address) ExtensionType

func (addr *Address) ExtensionType() int8

ExtensionType implements Extension.ExtensionType interface

func (Address) IsZero

func (addr Address) IsZero() bool

IsZero check address is zero

func (*Address) Len

func (addr *Address) Len() int

ExtensionType implements Extension.Len interface

func (Address) MarshalBinaryTo

func (addr Address) MarshalBinaryTo(text []byte) error

ExtensionType implements Extension.MarshalBinaryTo interface

func (*Address) MarshalMsg

func (z *Address) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Address) MarshalText

func (addr Address) MarshalText() (text []byte, err error)

MarshalText implements encoding.Textmarshaler

func (*Address) Msgsize

func (z *Address) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Address) SetBytes

func (addr *Address) SetBytes(b []byte) error

SetBytes new address bytes

func (Address) String

func (addr Address) String() string

String implements the fmt.Stringer interface.

func (*Address) ToHash

func (addr *Address) ToHash() Hash

func (*Address) UnmarshalBinary

func (addr *Address) UnmarshalBinary(text []byte) error

ExtensionType implements Extension.UnmarshalBinary interface

func (*Address) UnmarshalMsg

func (z *Address) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

func (*Address) UnmarshalText

func (addr *Address) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (Address) Verify

func (addr Address) Verify(data []byte, signature []byte) bool

Verify reports whether the given signature is valid for the given data.

type Balance

type Balance struct {
	*big.Int
}

Balance of account

func BytesToBalance

func BytesToBalance(b []byte) Balance

BytesToBalance create balance from byte slice

func NewBalance

func NewBalance(x int64) Balance

func StringToBalance

func StringToBalance(b string) Balance

StringToBalance create balance from string

func (Balance) Add

func (b Balance) Add(n Balance) Balance

Add balances add

func (Balance) Bytes

func (b Balance) Bytes() []byte

Bytes returns the binary representation of this Balance with the given endianness.

func (Balance) Compare

func (b Balance) Compare(n Balance) BalanceComp

Compare two balances

func (Balance) Div

func (b Balance) Div(n int64) (Balance, error)

Div balances div

func (Balance) Equal

func (b Balance) Equal(b2 Balance) bool

Equal reports whether this balance and the given balance are equal.

func (*Balance) ExtensionType

func (b *Balance) ExtensionType() int8

ExtensionType implements Extension.ExtensionType interface

func (Balance) IsZero

func (b Balance) IsZero() bool

IsZero check balance is zero

func (*Balance) Len

func (b *Balance) Len() int

ExtensionType implements Extension.Len interface

func (*Balance) MarshalBinaryTo

func (b *Balance) MarshalBinaryTo(text []byte) error

ExtensionType implements Extension.UnmarshalBinary interface

func (*Balance) MarshalJSON

func (b *Balance) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Balance) MarshalText

func (b Balance) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (Balance) Mul

func (b Balance) Mul(n int64) Balance

Mul balances mul

func (Balance) String

func (b Balance) String() string

func (Balance) Sub

func (b Balance) Sub(n Balance) Balance

Sub balances sub

func (*Balance) UnmarshalBinary

func (b *Balance) UnmarshalBinary(text []byte) error

ExtensionType implements Extension.UnmarshalBinary interface

func (*Balance) UnmarshalJSON

func (b *Balance) UnmarshalJSON(text []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Balance) UnmarshalText

func (b *Balance) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type BalanceComp

type BalanceComp byte

BalanceComp compare

const (
	//BalanceCompEqual equal compare
	BalanceCompEqual BalanceComp = iota
	//BalanceCompBigger bigger compare
	BalanceCompBigger
	//BalanceCompSmaller smaller compare
	BalanceCompSmaller
)

type Benefit

type Benefit struct {
	Balance Balance `msg:"balance,extension" json:"balance"`
	Vote    Balance `msg:"vote,extension" json:"vote"`
	Network Balance `msg:"network,extension" json:"network"`
	Storage Balance `msg:"storage,extension" json:"storage"`
	Oracle  Balance `msg:"oracle,extension" json:"oracle"`
	Total   Balance `msg:"total,extension" json:"total"`
}

func (*Benefit) DecodeMsg

func (z *Benefit) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Benefit) EncodeMsg

func (z *Benefit) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Benefit) MarshalMsg

func (z *Benefit) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Benefit) Msgsize

func (z *Benefit) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Benefit) String

func (b *Benefit) String() string

func (*Benefit) UnmarshalMsg

func (z *Benefit) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Block

type Block interface {
	Serialize() ([]byte, error)
	Deserialize([]byte) error
	fmt.Stringer
}

type BlockType

type BlockType byte
const (
	State BlockType = iota
	Send
	Receive
	Change
	Open
	ContractReward
	ContractSend
	ContractRefund
	ContractError
	SmartContract
	Invalid
)

func (*BlockType) DecodeMsg

func (z *BlockType) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (BlockType) EncodeMsg

func (z BlockType) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (BlockType) Equal

func (e BlockType) Equal(t BlockType) bool

func (BlockType) MarshalJSON

func (e BlockType) MarshalJSON() ([]byte, error)

func (BlockType) MarshalMsg

func (z BlockType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BlockType) Msgsize

func (z BlockType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (BlockType) String

func (t BlockType) String() string

func (*BlockType) UnmarshalJSON

func (e *BlockType) UnmarshalJSON(b []byte) error

func (*BlockType) UnmarshalMsg

func (z *BlockType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Frontier

type Frontier struct {
	HeaderBlock Hash `msg:"headerblock,extension" json:"headerblock"`
	OpenBlock   Hash `msg:"openblock,extension" json:"openblock"`
}

func (*Frontier) DecodeMsg

func (z *Frontier) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Frontier) EncodeMsg

func (z Frontier) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Frontier) IsZero

func (f *Frontier) IsZero() bool

func (Frontier) MarshalMsg

func (z Frontier) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Frontier) Msgsize

func (z Frontier) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Frontier) UnmarshalMsg

func (z *Frontier) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Frontiers

type Frontiers []*Frontier

func (*Frontiers) DecodeMsg

func (z *Frontiers) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Frontiers) EncodeMsg

func (z Frontiers) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Frontiers) Len

func (fs Frontiers) Len() int

func (Frontiers) Less

func (fs Frontiers) Less(i, j int) bool

func (Frontiers) MarshalMsg

func (z Frontiers) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Frontiers) Msgsize

func (z Frontiers) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Frontiers) Swap

func (fs Frontiers) Swap(i, j int)

func (*Frontiers) UnmarshalMsg

func (z *Frontiers) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GenesisTokenInfo

type GenesisTokenInfo struct {
	TokenId       Hash     `json:"tokenId"`
	TokenName     string   `json:"tokenName"`
	TokenSymbol   string   `json:"tokenSymbol"`
	TotalSupply   *big.Int `json:"totalSupply"`
	Decimals      uint8    `json:"decimals"`
	Owner         Address  `json:"owner"`
	PledgeAmount  *big.Int `json:"pledgeAmount"`
	WithdrawTime  int64    `json:"withdrawTime"`
	PledgeAddress Address  `json:"pledgeAddress"`
}

type Hash

type Hash [HashSize]byte

Hash blake2b hash

func BytesToHash

func BytesToHash(data []byte) (Hash, error)

func HashBytes

func HashBytes(inputs ...[]byte) (Hash, error)

HashBytes hash data by blake2b

func HashData

func HashData(data []byte) Hash

func NewHash

func NewHash(hexStr string) (Hash, error)

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) Cmp

func (h Hash) Cmp(h2 Hash) int

func (*Hash) DecodeMsg

func (z *Hash) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Hash) EncodeMsg

func (z *Hash) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Hash) ExtensionType

func (h *Hash) ExtensionType() int8

ExtensionType implements Extension.ExtensionType interface

func (*Hash) IsZero

func (h *Hash) IsZero() bool

IsZero check hash is zero

func (*Hash) Len

func (h *Hash) Len() int

ExtensionType implements Extension.Len interface

func (Hash) MarshalBinaryTo

func (h Hash) MarshalBinaryTo(text []byte) error

ExtensionType implements Extension.MarshalBinaryTo interface

func (*Hash) MarshalMsg

func (z *Hash) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Hash) MarshalText

func (h Hash) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Hash) Msgsize

func (z *Hash) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Hash) Of

func (h *Hash) Of(hexString string) error

Of convert hex string to Hash

func (Hash) String

func (h Hash) String() string

String implements the fmt.Stringer interface.

func (*Hash) UnmarshalBinary

func (h *Hash) UnmarshalBinary(text []byte) error

ExtensionType implements Extension.UnmarshalBinary interface

func (*Hash) UnmarshalMsg

func (z *Hash) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

func (*Hash) UnmarshalText

func (h *Hash) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type PendingInfo

type PendingInfo struct {
	Source Address `msg:"source,extension" json:"source"`
	Amount Balance `msg:"amount,extension" json:"amount"`
	Type   Hash    `msg:"type,extension" json:"type"`
}

func (*PendingInfo) DecodeMsg

func (z *PendingInfo) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (PendingInfo) EncodeMsg

func (z PendingInfo) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (PendingInfo) MarshalMsg

func (z PendingInfo) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PendingInfo) Msgsize

func (z PendingInfo) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PendingInfo) UnmarshalMsg

func (z *PendingInfo) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PendingKey

type PendingKey struct {
	Address Address `msg:"account,extension" json:"account"`
	Hash    Hash    `msg:"hash,extension" json:"hash"`
}

func (*PendingKey) DecodeMsg

func (z *PendingKey) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (PendingKey) EncodeMsg

func (z PendingKey) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (PendingKey) MarshalMsg

func (z PendingKey) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PendingKey) Msgsize

func (z PendingKey) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PendingKey) UnmarshalMsg

func (z *PendingKey) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PerformanceTime

type PerformanceTime struct {
	Hash Hash  `json:"hash"` //block hash
	T0   int64 `json:"t0"`   //The time when the block message was received for the first time
	T1   int64 `json:"t1"`   //The time when the block was confirmed
	T2   int64 `json:"t2"`   //The time when the block begin consensus
	T3   int64 `json:"t3"`   //The time when the block first consensus complete
}

func NewPerformanceTime

func NewPerformanceTime() *PerformanceTime

func (*PerformanceTime) String

func (p *PerformanceTime) String() string

String implements the fmt.Stringer interface.

type PovAccountState

type PovAccountState struct {
	Hash        Hash             `msg:"hash,extension" json:"hash"`
	Balance     Balance          `msg:"balance,extension" json:"balance"`
	Vote        Balance          `msg:"vote,extension" json:"vote"`
	Network     Balance          `msg:"network,extension" json:"network"`
	Storage     Balance          `msg:"storage,extension" json:"storage"`
	Oracle      Balance          `msg:"oracle,extension" json:"oracle"`
	TokenStates []*PovTokenState `msg:"tokenStates" json:"tokenStates"`
	RepState    *PovRepState     `msg:"repState" json:"repState"`
}

func NewPovAccountState

func NewPovAccountState() *PovAccountState

func (*PovAccountState) Clone

func (as *PovAccountState) Clone() *PovAccountState

func (*PovAccountState) DecodeMsg

func (z *PovAccountState) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PovAccountState) Deserialize

func (as *PovAccountState) Deserialize(text []byte) error

func (*PovAccountState) EncodeMsg

func (z *PovAccountState) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PovAccountState) GetTokenState

func (as *PovAccountState) GetTokenState(tokenType Hash) *PovTokenState

func (*PovAccountState) MarshalMsg

func (z *PovAccountState) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PovAccountState) Msgsize

func (z *PovAccountState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovAccountState) Serialize

func (as *PovAccountState) Serialize() ([]byte, error)

func (*PovAccountState) String

func (as *PovAccountState) String() string

func (*PovAccountState) TotalBalance

func (as *PovAccountState) TotalBalance() Balance

func (*PovAccountState) UnmarshalMsg

func (z *PovAccountState) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PovBlock

type PovBlock struct {
	Hash Hash `msg:"hash,extension" json:"hash"`

	Previous      Hash      `msg:"previous,extension" json:"previous"`
	MerkleRoot    Hash      `msg:"merkleRoot,extension" json:"merkleRoot"`
	Nonce         uint64    `msg:"nonce" json:"nonce"`
	VoteSignature Signature `msg:"voteSignature,extension" json:"voteSignature"`

	Height    uint64    `msg:"height" json:"height"`
	Timestamp int64     `msg:"timestamp" json:"timestamp"`
	Target    Signature `msg:"target,extension" json:"target"`
	Coinbase  Address   `msg:"coinbase,extension" json:"coinbase"`
	TxNum     uint32    `msg:"txNum" json:"txNum"`
	StateHash Hash      `msg:"stateHash,extension" json:"stateHash"`

	Signature Signature `msg:"signature,extension" json:"signature"`

	Transactions []*PovTransaction `msg:"transactions" json:"transactions"`
}

PovBlock represents an entire block in the PoV blockchain.

func NewPovBlockWithBody

func NewPovBlockWithBody(header *PovHeader, body *PovBody) *PovBlock

func NewPovBlockWithHeader

func NewPovBlockWithHeader(header *PovHeader) *PovBlock

func (*PovBlock) Clone

func (blk *PovBlock) Clone() *PovBlock

func (*PovBlock) ComputeHash

func (blk *PovBlock) ComputeHash() Hash

func (*PovBlock) ComputeVoteHash

func (blk *PovBlock) ComputeVoteHash() Hash

func (*PovBlock) DecodeMsg

func (z *PovBlock) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PovBlock) Deserialize

func (blk *PovBlock) Deserialize(text []byte) error

func (*PovBlock) EncodeMsg

func (z *PovBlock) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PovBlock) GetBody

func (blk *PovBlock) GetBody() *PovBody

func (*PovBlock) GetCoinbase

func (blk *PovBlock) GetCoinbase() Address

func (*PovBlock) GetHash

func (blk *PovBlock) GetHash() Hash

func (*PovBlock) GetHeader

func (blk *PovBlock) GetHeader() *PovHeader

func (*PovBlock) GetHeight

func (blk *PovBlock) GetHeight() uint64

func (*PovBlock) GetMerkleRoot

func (blk *PovBlock) GetMerkleRoot() Hash

func (*PovBlock) GetNonce

func (blk *PovBlock) GetNonce() uint64

func (*PovBlock) GetPrevious

func (blk *PovBlock) GetPrevious() Hash

func (*PovBlock) GetSignature

func (blk *PovBlock) GetSignature() Signature

func (*PovBlock) GetStateHash

func (blk *PovBlock) GetStateHash() Hash

func (*PovBlock) GetTarget

func (blk *PovBlock) GetTarget() Signature

func (*PovBlock) GetTimestamp

func (blk *PovBlock) GetTimestamp() int64

func (*PovBlock) GetTxNum

func (blk *PovBlock) GetTxNum() uint32

func (*PovBlock) GetVoteSignature

func (blk *PovBlock) GetVoteSignature() Signature

func (*PovBlock) MarshalMsg

func (z *PovBlock) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PovBlock) Msgsize

func (z *PovBlock) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovBlock) Serialize

func (blk *PovBlock) Serialize() ([]byte, error)

func (*PovBlock) String

func (blk *PovBlock) String() string

func (*PovBlock) UnmarshalMsg

func (z *PovBlock) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PovBlockFrom

type PovBlockFrom uint16
const (
	Unkonwn PovBlockFrom = iota
	PovBlockFromLocal
	PovBlockFromRemoteBroadcast
	PovBlockFromRemoteFetch
	PovBlockFromRemoteSync
)

func (*PovBlockFrom) DecodeMsg

func (z *PovBlockFrom) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (PovBlockFrom) EncodeMsg

func (z PovBlockFrom) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (PovBlockFrom) MarshalMsg

func (z PovBlockFrom) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PovBlockFrom) Msgsize

func (z PovBlockFrom) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovBlockFrom) UnmarshalMsg

func (z *PovBlockFrom) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PovBlocks

type PovBlocks []*PovBlock

func (*PovBlocks) DecodeMsg

func (z *PovBlocks) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PovBlocks) Deserialize

func (bs *PovBlocks) Deserialize(text []byte) error

func (PovBlocks) EncodeMsg

func (z PovBlocks) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (PovBlocks) MarshalMsg

func (z PovBlocks) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PovBlocks) Msgsize

func (z PovBlocks) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovBlocks) Serialize

func (bs *PovBlocks) Serialize() ([]byte, error)

func (*PovBlocks) UnmarshalMsg

func (z *PovBlocks) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PovBody

type PovBody struct {
	Transactions []*PovTransaction `msg:"transactions" json:"transactions"`
}

PovBody is a simple (mutable, non-safe) data container for storing and moving a block's data contents (transactions) together.

func (*PovBody) DecodeMsg

func (z *PovBody) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PovBody) Deserialize

func (body *PovBody) Deserialize(text []byte) error

func (*PovBody) EncodeMsg

func (z *PovBody) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PovBody) MarshalMsg

func (z *PovBody) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PovBody) Msgsize

func (z *PovBody) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovBody) Serialize

func (body *PovBody) Serialize() ([]byte, error)

func (*PovBody) UnmarshalMsg

func (z *PovBody) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PovHeader

type PovHeader struct {
	Hash Hash `msg:"hash,extension" json:"hash"`

	Previous      Hash      `msg:"previous,extension" json:"previous"`
	MerkleRoot    Hash      `msg:"merkleRoot,extension" j son:"merkleRoot"`
	Nonce         uint64    `msg:"nonce" json:"nonce"`
	VoteSignature Signature `msg:"voteSignature,extension" json:"voteSignature"`

	Height    uint64    `msg:"height" json:"height"`
	Timestamp int64     `msg:"timestamp" json:"timestamp"`
	Target    Signature `msg:"target,extension" json:"target"`
	Coinbase  Address   `msg:"coinbase,extension" json:"coinbase"`
	TxNum     uint32    `msg:"txNum" json:"txNum"`
	StateHash Hash      `msg:"stateHash,extension" json:"stateHash"`

	Signature Signature `msg:"signature,extension" json:"signature"`
}

PovHeader represents a block header in the PoV blockchain.

func (*PovHeader) Copy

func (header *PovHeader) Copy() *PovHeader

func (*PovHeader) DecodeMsg

func (z *PovHeader) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PovHeader) Deserialize

func (header *PovHeader) Deserialize(text []byte) error

func (*PovHeader) EncodeMsg

func (z *PovHeader) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PovHeader) GetCoinbase

func (header *PovHeader) GetCoinbase() Address

func (*PovHeader) GetHash

func (header *PovHeader) GetHash() Hash

func (*PovHeader) GetHeight

func (header *PovHeader) GetHeight() uint64

func (*PovHeader) GetMerkleRoot

func (header *PovHeader) GetMerkleRoot() Hash

func (*PovHeader) GetNonce

func (header *PovHeader) GetNonce() uint64

func (*PovHeader) GetPrevious

func (header *PovHeader) GetPrevious() Hash

func (*PovHeader) GetSignature

func (header *PovHeader) GetSignature() Signature

func (*PovHeader) GetStateHash

func (header *PovHeader) GetStateHash() Hash

func (*PovHeader) GetTarget

func (header *PovHeader) GetTarget() Signature

func (*PovHeader) GetTimestamp

func (header *PovHeader) GetTimestamp() int64

func (*PovHeader) GetTxNum

func (header *PovHeader) GetTxNum() uint32

func (*PovHeader) GetVoteSignature

func (header *PovHeader) GetVoteSignature() Signature

func (*PovHeader) MarshalMsg

func (z *PovHeader) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PovHeader) Msgsize

func (z *PovHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovHeader) Serialize

func (header *PovHeader) Serialize() ([]byte, error)

func (*PovHeader) UnmarshalMsg

func (z *PovHeader) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PovRepState

type PovRepState struct {
	Balance Balance `msg:"balance,extension" json:"balance"`
	Vote    Balance `msg:"vote,extension" json:"vote"`
	Network Balance `msg:"network,extension" json:"network"`
	Storage Balance `msg:"storage,extension" json:"storage"`
	Oracle  Balance `msg:"oracle,extension" json:"oracle"`
	Total   Balance `msg:"total,extension" json:"total"`
}

func NewPovRepState

func NewPovRepState() *PovRepState

func (*PovRepState) CalcTotal

func (rs *PovRepState) CalcTotal() Balance

func (*PovRepState) Clone

func (rs *PovRepState) Clone() *PovRepState

func (*PovRepState) DecodeMsg

func (z *PovRepState) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PovRepState) Deserialize

func (rs *PovRepState) Deserialize(text []byte) error

func (*PovRepState) EncodeMsg

func (z *PovRepState) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PovRepState) MarshalMsg

func (z *PovRepState) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PovRepState) Msgsize

func (z *PovRepState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovRepState) Serialize

func (rs *PovRepState) Serialize() ([]byte, error)

func (*PovRepState) String

func (rs *PovRepState) String() string

func (*PovRepState) UnmarshalMsg

func (z *PovRepState) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PovTokenState

type PovTokenState struct {
	Type           Hash    `msg:"type,extension" json:"type"`
	Representative Address `msg:"rep,extension" json:"representative"`
	Balance        Balance `msg:"balance,extension" json:"balance"`
}

func NewPovTokenState

func NewPovTokenState() *PovTokenState

func (*PovTokenState) Clone

func (ts *PovTokenState) Clone() *PovTokenState

func (*PovTokenState) DecodeMsg

func (z *PovTokenState) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PovTokenState) Deserialize

func (ts *PovTokenState) Deserialize(text []byte) error

func (PovTokenState) EncodeMsg

func (z PovTokenState) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (PovTokenState) MarshalMsg

func (z PovTokenState) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PovTokenState) Msgsize

func (z PovTokenState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovTokenState) Serialize

func (ts *PovTokenState) Serialize() ([]byte, error)

func (*PovTokenState) String

func (ts *PovTokenState) String() string

func (*PovTokenState) UnmarshalMsg

func (z *PovTokenState) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PovTransaction

type PovTransaction struct {
	Hash  Hash        `msg:"hash,extension" json:"hash"`
	Block *StateBlock `msg:"-" json:"-"`
}

PovTransaction represents an state block metadata in the PoV block.

func (*PovTransaction) DecodeMsg

func (z *PovTransaction) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PovTransaction) Deserialize

func (tx *PovTransaction) Deserialize(text []byte) error

func (PovTransaction) EncodeMsg

func (z PovTransaction) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PovTransaction) GetHash

func (tx *PovTransaction) GetHash() Hash

func (PovTransaction) MarshalMsg

func (z PovTransaction) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PovTransaction) Msgsize

func (z PovTransaction) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovTransaction) Serialize

func (tx *PovTransaction) Serialize() ([]byte, error)

func (*PovTransaction) UnmarshalMsg

func (z *PovTransaction) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PovTransactions

type PovTransactions []*PovTransaction

PovTransactions is a PovTransaction slice type for basic sorting.

func (PovTransactions) Len

func (s PovTransactions) Len() int

Len returns the length of s.

func (PovTransactions) Swap

func (s PovTransactions) Swap(i, j int)

Swap swaps the i'th and the j'th element in s.

type PovTxByHash

type PovTxByHash PovTransactions

PovTxByHash implements the sort interface to allow sorting a list of transactions by their hash.

func (PovTxByHash) Len

func (s PovTxByHash) Len() int

func (PovTxByHash) Less

func (s PovTxByHash) Less(i, j int) bool

func (PovTxByHash) Swap

func (s PovTxByHash) Swap(i, j int)

type PovTxLookup

type PovTxLookup struct {
	BlockHash   Hash   `msg:"blockHash,extension" json:"blockHash"`
	BlockHeight uint64 `msg:"blockHeight" json:"blockHeight"`
	TxIndex     uint64 `msg:"txIndex" json:"txIndex"`
}

TxLookupEntry is a positional metadata to help looking up the data content of a transaction given only its hash.

func (*PovTxLookup) DecodeMsg

func (z *PovTxLookup) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PovTxLookup) Deserialize

func (txl *PovTxLookup) Deserialize(text []byte) error

func (PovTxLookup) EncodeMsg

func (z PovTxLookup) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (PovTxLookup) MarshalMsg

func (z PovTxLookup) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PovTxLookup) Msgsize

func (z PovTxLookup) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PovTxLookup) Serialize

func (txl *PovTxLookup) Serialize() ([]byte, error)

func (*PovTxLookup) UnmarshalMsg

func (z *PovTxLookup) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Seed

type Seed [SeedSize]byte

Seed of account

func BytesToSeed

func BytesToSeed(b []byte) (*Seed, error)

func NewSeed

func NewSeed() (*Seed, error)

NewSeed generate new seed

func (*Seed) Account

func (s *Seed) Account(index uint32) (*Account, error)

Account get account by index from seed

func (*Seed) ExtensionType

func (s *Seed) ExtensionType() int8

ExtensionType implements Extension.ExtensionType interface

func (*Seed) IsZero

func (s *Seed) IsZero() bool

IsZero check address is zero

func (*Seed) Len

func (s *Seed) Len() int

ExtensionType implements Extension.Len interface

func (*Seed) MarshalBinaryTo

func (s *Seed) MarshalBinaryTo(text []byte) error

ExtensionType implements Extension.MarshalBinaryTo interface

func (*Seed) MarshalJSON

func (s *Seed) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface

func (*Seed) MasterAddress

func (s *Seed) MasterAddress() Address

MasterAddress the first address generate by seed

func (*Seed) String

func (s *Seed) String() string

String seed tostring

func (*Seed) UnmarshalBinary

func (s *Seed) UnmarshalBinary(text []byte) error

ExtensionType implements Extension.UnmarshalBinary interface

type Signature

type Signature [SignatureSize]byte

Signature of block

func BytesToSignature

func BytesToSignature(b []byte) (Signature, error)

func NewSignature

func NewSignature(hexStr string) (Signature, error)

func (Signature) Bytes

func (s Signature) Bytes() []byte

func (*Signature) ExtensionType

func (s *Signature) ExtensionType() int8

ExtensionType implements Extension.ExtensionType interface

func (*Signature) FromBigInt

func (s *Signature) FromBigInt(num *big.Int) error

FromBigInt converts a big.Int into a types.Signature.

func (*Signature) IsZero

func (s *Signature) IsZero() bool

IsZero check signature is zero

func (*Signature) Len

func (s *Signature) Len() int

ExtensionType implements Extension.Len interface

func (Signature) MarshalBinaryTo

func (s Signature) MarshalBinaryTo(text []byte) error

ExtensionType implements Extension.MarshalBinaryTo interface

func (Signature) MarshalText

func (s Signature) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Signature) Of

func (s *Signature) Of(hexString string) error

Of convert hex string to Signature

func (Signature) String

func (s Signature) String() string

String implements the fmt.Stringer interface.

func (*Signature) ToBigInt

func (s *Signature) ToBigInt() *big.Int

ToBigInt converts a types.Signature into a big.Int that can be used to perform math comparisons.

func (*Signature) UnmarshalBinary

func (s *Signature) UnmarshalBinary(text []byte) error

ExtensionType implements Extension.UnmarshalBinary interface

func (*Signature) UnmarshalText

func (s *Signature) UnmarshalText(text []byte) error

type StateBlock

type StateBlock struct {
	Type           BlockType `msg:"type" json:"type"`
	Token          Hash      `msg:"token,extension" json:"token"`
	Address        Address   `msg:"address,extension" json:"address"`
	Balance        Balance   `msg:"balance,extension" json:"balance"`
	Vote           Balance   `msg:"vote,extension" json:"vote"`
	Network        Balance   `msg:"network,extension" json:"network"`
	Storage        Balance   `msg:"storage,extension" json:"storage"`
	Oracle         Balance   `msg:"oracle,extension" json:"oracle"`
	Previous       Hash      `msg:"previous,extension" json:"previous"`
	Link           Hash      `msg:"link,extension" json:"link"`
	Sender         []byte    `msg:"sender" json:"sender,omitempty"`
	Receiver       []byte    `msg:"receiver" json:"receiver,omitempty"`
	Message        Hash      `msg:"message,extension" json:"message,omitempty"`
	Data           []byte    `msg:"data" json:"data,omitempty"`
	PoVHeight      uint64    `msg:"povHeight" json:"povHeight"`
	Timestamp      int64     `msg:"timestamp" json:"timestamp"`
	Extra          Hash      `msg:"extra,extension" json:"extra,omitempty"`
	Representative Address   `msg:"representative,extension" json:"representative"`
	Work           Work      `msg:"work,extension" json:"work"`
	Signature      Signature `msg:"signature,extension" json:"signature"`
}

func (*StateBlock) Clone

func (b *StateBlock) Clone() *StateBlock

func (*StateBlock) DecodeMsg

func (z *StateBlock) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*StateBlock) Deserialize

func (b *StateBlock) Deserialize(text []byte) error

func (*StateBlock) EncodeMsg

func (z *StateBlock) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*StateBlock) GetAddress

func (b *StateBlock) GetAddress() Address

func (*StateBlock) GetBalance

func (b *StateBlock) GetBalance() Balance

func (*StateBlock) GetData

func (b *StateBlock) GetData() []byte

func (*StateBlock) GetExtra

func (b *StateBlock) GetExtra() Hash

func (*StateBlock) GetHash

func (b *StateBlock) GetHash() Hash
func (b *StateBlock) GetLink() Hash

func (*StateBlock) GetMessage

func (b *StateBlock) GetMessage() Hash

func (*StateBlock) GetNetwork

func (b *StateBlock) GetNetwork() Balance

func (*StateBlock) GetOracle

func (b *StateBlock) GetOracle() Balance

func (*StateBlock) GetPrevious

func (b *StateBlock) GetPrevious() Hash

func (*StateBlock) GetReceiver

func (b *StateBlock) GetReceiver() []byte

func (*StateBlock) GetRepresentative

func (b *StateBlock) GetRepresentative() Address

func (*StateBlock) GetSender

func (b *StateBlock) GetSender() []byte

func (*StateBlock) GetSignature

func (b *StateBlock) GetSignature() Signature

func (*StateBlock) GetStorage

func (b *StateBlock) GetStorage() Balance

func (*StateBlock) GetTimestamp

func (b *StateBlock) GetTimestamp() int64

func (*StateBlock) GetToken

func (b *StateBlock) GetToken() Hash

func (*StateBlock) GetType

func (b *StateBlock) GetType() BlockType

func (*StateBlock) GetVote

func (b *StateBlock) GetVote() Balance

func (*StateBlock) GetWork

func (b *StateBlock) GetWork() Work

func (*StateBlock) IsContractBlock

func (b *StateBlock) IsContractBlock() bool

func (*StateBlock) IsOpen

func (b *StateBlock) IsOpen() bool

func (*StateBlock) IsReceiveBlock

func (b *StateBlock) IsReceiveBlock() bool

func (*StateBlock) IsSendBlock

func (b *StateBlock) IsSendBlock() bool

func (*StateBlock) IsValid

func (b *StateBlock) IsValid() bool

func (*StateBlock) MarshalMsg

func (z *StateBlock) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*StateBlock) Msgsize

func (z *StateBlock) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*StateBlock) Parent

func (b *StateBlock) Parent() Hash

func (*StateBlock) Root

func (b *StateBlock) Root() Hash

func (*StateBlock) Serialize

func (b *StateBlock) Serialize() ([]byte, error)

func (*StateBlock) Size

func (b *StateBlock) Size() int

func (*StateBlock) String

func (b *StateBlock) String() string

func (*StateBlock) TotalBalance

func (b *StateBlock) TotalBalance() Balance

func (*StateBlock) UnmarshalMsg

func (z *StateBlock) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type SynchronizedKind

type SynchronizedKind byte
const (
	Synchronized SynchronizedKind = iota
	UnSynchronized
)

func (*SynchronizedKind) DecodeMsg

func (z *SynchronizedKind) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (SynchronizedKind) EncodeMsg

func (z SynchronizedKind) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (SynchronizedKind) MarshalMsg

func (z SynchronizedKind) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (SynchronizedKind) Msgsize

func (z SynchronizedKind) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SynchronizedKind) UnmarshalMsg

func (z *SynchronizedKind) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type TimeSorter

type TimeSorter []int64

timeSorter implements sort.Interface to allow a slice of timestamps to be sorted.

func (TimeSorter) Len

func (s TimeSorter) Len() int

Len returns the number of timestamps in the slice. It is part of the sort.Interface implementation.

func (TimeSorter) Less

func (s TimeSorter) Less(i, j int) bool

Less returns whether the timstamp with index i should sort before the timestamp with index j. It is part of the sort.Interface implementation.

func (TimeSorter) Swap

func (s TimeSorter) Swap(i, j int)

Swap swaps the timestamps at the passed indices. It is part of the sort.Interface implementation.

type TokenInfo

type TokenInfo struct {
	TokenId       Hash     `json:"tokenId"`
	TokenName     string   `json:"tokenName"`
	TokenSymbol   string   `json:"tokenSymbol"`
	TotalSupply   *big.Int `json:"totalSupply"`
	Decimals      uint8    `json:"decimals"`
	Owner         Address  `json:"owner"`
	PledgeAmount  *big.Int `json:"pledgeAmount"`
	WithdrawTime  int64    `json:"withdrawTime"`
	PledgeAddress Address  `json:"pledgeAddress"`
	NEP5TxId      string   `json:"NEP5TxId"`
}

type TokenMeta

type TokenMeta struct {
	//TokenAccount Address `msg:"tokenAccount,extension" json:"token_account"`
	Type           Hash    `msg:"type,extension" json:"type"`
	Header         Hash    `msg:"header,extension" json:"header"`
	Representative Address `msg:"rep,extension" json:"representative"`
	OpenBlock      Hash    `msg:"open,extension" json:"open"`
	Balance        Balance `msg:"balance,extension" json:"balance"`
	BelongTo       Address `msg:"account,extension" json:"account"`
	Modified       int64   `msg:"modified" json:"modified"`
	BlockCount     int64   `msg:"blockCount," json:"blockCount"`
}

func (*TokenMeta) DecodeMsg

func (z *TokenMeta) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*TokenMeta) EncodeMsg

func (z *TokenMeta) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*TokenMeta) MarshalMsg

func (z *TokenMeta) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*TokenMeta) Msgsize

func (z *TokenMeta) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*TokenMeta) UnmarshalMsg

func (z *TokenMeta) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UncheckedBlockWalkFunc

type UncheckedBlockWalkFunc func(block Block, link Hash, unCheckType UncheckedKind, sync SynchronizedKind) error

type UncheckedKind

type UncheckedKind byte
const (
	UncheckedKindPrevious UncheckedKind = iota
	UncheckedKindLink
)

func (*UncheckedKind) DecodeMsg

func (z *UncheckedKind) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (UncheckedKind) EncodeMsg

func (z UncheckedKind) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (UncheckedKind) MarshalMsg

func (z UncheckedKind) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (UncheckedKind) Msgsize

func (z UncheckedKind) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UncheckedKind) UnmarshalMsg

func (z *UncheckedKind) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Work

type Work uint64

Work PoW work

func (*Work) ExtensionType

func (w *Work) ExtensionType() int8

ExtensionType implements Extension.ExtensionType interface

func (Work) IsValid

func (w Work) IsValid(root Hash) bool

IsValid check work is valid

func (*Work) Len

func (w *Work) Len() int

ExtensionType implements Extension.Len interface

func (*Work) MarshalBinaryTo

func (w *Work) MarshalBinaryTo(text []byte) error

ExtensionType implements Extension.MarshalBinaryTo interface

func (Work) MarshalText

func (w Work) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Work) ParseWorkHexString

func (w *Work) ParseWorkHexString(hexString string) error

ParseWorkHexString create Work from hex string

func (Work) String

func (w Work) String() string

String implements the fmt.Stringer interface.

func (*Work) UnmarshalBinary

func (w *Work) UnmarshalBinary(text []byte) error

ExtensionType implements Extension.UnmarshalBinary interface

func (*Work) UnmarshalText

func (w *Work) UnmarshalText(text []byte) error

type Worker

type Worker struct {
	Threshold uint64
	// contains filtered or unexported fields
}

Worker PoW

func NewWorker

func NewWorker(work Work, root Hash) (*Worker, error)

NewWorker create new worker

func (*Worker) IsValid

func (w *Worker) IsValid() bool

IsValid check work is valid

func (*Worker) NewWork

func (w *Worker) NewWork() Work

NewWork generate new work

func (*Worker) Reset

func (w *Worker) Reset()

Reset worker

Jump to

Keyboard shortcuts

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