Versions in this module Expand all Collapse all v1 v1.0.0 Apr 12, 2019 Changes in this version + var AddressIsNotCurrentVerifier = errors.New("the recover Address isn't current verifier") + var AddressIsNotVerifierBootNode = errors.New("the Address isn't verifier boot node") + var BlockCountOfPeriod uint64 + var DefaultBlockBloomConfig = iblt.NewBloomConfig(8, 4) + var DefaultInvBloomConfig = iblt.NewInvBloomConfig(1 << 12, 4) + var DefaultPriorityCalculator = getCalculator() + var DefaultTxs = 100 + var EmptyInterRoot = DeriveSha(InterLink{}) + var EmptyTxRoot = DeriveSha(Transactions{}) + var EmptyVerfRoot = DeriveSha(Verifications{}) + var ErrInvalidSig = errors.New("invalid transaction v, r, s values") + var IgnoreDifficultyValidation = false + var StakeValMin = float64(100) + var VoteRecoverAddrError = errors.New("the aliveVerifierVote recover Address is invalid") + var WrongVoteType = errors.New("wrong vote type") + func CalNonce(block *Block) + func CalPriority(hash common.Hash, reputation uint64) (uint64, error) + func CalReputation(nonce uint64, stake *big.Int, performance uint64) (uint64, error) + func CheckAddressIsCurrentVerifier(address common.Address, verifiers []common.Address) bool + func CheckAddressIsVerifierBootNode(address common.Address) bool + func CreateKey() (*ecdsa.PrivateKey, *ecdsa.PrivateKey) + func DeriveSha(list DerivableList) common.Hash + func Elem(x float64, epsilon1 float64, epsilon2 float64, epsilon3 float64) (float64, error) + func HashLevel(hash common.Hash, maxHash common.Hash) int + func IsIgnoreDifficultyValidation() bool + func LastPeriodBlockNum(curBlockNum uint64) uint64 + func NewCalNewWorkDiff(preSpanBlock, lastNormalBlock AbstractBlock, currentBlockNumber uint64) common.Difficulty + func RunWorkMap(task iblt.Operation, txs []*Transaction) error + func SetBlockJsonHandler(h BlockJsonHandler) + func SetBlockRlpHandler(h BlockRlpHandler) + type AbsTransactions []AbstractTransaction + func (verf AbsTransactions) GetKey(i int) []byte + func (verf AbsTransactions) GetRlp(i int) []byte + func (verf AbsTransactions) Len() int + type AbstractBlock interface + Body func() AbstractBody + CoinBase func() *big.Int + CoinBaseAddress func() common.Address + Difficulty func() common.Difficulty + EncodeRlpToBytes func() ([]byte, error) + FormatForRpc func() interface{} + GetAbsTransactions func() []AbstractTransaction + GetBlockTxsBloom func() *iblt.Bloom + GetBloom func() iblt.Bloom + GetEiBloomBlockData func(reqEstimator *iblt.HybridEstimator) *BloomBlockData + GetInterLinkRoot func() (root common.Hash) + GetInterlinks func() InterLink + GetRegisterRoot func() common.Hash + GetTransactionFees func() *big.Int + GetTransactions func() []*Transaction + GetVerifications func() []AbstractVerification + Hash func() common.Hash + Header func() AbstractHeader + IsSpecial func() bool + Nonce func() common.BlockNonce + Number func() uint64 + PreHash func() common.Hash + RefreshHashCache func() common.Hash + Seed func() common.Hash + SetInterLinkRoot func(root common.Hash) + SetInterLinks func(inter InterLink) + SetNonce func(nonce common.BlockNonce) + SetRegisterRoot func(root common.Hash) + SetStateRoot func(root common.Hash) + SetVerifications func(vs []AbstractVerification) + StateRoot func() common.Hash + Timestamp func() *big.Int + TxCount func() int + TxIterator func(cb func(int, AbstractTransaction) error) error + TxRoot func() common.Hash + VerificationRoot func() common.Hash + VersIterator func(func(int, AbstractVerification, AbstractBlock) error) error + Version func() uint64 + type AbstractBody interface + EncodeRlpToBytes func() ([]byte, error) + GetInterLinks func() InterLink + GetTxByIndex func(i int) AbstractTransaction + GetTxsSize func() int + type AbstractHeader interface + CoinBaseAddress func() common.Address + DuplicateHeader func() AbstractHeader + EncodeRlpToBytes func() ([]byte, error) + GetDifficulty func() common.Difficulty + GetInterLinkRoot func() common.Hash + GetMinerPubKey func() *ecdsa.PublicKey + GetNumber func() uint64 + GetPreHash func() common.Hash + GetProof func() []byte + GetRegisterRoot func() common.Hash + GetSeed func() common.Hash + GetStateRoot func() common.Hash + Hash func() common.Hash + IsEqual func(header AbstractHeader) bool + SetRegisterRoot func(root common.Hash) + SetVerificationRoot func(newRoot common.Hash) + type AbstractTransaction interface + Amount func() *big.Int + CalTxId func() common.Hash + Cost func() *big.Int + EncodeRlpToBytes func() ([]byte, error) + EstimateFee func() *big.Int + ExtraData func() []byte + Fee func() *big.Int + GetSigner func() Signer + GetType func() common.TxType + Nonce func() uint64 + Sender func(singer Signer) (common.Address, error) + SenderPublicKey func(signer Signer) (*ecdsa.PublicKey, error) + Size func() common.StorageSize + To func() *common.Address + func TxDifference(a, b []AbstractTransaction) []AbstractTransaction + type AbstractVerification interface + GetAddress func() common.Address + GetBlockHash func() string + GetBlockId func() common.Hash + GetHeight func() uint64 + GetRound func() uint64 + GetType func() VoteMsgType + GetViewID func() uint64 + HaltedVoteValid func(verifiers []common.Address) error + Valid func() error + type BftBlockBody struct + Inters InterLink + Txs []*Transaction + Vers []*VoteMsg + type Block struct + func CreateBlock(num uint64, preHash common.Hash, txsNum int) *Block + func NewBlock(header *Header, txs []*Transaction, msgs []AbstractVerification) *Block + func NewBlockWithLink(header *Header, txs []*Transaction, msgs []AbstractVerification, ...) *Block + func (b *Block) Body() AbstractBody + func (b *Block) CoinBase() *big.Int + func (b *Block) CoinBaseAddress() common.Address + func (b *Block) DecodeRLP(s *rlp.Stream) error + func (b *Block) Difficulty() common.Difficulty + func (b *Block) EncodeRLP(w io.Writer) error + func (b *Block) EncodeRlpToBytes() ([]byte, error) + func (b *Block) EncodeToIBLT() *iblt.Graphene + func (b *Block) FormatForRpc() interface{} + func (b *Block) GetAbsTransactions() []AbstractTransaction + func (b *Block) GetBlockTxsBloom() *iblt.Bloom + func (b *Block) GetBloom() iblt.Bloom + func (b *Block) GetEiBloomBlockData(reqEstimator *iblt.HybridEstimator) *BloomBlockData + func (b *Block) GetHeader() AbstractHeader + func (b *Block) GetInterLinkRoot() (root common.Hash) + func (b *Block) GetInterlinks() InterLink + func (b *Block) GetRegisterRoot() common.Hash + func (b *Block) GetTransactions() []*Transaction + func (b *Block) GetVerifications() (result []AbstractVerification) + func (b *Block) Hash() common.Hash + func (b *Block) Header() AbstractHeader + func (b *Block) IsSpecial() bool + func (b *Block) Nonce() common.BlockNonce + func (b *Block) Number() uint64 + func (b *Block) PreHash() common.Hash + func (b *Block) RefreshHashCache() common.Hash + func (b *Block) Seed() common.Hash + func (b *Block) SetDifficulty(diff common.Difficulty) + func (b *Block) SetInterLinkRoot(root common.Hash) + func (b *Block) SetInterLinks(inter InterLink) + func (b *Block) SetNonce(nonce common.BlockNonce) + func (b *Block) SetRegisterRoot(root common.Hash) + func (b *Block) SetStateRoot(root common.Hash) + func (b *Block) SetTimeStamp(timeStamp *big.Int) + func (b *Block) SetVerifications(vs []AbstractVerification) + func (b *Block) StateRoot() common.Hash + func (b *Block) String() string + func (b *Block) Timestamp() *big.Int + func (b *Block) Transaction(hash common.Hash) *Transaction + func (b *Block) TxCount() int + func (b *Block) TxRoot() common.Hash + func (b *Block) UnmarshalJSON(input []byte) error + func (b *Block) VerificationRoot() common.Hash + func (b *Block) Verifications() []AbstractVerification + func (b *Block) Version() uint64 + func (b Block) GetCoinbase() *big.Int + func (b Block) GetTransactionFees() *big.Int + func (b Block) MarshalJSON() ([]byte, error) + func (b Block) TxIterator(cb func(int, AbstractTransaction) error) error + func (b Block) VersIterator(cb func(int, AbstractVerification, AbstractBlock) error) error + type BlockBy func(b1, b2 *Block) bool + func (self BlockBy) Sort(blocks Blocks) + type BlockDecoder interface + DecodeRlpBlockFromBytes func(data []byte) (AbstractBlock, error) + DecodeRlpBlockFromHeaderAndBodyBytes func(headerB []byte, bodyB []byte) (AbstractBlock, error) + DecodeRlpBodyFromBytes func(data []byte) (AbstractBody, error) + DecodeRlpHeaderFromBytes func(data []byte) (AbstractHeader, error) + DecodeRlpTransactionFromBytes func(data []byte) (AbstractTransaction, error) + func MakeDefaultBlockDecoder() BlockDecoder + type BlockJsonHandler interface + DecodeBody func(to *Body, input []byte) error + type BlockRlpHandler interface + DecodeBody func(to *Body, s *rlp.Stream) error + type Blocks []*Block + type BloomBlockData struct + BloomRLP []byte + CurVerification []AbstractVerification + Header *Header + Interlinks InterLink + PreVerification []AbstractVerification + func (data *BloomBlockData) EiRecoverToBlock(txPoolMap map[common.Hash]AbstractTransaction) (block *Block, err error) + type Body struct + Inters InterLink + Txs []*Transaction + Vers []AbstractVerification + func (b *Body) DecodeRLP(s *rlp.Stream) error + func (b *Body) EncodeRlpToBytes() ([]byte, error) + func (b *Body) GetInterLinks() InterLink + func (b *Body) GetTxByIndex(i int) AbstractTransaction + func (b *Body) GetTxsSize() int + func (b *Body) UnmarshalJSON(input []byte) error + type DerivableList interface + GetKey func(i int) []byte + GetRlp func(i int) []byte + Len func() int + type DeriveShaInterface interface + DeriveSha func(list DerivableList) common.Hash + type Header struct + Bloom *iblt.Bloom + CoinBase common.Address + Diff common.Difficulty + InterlinkRoot common.Hash + MinerPubKey []byte + Nonce common.BlockNonce + Number uint64 + PreHash common.Hash + Proof []byte + RegisterRoot common.Hash + Seed common.Hash + StateRoot common.Hash + TimeStamp *big.Int + TransactionRoot common.Hash + VerificationRoot common.Hash + Version uint64 + func CopyHeader(h *Header) *Header + func NewHeader(version uint64, num uint64, prehash common.Hash, seed common.Hash, ...) *Header + func (bh *Header) GetDifficulty() common.Difficulty + func (h *Header) CoinBaseAddress() common.Address + func (h *Header) DuplicateHeader() AbstractHeader + func (h *Header) EncodeRlpToBytes() ([]byte, error) + func (h *Header) GetInterLinkRoot() common.Hash + func (h *Header) GetMinerPubKey() *ecdsa.PublicKey + func (h *Header) GetNumber() uint64 + func (h *Header) GetPreHash() common.Hash + func (h *Header) GetProof() []byte + func (h *Header) GetRegisterRoot() common.Hash + func (h *Header) GetSeed() common.Hash + func (h *Header) GetStateRoot() common.Hash + func (h *Header) Hash() common.Hash + func (h *Header) HashWithoutNonce() common.Hash + func (h *Header) IsEqual(header AbstractHeader) bool + func (h *Header) SetRegisterRoot(root common.Hash) + func (h *Header) SetVerificationRoot(newRoot common.Hash) + func (h *Header) Size() common.StorageSize + func (h *Header) String() string + func (h *Header) UnmarshalJSON(input []byte) error + func (h Header) MarshalJSON() ([]byte, error) + func (h Header) RlpBlockWithoutNonce() (rb []byte) + type InterLink []common.Hash + func NewInterLink(preBlockLinks InterLink, curBlock AbstractBlock) InterLink + func (l InterLink) GetKey(i int) []byte + func (l InterLink) GetRlp(i int) []byte + func (l InterLink) Len() int + type MapWorkHybridEstimator struct + func (estimator MapWorkHybridEstimator) DoTask(i interface{}) interface{} + type MapWorkInvBloom struct + func (bloom MapWorkInvBloom) DoTask(i interface{}) interface{} + type MercurySigner struct + func NewMercurySigner(chainId *big.Int) MercurySigner + func (fs MercurySigner) Equal(s2 Signer) bool + func (fs MercurySigner) GetSender(tx *Transaction) (common.Address, error) + func (fs MercurySigner) GetSenderPublicKey(tx *Transaction) (*ecdsa.PublicKey, error) + func (fs MercurySigner) GetSignHash(rtx *Transaction) (common.Hash, error) + func (fs MercurySigner) SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error) + type PBFTBlockJsonHandler struct + func (h *PBFTBlockJsonHandler) DecodeBody(to *Body, input []byte) error + type PBFTBlockRlpHandler struct + func (h *PBFTBlockRlpHandler) DecodeBody(to *Body, s *rlp.Stream) error + type PBFTBody struct + Inters InterLink + Txs []*Transaction + Vers []*VoteMsg + type PriofityCalculator interface + GetElectPriority func(common.Hash, uint64, *big.Int, uint64) (uint64, error) + GetReputation func(uint64, *big.Int, uint64) (uint64, error) + type Proofs struct + Priority uint64 + Proof []byte + VRFHash common.Hash + VoteA *VoteMsg + VoteB *VoteMsg + type RpcTransaction struct + Data []byte + Nonce uint64 + To common.Address + TransactionFee *big.Int + Value *big.Int + type SignHashFunc func(hash []byte) ([]byte, error) + type Signer interface + Equal func(Signer) bool + GetSender func(tx *Transaction) (common.Address, error) + GetSenderPublicKey func(tx *Transaction) (*ecdsa.PublicKey, error) + GetSignHash func(rtx *Transaction) (common.Hash, error) + SignatureValues func(tx *Transaction, sig []byte) (r, s, v *big.Int, err error) + func MakeSigner(config *chain_config.ChainConfig, blockNumber uint64) Signer + type TestCalculator struct + func (tc TestCalculator) GetElectPriority(hash common.Hash, nonce uint64, stake *big.Int, performance uint64) (uint64, error) + func (tc TestCalculator) GetReputation(nonce uint64, stake *big.Int, performance uint64) (uint64, error) + type Transaction struct + func CreateRawClaimTx(nonce uint64, key []byte, amount *big.Int, fee *big.Int, alice common.Address, ...) *Transaction + func CreateRawLockTx(nonce uint64, lock common.Hash, time *big.Int, amount *big.Int, fee *big.Int, ...) *Transaction + func CreateRawRefundTx(nonce uint64, amount *big.Int, fee *big.Int, alice common.Address, ...) *Transaction + func CreateSignedTx(nonce uint64, amount *big.Int) *Transaction + func CreateSignedTxList(n int) []*Transaction + func NewCancelTransaction(nonce uint64, fee *big.Int) *Transaction + func NewContractCreation(nonce uint64, amount *big.Int, fee *big.Int, data []byte) *Transaction + func NewEvidenceTransaction(nonce uint64, fee *big.Int, target *common.Address, voteA *VoteMsg, ...) *Transaction + func NewRegisterTransaction(nonce uint64, amount *big.Int, fee *big.Int) *Transaction + func NewTransaction(nonce uint64, to common.Address, amount *big.Int, fee *big.Int, data []byte) *Transaction + func NewUnNormalTransaction(nonce uint64, amount *big.Int, fee *big.Int) *Transaction + func NewUnStakeTransaction(nonce uint64, fee *big.Int) *Transaction + func (tx *Transaction) Amount() *big.Int + func (tx *Transaction) CalTxId() common.Hash + func (tx *Transaction) Cost() *big.Int + func (tx *Transaction) DecodeRLP(s *rlp.Stream) error + func (tx *Transaction) EncodeRLP(w io.Writer) error + func (tx *Transaction) EncodeRlpToBytes() ([]byte, error) + func (tx *Transaction) EstimateFee() *big.Int + func (tx *Transaction) ExtraData() []byte + func (tx *Transaction) Fee() *big.Int + func (tx *Transaction) HashKey() []byte + func (tx *Transaction) HashLock() *common.Hash + func (tx *Transaction) Nonce() uint64 + func (tx *Transaction) RawSignatureValues() (*big.Int, *big.Int, *big.Int) + func (tx *Transaction) Sender(signer Signer) (common.Address, error) + func (tx *Transaction) SenderPublicKey(signer Signer) (*ecdsa.PublicKey, error) + func (tx *Transaction) SignTx(priKey *ecdsa.PrivateKey, s Signer) (*Transaction, error) + func (tx *Transaction) Size() common.StorageSize + func (tx *Transaction) TimeLock() *big.Int + func (tx *Transaction) To() *common.Address + func (tx *Transaction) UnmarshalJSON(input []byte) error + func (tx Transaction) ChainId() *big.Int + func (tx Transaction) GetSigner() Signer + func (tx Transaction) GetType() common.TxType + func (tx Transaction) IsEqual(tempTx Transaction) bool + func (tx Transaction) MarshalJSON() ([]byte, error) + func (tx Transaction) String() string + type TransactionBuilder struct + func (builder *TransactionBuilder) NewNormalTransaction(from common.Address, to common.Address, amount *big.Int, fee *big.Int, ...) AbstractTransaction + type TransactionBy func(b1, b2 *Block) bool + func (self TransactionBy) Sort(blocks Blocks) + type TransactionJSON struct + TxData txData + Wit witness + type TransactionRLP struct + Txdata txData + Wit witness + type Transactions []*Transaction + func (ss Transactions) GetKey(i int) []byte + func (ss Transactions) GetRlp(i int) []byte + func (ss Transactions) Len() int + func (ss Transactions) Less(i, j int) bool + func (ss Transactions) String() string + func (ss Transactions) Swap(i, j int) + type TransactionsByFeeAndNonce struct + func NewTransactionsByFeeAndNonce(signer Signer, txs map[common.Address][]AbstractTransaction) *TransactionsByFeeAndNonce + func (t *TransactionsByFeeAndNonce) Peek() AbstractTransaction + func (t *TransactionsByFeeAndNonce) Pop() + func (t *TransactionsByFeeAndNonce) Shift() + type TxByFee []AbstractTransaction + func (s *TxByFee) Pop() interface{} + func (s *TxByFee) Push(x interface{}) + func (s TxByFee) Len() int + func (s TxByFee) Less(i, j int) bool + func (s TxByFee) Swap(i, j int) + type TxCacher struct + func NewTxCacher(threads int) *TxCacher + func (cacher *TxCacher) StopTxCacher() + func (cacher *TxCacher) TxRecover(txs []AbstractTransaction) + type TxCacherRequest struct + type Verifications []AbstractVerification + func (verf Verifications) GetKey(i int) []byte + func (verf Verifications) GetRlp(i int) []byte + func (verf Verifications) Len() int + type VoteMsg struct + BlockID common.Hash + Height uint64 + Round uint64 + Timestamp time.Time + VoteType VoteMsgType + Witness *WitMsg + func CreateSignedVote(height, round uint64, blockId common.Hash, voteType VoteMsgType) *VoteMsg + func NewVoteMsg(height, round uint64, blockID common.Hash, voteType VoteMsgType) *VoteMsg + func NewVoteMsgWithSign(height, round uint64, blockID common.Hash, voteType VoteMsgType, ...) (*VoteMsg, error) + func (v VoteMsg) GetAddress() common.Address + func (v VoteMsg) GetBlockHash() string + func (v VoteMsg) GetBlockId() common.Hash + func (v VoteMsg) GetHeight() uint64 + func (v VoteMsg) GetRound() uint64 + func (v VoteMsg) GetType() VoteMsgType + func (v VoteMsg) GetViewID() uint64 + func (v VoteMsg) HaltedVoteValid(verifiers []common.Address) error + func (v VoteMsg) Hash() common.Hash + func (v VoteMsg) String() string + func (v VoteMsg) Valid() error + type VoteMsgType byte + const AliveVerifierVoteMessage + const PreVoteMessage + const VerBootNodeVoteMessage + const VoteMessage + func (i VoteMsgType) String() string + type WitMsg struct + Address common.Address + Sign []byte + func (witMsg *WitMsg) Valid(dataHash []byte) error