Versions in this module Expand all Collapse all v1 v1.3.1 Jul 31, 2021 Changes in this version + const EventDataTypeFinalCommitted + const EventDataTypeFork + const EventDataTypeMessage + const EventDataTypeNewBlock + const EventDataTypeNewBlockHeader + const EventDataTypeRequest + const EventDataTypeRoundState + const EventDataTypeSignAggr + const EventDataTypeTx + const EventDataTypeVote + const EventDataTypeVote2Proposer + const HalfLooseRound + const LooseRound + const MaxBlockSize + const MaxSignAggrSize + const VoteTypePrecommit + const VoteTypePrevote + var CONSENSUS_NeatCon string = "neatcon" + var CONSENSUS_POS string = "pos" + var CONSENSUS_POW string = "pow" + var ErrInvalidBlockPartHash = errors.New("Error invalid block part hash") + var ErrInvalidBlockPartSignature = errors.New("Error invalid block part signature") + var ErrPartSetInvalidProof = errors.New("Error part set invalid proof") + var ErrPartSetUnexpectedIndex = errors.New("Error part set unexpected index") + var ErrVoteInvalidBlockHash = errors.New("Invalid block hash") + var ErrVoteInvalidSignature = errors.New("Invalid round vote signature") + var ErrVoteInvalidValidatorAddress = errors.New("Invalid round vote validator address") + var ErrVoteInvalidValidatorIndex = errors.New("Invalid round vote validator index") + var ErrVoteUnexpectedStep = errors.New("Unexpected step") + var GenDocKey = []byte("GenDocKey") + var MainnetGenesisJSON string = ... + var PeerMempoolChKey = "MempoolReactor.peerMempoolCh" + var PeerStateKey = "ConsensusReactor.peerState" + var TestnetGenesisJSON string = ... + var ValidatorCodec = validatorCodec + func AddListenerForEvent(evsw EventSwitch, id, event string, cb func(data TMEventData)) + func EventStringBlockPart() string + func EventStringBond() string + func EventStringCompleteProposal() string + func EventStringDupeout() string + func EventStringFinalCommitted() string + func EventStringFork() string + func EventStringLock() string + func EventStringMessage() string + func EventStringNewBlock() string + func EventStringNewBlockHeader() string + func EventStringNewRound() string + func EventStringNewRoundStep() string + func EventStringPolka() string + func EventStringProposal() string + func EventStringProposalBlockParts() string + func EventStringRebond() string + func EventStringRelock() string + func EventStringRequest() string + func EventStringSignAggr() string + func EventStringTimeoutPropose() string + func EventStringTimeoutWait() string + func EventStringTx(tx Tx) string + func EventStringUnbond() string + func EventStringUnlock() string + func EventStringVote() string + func EventStringVote2Proposer() string + func FireEventCompleteProposal(fireable events.Fireable, rs EventDataRoundState) + func FireEventFinalCommitted(fireable events.Fireable, rs EventDataFinalCommitted) + func FireEventLock(fireable events.Fireable, rs EventDataRoundState) + func FireEventMessage(fireable events.Fireable, rs EventDataMessage) + func FireEventNewBlock(fireable events.Fireable, block EventDataNewBlock) + func FireEventNewBlockHeader(fireable events.Fireable, header EventDataNewBlockHeader) + func FireEventNewRound(fireable events.Fireable, rs EventDataRoundState) + func FireEventNewRoundStep(fireable events.Fireable, rs EventDataRoundState) + func FireEventPolka(fireable events.Fireable, rs EventDataRoundState) + func FireEventRelock(fireable events.Fireable, rs EventDataRoundState) + func FireEventRequest(fireable events.Fireable, rs EventDataRequest) + func FireEventSignAggr(fireable events.Fireable, sign EventDataSignAggr) + func FireEventTimeoutPropose(fireable events.Fireable, rs EventDataRoundState) + func FireEventTimeoutWait(fireable events.Fireable, rs EventDataRoundState) + func FireEventTx(fireable events.Fireable, tx EventDataTx) + func FireEventUnlock(fireable events.Fireable, rs EventDataRoundState) + func FireEventVote(fireable events.Fireable, vote EventDataVote) + func FireEventVote2Proposer(fireable events.Fireable, vote EventDataVote2Proposer) + func HashSignBytes(chainID string, o Signable) []byte + func IsVoteTypeValid(type_ byte) bool + func Loose23MajorThreshold(totalVotingPower *big.Int, round int) *big.Int + func MakeBlock(height uint64, chainID string, commit *Commit, block *types.Block, ...) (*NCBlock, *PartSet) + func SignBytes(chainID string, o Signable) []byte + type BlockID struct + Hash []byte + PartsHeader PartSetHeader + func (blockID BlockID) Equals(other BlockID) bool + func (blockID BlockID) IsZero() bool + func (blockID BlockID) Key() string + func (blockID BlockID) String() string + func (blockID BlockID) WriteSignBytes(w io.Writer, n *int, err *error) + type BlockIDApi struct + Hash string + PartsHeader PartSetHeaderApi + type CandidateApi struct + CandidateList []string + type CanonicalJSONBlockID struct + Hash []byte + PartsHeader CanonicalJSONPartSetHeader + func CanonicalBlockID(blockID BlockID) CanonicalJSONBlockID + type CanonicalJSONOnceProposal struct + ChainID string + Proposal CanonicalJSONProposal + type CanonicalJSONOnceSignAggr struct + ChainID string + SignAggr CanonicalJSONSignAggr + type CanonicalJSONOnceValidatorMsg struct + ChainID string + ValidatorMsg CanonicalJSONValidatorMsg + type CanonicalJSONOnceVote struct + ChainID string + Vote CanonicalJSONVote + type CanonicalJSONPartSetHeader struct + Hash []byte + Total uint64 + func CanonicalPartSetHeader(psh PartSetHeader) CanonicalJSONPartSetHeader + type CanonicalJSONProposal struct + BlockPartsHeader CanonicalJSONPartSetHeader + Hash []byte + Height uint64 + POLBlockID CanonicalJSONBlockID + POLRound int + Round int + func CanonicalProposal(proposal *Proposal) CanonicalJSONProposal + type CanonicalJSONSignAggr struct + BlockID CanonicalJSONBlockID + Height uint64 + Maj23 CanonicalJSONBlockID + NumValidators int + Round int + Sum int64 + Type byte + func CanonicalSignAggr(signAggr *SignAggr) CanonicalJSONSignAggr + type CanonicalJSONValidatorMsg struct + Action string + Epoch int + From string + Key string + Power uint64 + PubKey crypto.PubKey + Target string + ValidatorIndex int + type CanonicalJSONVote struct + BlockID CanonicalJSONBlockID + Height uint64 + Round uint64 + Type byte + func CanonicalVote(vote *Vote) CanonicalJSONVote + type Commit struct + BitArray *BitArray + BlockID BlockID + Height uint64 + Round int + SignAggr crypto.BLSSignature + func (commit *Commit) Hash() []byte + func (commit *Commit) NumCommits() int + func (commit *Commit) Size() int + func (commit *Commit) StringIndented(indent string) string + func (commit *Commit) Type() byte + func (commit *Commit) ValidateBasic() error + type CommitApi struct + BitArray *BitArray + BlockID BlockIDApi + Height hexutil.Uint64 + Round int + SignAggr crypto.BLSSignature + type ConsensusAggr struct + Addresses []common.Address + PublicKeys []string + type DefaultSigner struct + func NewDefaultSigner(priv crypto.PrivKey) *DefaultSigner + func (ds *DefaultSigner) Sign(msg []byte) crypto.Signature + type EpochApi struct + EndBlock hexutil.Uint64 + EndTime time.Time + Number hexutil.Uint64 + RewardPerBlock *hexutil.Big + StartBlock hexutil.Uint64 + StartTime time.Time + Validators []*EpochValidator + type EpochApiForConsole struct + EndBlock hexutil.Uint64 + EndTime time.Time + Number hexutil.Uint64 + RewardPerBlock *hexutil.Big + StartBlock hexutil.Uint64 + StartTime time.Time + Validators []*EpochValidatorForConsole + type EpochValidator struct + Address common.Address + Amount *hexutil.Big + PubKey string + RemainingEpoch hexutil.Uint64 + type EpochValidatorForConsole struct + Address string + Amount *hexutil.Big + PubKey string + RemainingEpoch hexutil.Uint64 + type EpochValidatorVoteApi struct + Salt string + TxHash common.Hash + VoteHash common.Hash + type EpochValidatorVoteApiForConsole struct + Salt string + TxHash common.Hash + VoteHash common.Hash + type EpochVotesApi struct + EndBlock hexutil.Uint64 + EpochNumber hexutil.Uint64 + StartBlock hexutil.Uint64 + Votes []*EpochValidatorVoteApi + type EpochVotesApiForConsole struct + EndBlock hexutil.Uint64 + EpochNumber hexutil.Uint64 + StartBlock hexutil.Uint64 + Votes []*EpochValidatorVoteApiForConsole + type ErrVoteConflictingVotes struct + VoteA *Vote + VoteB *Vote + func (err *ErrVoteConflictingVotes) Error() string + type EventCache interface + Flush func() + func NewEventCache(evsw EventSwitch) EventCache + type EventDataFinalCommitted struct + BlockNumber uint64 + func (_ EventDataFinalCommitted) AssertIsTMEventData() + type EventDataMessage struct + Payload []byte + func (_ EventDataMessage) AssertIsTMEventData() + type EventDataNewBlock struct + Block *NCBlock + func (_ EventDataNewBlock) AssertIsTMEventData() + type EventDataNewBlockHeader struct + Height int + func (_ EventDataNewBlockHeader) AssertIsTMEventData() + type EventDataRequest struct + Proposal *neatTypes.Block + func (_ EventDataRequest) AssertIsTMEventData() + type EventDataRoundState struct + Height uint64 + Round int + RoundState interface{} + Step string + func (_ EventDataRoundState) AssertIsTMEventData() + type EventDataSignAggr struct + SignAggr *SignAggr + func (_ EventDataSignAggr) AssertIsTMEventData() + type EventDataTx struct + Data []byte + Error string + Height int + Log string + Tx Tx + func (_ EventDataTx) AssertIsTMEventData() + type EventDataVote struct + Vote *Vote + func (_ EventDataVote) AssertIsTMEventData() + type EventDataVote2Proposer struct + ProposerKey string + Vote *Vote + func (_ EventDataVote2Proposer) AssertIsTMEventData() + type EventSwitch interface + func NewEventSwitch() EventSwitch + type Eventable interface + SetEventSwitch func(EventSwitch) + type Fireable interface + type ForbiddenApi struct + ForbiddenList []string + type GenesisDoc struct + ChainID string + Consensus string + CurrentEpoch OneEpochDoc + GenesisTime time.Time + RewardScheme RewardSchemeDoc + func GenesisDocFromJSON(jsonBlob []byte) (genDoc *GenesisDoc, err error) + func (genDoc *GenesisDoc) SaveAs(file string) error + type GenesisDocWrite struct + ChainID string + Consensus string + CurrentEpoch OneEpochDocWrite + GenesisTime time.Time + RewardScheme RewardSchemeDoc + type GenesisValidator struct + Amount *big.Int + EthAccount common.Address + Name string + PubKey crypto.PubKey + RemainingEpoch uint64 + func (gv *GenesisValidator) UnmarshalJSON(input []byte) error + func (gv GenesisValidator) MarshalJSON() ([]byte, error) + type GenesisValidatorWrite struct + Amount *big.Int + EthAccount string + Name string + PubKey crypto.PubKey + RemainingEpoch uint64 + func (gv *GenesisValidatorWrite) UnmarshalJSON(input []byte) error + func (gv GenesisValidatorWrite) MarshalJSON() ([]byte, error) + type IntermediateBlockResult struct + Block *types.Block + Ops *types.PendingOps + Receipts types.Receipts + State *state.StateDB + type NCBlock struct + Block *types.Block + IntermediateResult *IntermediateBlockResult + NTCExtra *NeatConExtra + TX3ProofData []*types.TX3ProofData + func (b *NCBlock) FillSeenCommitHash() + func (b *NCBlock) FromBytes(reader io.Reader) (*NCBlock, error) + func (b *NCBlock) Hash() []byte + func (b *NCBlock) HashesTo(hash []byte) bool + func (b *NCBlock) MakePartSet(partSize int) *PartSet + func (b *NCBlock) String() string + func (b *NCBlock) StringIndented(indent string) string + func (b *NCBlock) StringShort() string + func (b *NCBlock) ToBytes() []byte + func (b *NCBlock) ValidateBasic(ncExtra *NeatConExtra) error + type NeatConExtra struct + ChainID string + EpochBytes []byte + EpochNumber uint64 + Height uint64 + NeedToBroadcast bool + NeedToSave bool + SeenCommit *Commit + SeenCommitHash []byte + Time time.Time + ValidatorsHash []byte + func DecodeExtraData(extra string) (ncExtra *NeatConExtra, err error) + func ExtractNeatConExtra(h *neatTypes.Header) (*NeatConExtra, error) + func (te *NeatConExtra) Copy() *NeatConExtra + func (te *NeatConExtra) Hash() []byte + func (te *NeatConExtra) String() string + type NeatConExtraApi struct + ChainID string + EpochBytes []byte + EpochNumber hexutil.Uint64 + Height hexutil.Uint64 + NeedToBroadcast bool + NeedToSave bool + SeenCommit *CommitApi + SeenCommitHash string + Time time.Time + ValidatorsHash string + type OneEpochDoc struct + EndBlock uint64 + Number uint64 + RewardPerBlock *big.Int + StartBlock uint64 + Status int + Validators []GenesisValidator + func (ep *OneEpochDoc) UnmarshalJSON(input []byte) error + func (ep OneEpochDoc) MarshalJSON() ([]byte, error) + type OneEpochDocWrite struct + EndBlock uint64 + Number uint64 + RewardPerBlock *big.Int + StartBlock uint64 + Status int + Validators []GenesisValidatorWrite + func (ep *OneEpochDocWrite) UnmarshalJSON(input []byte) error + func (ep OneEpochDocWrite) MarshalJSON() ([]byte, error) + type Part struct + Bytes []byte + Index int + Proof merkle.SimpleProof + func (part *Part) Hash() []byte + func (part *Part) String() string + func (part *Part) StringIndented(indent string) string + type PartSet struct + func NewPartSetFromData(data []byte, partSize int) *PartSet + func NewPartSetFromHeader(header PartSetHeader) *PartSet + func (ps *PartSet) AddPart(part *Part, verify bool) (bool, error) + func (ps *PartSet) BitArray() *BitArray + func (ps *PartSet) Count() int + func (ps *PartSet) GetPart(index int) *Part + func (ps *PartSet) GetReader() io.Reader + func (ps *PartSet) HasHeader(header PartSetHeader) bool + func (ps *PartSet) Hash() []byte + func (ps *PartSet) HashesTo(hash []byte) bool + func (ps *PartSet) Header() PartSetHeader + func (ps *PartSet) IsComplete() bool + func (ps *PartSet) StringShort() string + func (ps *PartSet) Total() int + type PartSetHeader struct + Hash []byte + Total uint64 + func (psh PartSetHeader) Equals(other PartSetHeader) bool + func (psh PartSetHeader) IsZero() bool + func (psh PartSetHeader) String() string + func (psh PartSetHeader) WriteSignBytes(w io.Writer, n *int, err *error) + type PartSetHeaderApi struct + Hash string + Total hexutil.Uint64 + type PartSetReader struct + func NewPartSetReader(parts []*Part) *PartSetReader + func (psr *PartSetReader) Read(p []byte) (n int, err error) + type PrivV struct + Address string + PrivKey crypto.PrivKey + PubKey crypto.PubKey + type PrivValidator struct + Address common.Address + PrivKey crypto.PrivKey + PubKey crypto.PubKey + func GenPrivValidatorKey(address common.Address) *PrivValidator + func LoadPrivValidator(filePath string) *PrivValidator + func (pv *PrivValidator) GetAddress() []byte + func (pv *PrivValidator) GetPubKey() crypto.PubKey + func (pv *PrivValidator) Save() + func (pv *PrivValidator) SetFile(filePath string) + func (pv *PrivValidator) SignProposal(chainID string, proposal *Proposal) error + func (pv *PrivValidator) SignVote(chainID string, vote *Vote) error + func (pv *PrivValidator) String() string + type PrivValidatorsByAddress []*PrivValidator + func (pvs PrivValidatorsByAddress) Len() int + func (pvs PrivValidatorsByAddress) Less(i, j int) bool + func (pvs PrivValidatorsByAddress) Swap(i, j int) + type Proposal struct + BlockPartsHeader PartSetHeader + Hash []byte + Height uint64 + NodeID string + POLBlockID BlockID + POLRound int + ProposerNetAddr string + ProposerPeerKey string + Round int + Signature crypto.Signature + func NewProposal(height uint64, round int, hash []byte, blockPartsHeader PartSetHeader, ...) *Proposal + func (p *Proposal) BlockHash() []byte + func (p *Proposal) BlockHeaderHash() []byte + func (p *Proposal) String() string + func (p *Proposal) WriteSignBytes(chainID string, w io.Writer, n *int, err *error) + type RefundValidatorAmount struct + Address common.Address + Amount *big.Int + Voteout bool + type RewardSchemeDoc struct + EpochNumberPerYear uint64 + RewardFirstYear *big.Int + TotalReward *big.Int + TotalYear uint64 + func (rs *RewardSchemeDoc) UnmarshalJSON(input []byte) error + func (rs RewardSchemeDoc) MarshalJSON() ([]byte, error) + type SignAggr struct + BitArray *BitArray + BlockID BlockID + ChainID string + Height uint64 + Maj23 BlockID + NumValidators int + Round int + SignBytes []byte + SignatureAggr crypto.BLSSignature + Sum int64 + Type byte + func MakeSignAggr(height uint64, round int, mtype byte, numValidators int, blockID BlockID, ...) *SignAggr + func (sa *SignAggr) HasAll(valSet *ValidatorSet) bool + func (sa *SignAggr) HasTwoThirdsMajority(valSet *ValidatorSet) bool + func (sa *SignAggr) IsCommit() bool + func (sa *SignAggr) MakeCommit() *Commit + func (sa *SignAggr) SetBitArray(newBitArray *BitArray) + func (sa *SignAggr) SetMaj23(blockID BlockID) + func (sa *SignAggr) SignAggr() crypto.BLSSignature + func (sa *SignAggr) SignAggrVerify(msg []byte, valSet *ValidatorSet) bool + func (sa *SignAggr) SignRound() int + func (sa *SignAggr) Size() int + func (sa *SignAggr) TwoThirdsMajority() (blockID BlockID, ok bool) + func (sa *SignAggr) WriteSignBytes(chainID string, w io.Writer, n *int, err *error) + func (va *SignAggr) String() string + func (va *SignAggr) StringIndented(indent string) string + func (va *SignAggr) StringShort() string + type Signable interface + WriteSignBytes func(chainID string, w io.Writer, n *int, err *error) + type Signer interface + Sign func(msg []byte) crypto.Signature + type SwitchEpochOp struct + ChainId string + NewValidators *ValidatorSet + func (op *SwitchEpochOp) Conflict(op1 neatTypes.PendingOp) bool + func (op *SwitchEpochOp) String() string + type TMEventData interface + AssertIsTMEventData func() + type Tx []byte + func (tx Tx) Hash() []byte + type TxProof struct + Data Tx + Index int + Proof merkle.SimpleProof + RootHash []byte + Total int + func (tp TxProof) LeafHash() []byte + func (tp TxProof) Validate(dataHash []byte) error + type Txs []Tx + func (txs Txs) Hash() []byte + func (txs Txs) Index(tx Tx) int + func (txs Txs) IndexByHash(hash []byte) int + func (txs Txs) Proof(i int) TxProof + type Validator struct + Address []byte + PubKey crypto.PubKey + RemainingEpoch uint64 + VotingPower *big.Int + func NewValidator(address []byte, pubKey crypto.PubKey, votingPower *big.Int) *Validator + func (v *Validator) Copy() *Validator + func (v *Validator) Equals(other *Validator) bool + func (v *Validator) Hash() []byte + func (v *Validator) String() string + type ValidatorSet struct + Validators []*Validator + func NewValidatorSet(vals []*Validator) *ValidatorSet + func (valSet *ValidatorSet) Add(val *Validator) (added bool) + func (valSet *ValidatorSet) AggrPubKey(bitMap *cmn.BitArray) crypto.PubKey + func (valSet *ValidatorSet) Copy() *ValidatorSet + func (valSet *ValidatorSet) Equals(other *ValidatorSet) bool + func (valSet *ValidatorSet) GetAggrPubKeyAndAddress(bitMap *cmn.BitArray) (*ConsensusAggr, error) + func (valSet *ValidatorSet) GetByAddress(address []byte) (index int, val *Validator) + func (valSet *ValidatorSet) GetByIndex(index int) (address []byte, val *Validator) + func (valSet *ValidatorSet) HasAddress(address []byte) bool + func (valSet *ValidatorSet) Hash() []byte + func (valSet *ValidatorSet) Iterate(fn func(index int, val *Validator) bool) + func (valSet *ValidatorSet) Remove(address []byte) (val *Validator, removed bool) + func (valSet *ValidatorSet) Size() int + func (valSet *ValidatorSet) String() string + func (valSet *ValidatorSet) StringIndented(indent string) string + func (valSet *ValidatorSet) TalliedVotingPower(bitMap *cmn.BitArray) (*big.Int, *big.Int, *big.Int, error) + func (valSet *ValidatorSet) TotalVotingPower() *big.Int + func (valSet *ValidatorSet) Update(val *Validator) (updated bool) + func (valSet *ValidatorSet) VerifyCommit(chainID string, height uint64, commit *Commit) error + func (valSet *ValidatorSet) VerifyCommitAny(chainID string, blockID BlockID, height int, commit *Commit) error + type ValidatorStatus struct + IsForbidden bool + type ValidatorsByAddress []*Validator + func (vs ValidatorsByAddress) Len() int + func (vs ValidatorsByAddress) Less(i, j int) bool + func (vs ValidatorsByAddress) Swap(i, j int) + type Vote struct + BlockID BlockID + Height uint64 + Round uint64 + SignBytes []byte + Signature crypto.Signature + Type byte + ValidatorAddress []byte + ValidatorIndex uint64 + func (vote *Vote) Copy() *Vote + func (vote *Vote) DecodeRLP(s *rlp.Stream) error + func (vote *Vote) EncodeRLP(w io.Writer) error + func (vote *Vote) String() string + func (vote *Vote) WriteSignBytes(chainID string, w io.Writer, n *int, err *error) + type VoteSet struct + func NewVoteSet(chainID string, height uint64, round int, type_ byte, valSet *ValidatorSet) *VoteSet + func (voteSet *VoteSet) AddVote(vote *Vote) (added bool, err error) + func (voteSet *VoteSet) BitArray() *BitArray + func (voteSet *VoteSet) BitArrayByBlockID(blockID BlockID) *BitArray + func (voteSet *VoteSet) ChainID() string + func (voteSet *VoteSet) GetByAddress(address []byte) *Vote + func (voteSet *VoteSet) GetByIndex(valIndex int) *Vote + func (voteSet *VoteSet) HasAll() bool + func (voteSet *VoteSet) HasTwoThirdsMajority() bool + func (voteSet *VoteSet) Height() uint64 + func (voteSet *VoteSet) IsCommit() bool + func (voteSet *VoteSet) Round() int + func (voteSet *VoteSet) SetPeerMaj23(peerID string, blockID BlockID) + func (voteSet *VoteSet) Size() int + func (voteSet *VoteSet) String() string + func (voteSet *VoteSet) StringIndented(indent string) string + func (voteSet *VoteSet) StringShort() string + func (voteSet *VoteSet) TwoThirdsMajority() (blockID BlockID, ok bool) + func (voteSet *VoteSet) Type() byte + func (voteSet *VoteSet) Votes() []*Vote + type VoteSetReader interface + BitArray func() *BitArray + GetByIndex func(int) *Vote + Height func() uint64 + IsCommit func() bool + Round func() int + Size func() int + Type func() byte v1.3.0 Jul 31, 2021