Documentation ¶
Overview ¶
Package etrue implements the Truechain protocol.
Index ¶
- Constants
- Variables
- func CreateConsensusEngine(ctx *node.ServiceContext, config *ethash.Config, ...) consensus.Engine
- func CreateDB(ctx *node.ServiceContext, config *Config, name string) (etruedb.Database, error)
- func NewBloomIndexer(db etruedb.Database, size, confirms uint64) *core.ChainIndexer
- type AgentNetworkProxy
- type AgentWork
- type Backend
- type BadBlockArgs
- type BlockBodiesRawData
- type BlockHeadersData
- type BloomIndexer
- type Config
- type LesServer
- type NodeInfo
- type PbftAgent
- func (agent *PbftAgent) AcquireCommitteeAuth(fastHeight *big.Int) bool
- func (agent *PbftAgent) AddRemoteNodeInfo(cryNodeInfo *types.EncryptNodeMessage) error
- func (agent *PbftAgent) BroadcastConsensus(fb *types.Block) error
- func (agent *PbftAgent) ChangeCommitteeLeader(height *big.Int) bool
- func (agent *PbftAgent) CommitteeNumber() uint64
- func (agent *PbftAgent) FetchFastBlock(committeeID *big.Int, infos []*types.CommitteeMember) (*types.Block, error)
- func (agent *PbftAgent) GenerateSign(fb *types.Block) (*types.PbftSign, error)
- func (agent *PbftAgent) GenerateSignWithVote(fb *types.Block, vote uint32, result bool) (*types.PbftSign, error)
- func (agent *PbftAgent) GetAlternativeCommittee() []string
- func (agent *PbftAgent) GetCommitteeNumber(blockHeight *big.Int) int32
- func (agent *PbftAgent) GetCommitteeStatus() map[string]interface{}
- func (agent *PbftAgent) GetCurrentCommittee() []string
- func (agent *PbftAgent) GetCurrentHeight() *big.Int
- func (agent *PbftAgent) GetFastLastProposer() common.Address
- func (agent *PbftAgent) GetNodeInfoByHash(nodeInfoHash common.Hash) (*types.EncryptNodeMessage, bool)
- func (agent *PbftAgent) GetPrivateKey() *ecdsa.PrivateKey
- func (agent *PbftAgent) GetSeedMember() []*types.CommitteeMember
- func (agent *PbftAgent) GetSnailRewardContent(rewardSnailHegiht uint64) *types.SnailRewardContenet
- func (agent *PbftAgent) IsCommitteeMember() bool
- func (agent *PbftAgent) IsLeader() bool
- func (agent *PbftAgent) IsUsedOrUnusedMember(committeeInfo *types.CommitteeInfo, publickey []byte) bool
- func (agent *PbftAgent) MarkBroadcastNodeTag(cryptoNodeInfo *types.EncryptNodeMessage)
- func (agent *PbftAgent) MarkNodeInfo(encryptNode *types.EncryptNodeMessage, nodeTagHash common.Hash)
- func (agent *PbftAgent) MarkNodeTag(nodeTag common.Hash, timestamp *big.Int)
- func (agent *PbftAgent) Start()
- func (agent *PbftAgent) SubscribeNewPbftSignEvent(ch chan<- types.PbftSignEvent) event.Subscription
- func (agent *PbftAgent) SubscribeNodeInfoEvent(ch chan<- types.NodeInfoEvent) event.Subscription
- func (agent *PbftAgent) VerifyCommitteeSign(sign *types.PbftSign) bool
- func (agent *PbftAgent) VerifyFastBlock(fb *types.Block, result bool) (*types.PbftSign, error)
- type PeerInfo
- type PrivateAdminAPI
- type PrivateDebugAPI
- func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error)
- func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
- func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)
- func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (api *PrivateDebugAPI) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex int, ...) (StorageRangeResult, error)
- func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob []byte, config *TraceConfig) ([]*txTraceResult, error)
- func (api *PrivateDebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
- func (api *PrivateDebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error)
- func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error)
- func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error)
- func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)
- type PrivateMinerAPI
- func (api *PrivateMinerAPI) GetHashRate() uint64
- func (api *PrivateMinerAPI) SetElection(toElect bool, pubkey []byte) (bool, error)
- func (api *PrivateMinerAPI) SetEtherbase(etherbase common.Address) bool
- func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error)
- func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool
- func (api *PrivateMinerAPI) Start(threads *int) error
- func (api *PrivateMinerAPI) StartFruit(threads *int) error
- func (api *PrivateMinerAPI) Stop() bool
- type ProtocolManager
- func (pm *ProtocolManager) BroadcastFastBlock(block *types.Block, propagate bool)
- func (pm *ProtocolManager) BroadcastFruits(fruits types.Fruits)
- func (pm *ProtocolManager) BroadcastPbNodeInfo(nodeInfo *types.EncryptNodeMessage)
- func (pm *ProtocolManager) BroadcastPbSign(pbSigns []*types.PbftSign)
- func (pm *ProtocolManager) BroadcastSnailBlock(snailBlock *types.SnailBlock, propagate bool)
- func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions)
- func (pm *ProtocolManager) NodeInfo() *NodeInfo
- func (pm *ProtocolManager) Start(maxPeers int)
- func (pm *ProtocolManager) Start2(maxPeers int)
- func (pm *ProtocolManager) Stop()
- type PublicDebugAPI
- type PublicMinerAPI
- func (api *PublicMinerAPI) GetDataset() ([10240]string, error)
- func (api *PublicMinerAPI) GetDatasetBySeedhash(seedhash string) ([10240]string, error)
- func (api *PublicMinerAPI) GetWork() ([4]string, error)
- func (api *PublicMinerAPI) Mining() bool
- func (api *PublicMinerAPI) SubmitHashrate(hashrate rpc.HexNumber, id common.Hash) bool
- func (api *PublicMinerAPI) SubmitWork(nonce types.BlockNonce, solution, digest common.Hash) bool
- type PublicTruechainAPI
- func (api *PublicTruechainAPI) ChainId() hexutil.Uint64
- func (api *PublicTruechainAPI) Coinbase() (common.Address, error)
- func (api *PublicTruechainAPI) CommitteeBase() common.Address
- func (api *PublicTruechainAPI) CommitteeNumber() uint64
- func (api *PublicTruechainAPI) Etherbase() (common.Address, error)
- func (api *PublicTruechainAPI) GetCurrentState() map[string]interface{}
- func (api *PublicTruechainAPI) Hashrate() hexutil.Uint64
- func (api *PublicTruechainAPI) IsCommitteeMember() bool
- func (api *PublicTruechainAPI) Pubkey() string
- type SnailPool
- type StorageRangeResult
- type TraceConfig
- type TrueAPIBackend
- func (b *TrueAPIBackend) AccountManager() *accounts.Manager
- func (b *TrueAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)
- func (b *TrueAPIBackend) BloomStatus() (uint64, uint64)
- func (b *TrueAPIBackend) ChainConfig() *params.ChainConfig
- func (b *TrueAPIBackend) ChainDb() etruedb.Database
- func (b *TrueAPIBackend) CurrentBlock() *types.Block
- func (b *TrueAPIBackend) CurrentSnailBlock() *types.SnailBlock
- func (b *TrueAPIBackend) Downloader() *downloader.Downloader
- func (b *TrueAPIBackend) EventMux() *event.TypeMux
- func (b *TrueAPIBackend) GetBalanceChangeBySnailNumber(snailNumber rpc.BlockNumber) *types.BalanceChangeContent
- func (b *TrueAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (b *TrueAPIBackend) GetChainRewardContent(blockNr rpc.BlockNumber) *types.ChainReward
- func (b *TrueAPIBackend) GetCommittee(number rpc.BlockNumber) (map[string]interface{}, error)
- func (b *TrueAPIBackend) GetCurrentCommitteeNumber() *big.Int
- func (b *TrueAPIBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, ...) (*vm.EVM, func() error, error)
- func (b *TrueAPIBackend) GetFruit(ctx context.Context, fastblockHash common.Hash) (*types.SnailBlock, error)
- func (b *TrueAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)
- func (b *TrueAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)
- func (b *TrueAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction
- func (b *TrueAPIBackend) GetPoolTransactions() (types.Transactions, error)
- func (b *TrueAPIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)
- func (b *TrueAPIBackend) GetReward(number int64) *types.BlockReward
- func (b *TrueAPIBackend) GetSnailBlock(ctx context.Context, hash common.Hash) (*types.SnailBlock, error)
- func (b *TrueAPIBackend) GetSnailRewardContent(snailNumber rpc.BlockNumber) *types.SnailRewardContenet
- func (b *TrueAPIBackend) GetStateChangeByFastNumber(fastNumber rpc.BlockNumber) *types.BlockBalance
- func (b *TrueAPIBackend) GetTd(blockHash common.Hash) *big.Int
- func (b *TrueAPIBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (b *TrueAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
- func (b *TrueAPIBackend) ProtocolVersion() int
- func (b *TrueAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
- func (b *TrueAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
- func (b *TrueAPIBackend) SetHead(number uint64)
- func (b *TrueAPIBackend) SetSnailHead(number uint64)
- func (b *TrueAPIBackend) SnailBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.SnailBlock, error)
- func (b *TrueAPIBackend) SnailHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.SnailHeader, error)
- func (b *TrueAPIBackend) SnailPoolContent() []*types.SnailBlock
- func (b *TrueAPIBackend) SnailPoolInspect() []*types.SnailBlock
- func (b *TrueAPIBackend) SnailPoolStats() (pending int, unVerified int)
- func (b *TrueAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
- func (b *TrueAPIBackend) Stats() (pending int, queued int)
- func (b *TrueAPIBackend) SubscribeChainEvent(ch chan<- types.FastChainEvent) event.Subscription
- func (b *TrueAPIBackend) SubscribeChainHeadEvent(ch chan<- types.FastChainHeadEvent) event.Subscription
- func (b *TrueAPIBackend) SubscribeChainSideEvent(ch chan<- types.FastChainSideEvent) event.Subscription
- func (b *TrueAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
- func (b *TrueAPIBackend) SubscribeNewTxsEvent(ch chan<- types.NewTxsEvent) event.Subscription
- func (b *TrueAPIBackend) SubscribeRemovedLogsEvent(ch chan<- types.RemovedLogsEvent) event.Subscription
- func (b *TrueAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error)
- func (b *TrueAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
- type Truechain
- func (s *Truechain) APIs() []rpc.API
- func (s *Truechain) AccountManager() *accounts.Manager
- func (s *Truechain) AddLesServer(ls LesServer)
- func (s *Truechain) ArchiveMode() bool
- func (s *Truechain) BlockChain() *core.BlockChain
- func (s *Truechain) ChainDb() etruedb.Database
- func (s *Truechain) Config() *Config
- func (s *Truechain) Downloader() *downloader.Downloader
- func (s *Truechain) Engine() consensus.Engine
- func (s *Truechain) EthVersion() int
- func (s *Truechain) Etherbase() (eb common.Address, err error)
- func (s *Truechain) EventMux() *event.TypeMux
- func (s *Truechain) IsListening() bool
- func (s *Truechain) IsMining() bool
- func (s *Truechain) Miner() *miner.Miner
- func (s *Truechain) NetVersion() uint64
- func (s *Truechain) PbftAgent() *PbftAgent
- func (s *Truechain) Protocols() []p2p.Protocol
- func (s *Truechain) ResetWithFastGenesisBlock(gb *types.Block)
- func (s *Truechain) ResetWithGenesisBlock(gb *types.Block)
- func (s *Truechain) SetEtherbase(etherbase common.Address)
- func (s *Truechain) SnailBlockChain() *chain.SnailBlockChain
- func (s *Truechain) SnailPool() *chain.SnailPool
- func (s *Truechain) Start(srvr *p2p.Server) error
- func (s *Truechain) StartMining(local bool) error
- func (s *Truechain) Stop() error
- func (s *Truechain) StopMining()
- func (s *Truechain) Synced() bool
- func (s *Truechain) TxPool() *core.TxPool
- type ULCConfig
Constants ¶
const ( // Protocol messages belonging to etrue/63 StatusMsg = 0x00 NewFastBlockHashesMsg = 0x01 TxMsg = 0x02 GetFastBlockHeadersMsg = 0x03 FastBlockHeadersMsg = 0x04 GetFastBlockBodiesMsg = 0x05 FastBlockBodiesMsg = 0x06 NewFastBlockMsg = 0x07 TbftNodeInfoMsg = 0x08 //snail sync NewFruitMsg = 0x09 GetSnailBlockHeadersMsg = 0x0a SnailBlockHeadersMsg = 0x0b GetSnailBlockBodiesMsg = 0x0c SnailBlockBodiesMsg = 0x0d NewSnailBlockMsg = 0x0e GetNodeDataMsg = 0x0f NodeDataMsg = 0x10 GetReceiptsMsg = 0x11 ReceiptsMsg = 0x12 NewSnailBlockHashesMsg = 0x13 TbftNodeInfoHashMsg = 0x15 GetTbftNodeInfoMsg = 0x16 )
etrue protocol message codes
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNetworkIdMismatch ErrGenesisBlockMismatch ErrNoStatusMsg ErrExtraStatusMsg ErrSuspendedPeer )
const DefaultULCMinTrustedFraction = 75
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
Variables ¶
var DefaultConfig = Config{ SyncMode: downloader.FullSync, MinervaHash: minerva.Config{ CacheDir: "minerva", CachesInMem: 2, CachesOnDisk: 3, DatasetsInMem: 1, DatasetsOnDisk: 2, }, NetworkId: 19330, LightPeers: 100, DatabaseCache: 768, TrieCache: 256, TrieTimeout: 60 * time.Minute, MinerGasFloor: 12000000, MinerGasCeil: 16000000, GasPrice: big.NewInt(1 * params.Babbage), TxPool: core.DefaultTxPoolConfig, SnailPool: snailchain.DefaultSnailPoolConfig, GPO: gasprice.Config{ Blocks: 20, Percentile: 60, }, MinerThreads: 2, Port: 30310, StandbyPort: 30311, }
DefaultConfig contains default settings for use on the Truechain main net.
var ProtocolLengths = []uint64{32, 20}
ProtocolLengths are the number of implemented message corresponding to different protocol versions.
var ProtocolName = "etrue"
ProtocolName is the official short name of the protocol used during capability negotiation.
var ProtocolVersions = []uint{etrue64, etrue63}
ProtocolVersions are the upported versions of the etrue protocol (first is primary).
Functions ¶
func CreateConsensusEngine ¶
func CreateConsensusEngine(ctx *node.ServiceContext, config *ethash.Config, chainConfig *params.ChainConfig, db etruedb.Database) consensus.Engine
CreateConsensusEngine creates the required type of consensus engine instance for an Truechain service
func NewBloomIndexer ¶
func NewBloomIndexer(db etruedb.Database, size, confirms uint64) *core.ChainIndexer
NewBloomIndexer returns a chain indexer that generates bloom bits data for the canonical chain for fast logs filtering.
Types ¶
type AgentNetworkProxy ¶
type AgentNetworkProxy interface { // SubscribeNewPbftSignEvent should return an event subscription of // PbftSignEvent and send events to the given channel. SubscribeNewPbftSignEvent(chan<- types.PbftSignEvent) event.Subscription // SubscribeNodeInfoEvent should return an event subscription of // NodeInfoEvent and send events to the given channel. SubscribeNodeInfoEvent(chan<- types.NodeInfoEvent) event.Subscription // AddRemoteNodeInfo should add the given NodeInfo to the pbft agent. AddRemoteNodeInfo(*types.EncryptNodeMessage) error //GetNodeInfoByHash get crypto nodeInfo by hash GetNodeInfoByHash(nodeInfoHash common.Hash) (*types.EncryptNodeMessage, bool) //GetPrivateKey get crypto privateKey GetPrivateKey() *ecdsa.PrivateKey }
type AgentWork ¶
type AgentWork struct { Block *types.Block // the new block // contains filtered or unexported fields }
AgentWork is the leader current environment and holds all of the current state information
type Backend ¶
type Backend interface { BlockChain() *core.BlockChain SnailBlockChain() *snailchain.SnailBlockChain TxPool() *core.TxPool Config() *Config Etherbase() (etherbase common.Address, err error) }
Backend wraps all methods required for pbft_agent
type BadBlockArgs ¶
type BadBlockArgs struct { Hash common.Hash `json:"hash"` Block map[string]interface{} `json:"block"` RLP string `json:"rlp"` }
BadBlockArgs represents the entries in the list returned when bad blocks are queried.
type BlockBodiesRawData ¶ added in v0.10.1
type BlockBodiesRawData struct { Bodies []rlp.RawValue Call uint32 // Distinguish fetcher and downloader }
BlockBodiesRawData represents a block header send.
type BlockHeadersData ¶ added in v0.10.1
type BlockHeadersData struct { Headers []*types.Header SnailHeaders []*types.SnailHeader Call uint32 // Distinguish fetcher and downloader }
BlockHeadersData represents a block header send.
type BloomIndexer ¶
type BloomIndexer struct {
// contains filtered or unexported fields
}
BloomIndexer implements a core.ChainIndexer, building up a rotated bloom bits index for the Truechain header bloom filters, permitting blazing fast filtering.
func (*BloomIndexer) Commit ¶
func (b *BloomIndexer) Commit() error
Commit implements core.ChainIndexerBackend, finalizing the bloom section and writing it out into the database.
type Config ¶
type Config struct { // The genesis block, which is inserted if the database is empty. // If nil, the Truechain main net block is used. Genesis *core.Genesis // Protocol options NetworkId uint64 // Network ID to use for selecting peers to connect to SyncMode downloader.SyncMode NoPruning bool DeletedState bool // Whitelist of required block number -> hash values to accept Whitelist map[uint64]common.Hash `toml:"-"` // Light client options LightServ int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests LightPeers int `toml:",omitempty"` // Maximum number of LES client peers EnableElection bool `toml:",omitempty"` // CommitteeKey is the ECDSA private key for committee member. // If this filed is empty, can't be a committee member. CommitteeKey []byte `toml:",omitempty"` PrivateKey *ecdsa.PrivateKey `toml:"-"` // Host is the host interface on which to start the pbft server. If this // field is empty, can't be a committee member. Host string `toml:",omitempty"` // Port is the TCP port number on which to start the pbft server. Port int `toml:",omitempty"` // StandByPort is the TCP port number on which to start the pbft server. StandbyPort int `toml:",omitempty"` // Ultra Light client options ULC *ULCConfig `toml:",omitempty"` // Database options SkipBcVersionCheck bool `toml:"-"` DatabaseHandles int `toml:"-"` DatabaseCache int TrieCache int TrieTimeout time.Duration // Mining-related options Etherbase common.Address `toml:",omitempty"` MinerThreads int `toml:",omitempty"` ExtraData []byte `toml:",omitempty"` MinerGasFloor uint64 MinerGasCeil uint64 GasPrice *big.Int // MinervaHash options MinervaHash minerva.Config // Transaction pool options TxPool core.TxPoolConfig //fruit pool options SnailPool snailchain.SnailPoolConfig // Gas Price Oracle options GPO gasprice.Config // Enables tracking of SHA3 preimages in the VM EnablePreimageRecording bool // Miscellaneous options DocRoot string `toml:"-"` // true indicate singlenode start NodeType bool `toml:",omitempty"` //true indicate only mine fruit MineFruit bool `toml:",omitempty"` //true indicate mine snailblock and fruit Mine bool `toml:",omitempty"` //true indicate only remote mine RemoteMine bool `toml:",omitempty"` }
func (*Config) GetNodeType ¶
func (Config) MarshalTOML ¶
func (*Config) UnmarshalTOML ¶
type NodeInfo ¶
type NodeInfo struct { Network uint64 `json:"network"` // Truechain network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4) Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block Config *params.ChainConfig `json:"config"` // Chain configuration for the fork rules Head common.Hash `json:"head"` // SHA3 hash of the host's best owned block Difficulty *big.Int `json:"snailTd"` // Total difficulty of the host's blockchain SnailGenesis common.Hash `json:"snailGenesis"` // SHA3 hash of the host's genesis block SnailConfig *params.ChainConfig `json:"snailConfig"` // Chain configuration for the fork rules SnailHead common.Hash `json:"snailHead"` // SHA3 hash of the host's best owned block }
NodeInfo represents a short summary of the Truechain sub-protocol metadata known about the host peer.
type PbftAgent ¶
type PbftAgent struct {
// contains filtered or unexported fields
}
PbftAgent receive events from election and communicate with pbftServer
func NewPbftAgent ¶
func NewPbftAgent(etrue Backend, config *params.ChainConfig, engine consensus.Engine, election *elect.Election, gasFloor, gasCeil uint64) *PbftAgent
NewPbftAgent creates a new pbftAgent ,receive events from election and communicate with pbftServer
func (*PbftAgent) AcquireCommitteeAuth ¶
AcquireCommitteeAuth determine whether the node pubKey is in the specified committee
func (*PbftAgent) AddRemoteNodeInfo ¶
func (agent *PbftAgent) AddRemoteNodeInfo(cryNodeInfo *types.EncryptNodeMessage) error
AddRemoteNodeInfo send cryNodeInfo of committeeNode to network,and recieved by other committeenode
func (*PbftAgent) BroadcastConsensus ¶
BroadcastConsensus when More than 2/3 signs with agree,
committee Member Reach a consensus and insert the fastBlock into fastBlockChain
func (*PbftAgent) ChangeCommitteeLeader ¶
ChangeCommitteeLeader trigger view change.
func (*PbftAgent) CommitteeNumber ¶
CommitteeNumber return current committee number
func (*PbftAgent) FetchFastBlock ¶
func (agent *PbftAgent) FetchFastBlock(committeeID *big.Int, infos []*types.CommitteeMember) (*types.Block, error)
FetchFastBlock generate fastBlock as leader
func (*PbftAgent) GenerateSign ¶
GenerateSign generate sign with default agree from committeeMember in fastBlock
func (*PbftAgent) GenerateSignWithVote ¶
func (agent *PbftAgent) GenerateSignWithVote(fb *types.Block, vote uint32, result bool) (*types.PbftSign, error)
GenerateSignWithVote generate sign from committeeMember in fastBlock
func (*PbftAgent) GetAlternativeCommittee ¶ added in v1.1.2
GetAlternativeCommittee return received back committee member's pubkey information
func (*PbftAgent) GetCommitteeNumber ¶
GetCommitteeNumber get Committees number from blockHeight
func (*PbftAgent) GetCommitteeStatus ¶
GetCommitteeStatus return current committee infomation
func (*PbftAgent) GetCurrentCommittee ¶ added in v1.1.2
GetCurrentCommittee return committee member's pubkey information
func (*PbftAgent) GetCurrentHeight ¶
GetCurrentHeight return current fastBlock number
func (*PbftAgent) GetFastLastProposer ¶
GetFastLastProposer get last proposer
func (*PbftAgent) GetNodeInfoByHash ¶ added in v1.1.1
func (agent *PbftAgent) GetNodeInfoByHash(nodeInfoHash common.Hash) (*types.EncryptNodeMessage, bool)
GetNodeInfoByHash get cryptoNodeInfo by hash
func (*PbftAgent) GetPrivateKey ¶
func (agent *PbftAgent) GetPrivateKey() *ecdsa.PrivateKey
GetAlternativeCommittee return received back committee member's pubkey information
func (*PbftAgent) GetSeedMember ¶
func (agent *PbftAgent) GetSeedMember() []*types.CommitteeMember
GetSeedMember get seed member
func (*PbftAgent) GetSnailRewardContent ¶ added in v1.0.2
func (agent *PbftAgent) GetSnailRewardContent(rewardSnailHegiht uint64) *types.SnailRewardContenet
func (*PbftAgent) IsCommitteeMember ¶
IsCurrentCommitteeMember get whether self is committee member or not
func (*PbftAgent) IsUsedOrUnusedMember ¶
func (agent *PbftAgent) IsUsedOrUnusedMember(committeeInfo *types.CommitteeInfo, publickey []byte) bool
IsUsedOrUnusedMember whether publickey in committee member
func (*PbftAgent) MarkBroadcastNodeTag ¶ added in v1.1.1
func (agent *PbftAgent) MarkBroadcastNodeTag(cryptoNodeInfo *types.EncryptNodeMessage)
MarkNodeTag Mark received nodeTag,avoid old node information
func (*PbftAgent) MarkNodeInfo ¶
func (agent *PbftAgent) MarkNodeInfo(encryptNode *types.EncryptNodeMessage, nodeTagHash common.Hash)
MarkNodeInfo Mark received NodeInfo
func (*PbftAgent) MarkNodeTag ¶
MarkNodeTag Mark received nodeTag,avoid old node information
func (*PbftAgent) Start ¶
func (agent *PbftAgent) Start()
Start means receive events from election and send pbftNode infomation
func (*PbftAgent) SubscribeNewPbftSignEvent ¶
func (agent *PbftAgent) SubscribeNewPbftSignEvent(ch chan<- types.PbftSignEvent) event.Subscription
SubscribeNewPbftSignEvent registers a subscription of PbftSignEvent and starts sending event to the given channel.
func (*PbftAgent) SubscribeNodeInfoEvent ¶
func (agent *PbftAgent) SubscribeNodeInfoEvent(ch chan<- types.NodeInfoEvent) event.Subscription
SubscribeNodeInfoEvent registers a subscription of NodeInfoEvent.
func (*PbftAgent) VerifyCommitteeSign ¶
VerifyCommitteeSign verify sign of node is in committee
type PeerInfo ¶
type PeerInfo struct { Version int `json:"version"` // Truechain protocol version negotiated Difficulty *big.Int `json:"difficulty"` // Total difficulty of the peer's blockchain Head string `json:"head"` // SHA3 hash of the peer's best owned block }
PeerInfo represents a short summary of the Truechain sub-protocol metadata known about a connected peer.
type PrivateAdminAPI ¶
type PrivateAdminAPI struct {
// contains filtered or unexported fields
}
PrivateAdminAPI is the collection of Truechain full node-related APIs exposed over the private admin endpoint.
func NewPrivateAdminAPI ¶
func NewPrivateAdminAPI(etrue *Truechain) *PrivateAdminAPI
NewPrivateAdminAPI creates a new API definition for the full node private admin methods of the Truechain service.
func (*PrivateAdminAPI) ExportChain ¶
func (api *PrivateAdminAPI) ExportChain(file string) (bool, error)
ExportChain exports the current blockchain into a local file.
func (*PrivateAdminAPI) ImportChain ¶
func (api *PrivateAdminAPI) ImportChain(file string) (bool, error)
ImportChain imports a blockchain from a local file.
type PrivateDebugAPI ¶
type PrivateDebugAPI struct {
// contains filtered or unexported fields
}
PrivateDebugAPI is the collection of Truechain full node APIs exposed over the private debugging endpoint.
func NewPrivateDebugAPI ¶
func NewPrivateDebugAPI(config *params.ChainConfig, etrue *Truechain) *PrivateDebugAPI
NewPrivateDebugAPI creates a new API definition for the full node-related private debug methods of the Truechain service.
func (*PrivateDebugAPI) GetBadBlocks ¶
func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error)
GetBadBlocks returns a list of the last 'bad blocks' that the client has seen on the network and returns them as a JSON list of block-hashes
func (*PrivateDebugAPI) GetModifiedAccountsByHash ¶
func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
GetModifiedAccountsByHash returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.
With one parameter, returns the list of accounts modified in the specified block.
func (*PrivateDebugAPI) GetModifiedAccountsByNumber ¶
func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)
GetModifiedAccountsByNumber returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.
With one parameter, returns the list of accounts modified in the specified block.
func (*PrivateDebugAPI) Preimage ¶
Preimage is a debug API function that returns the preimage for a sha3 hash, if known.
func (*PrivateDebugAPI) StorageRangeAt ¶
func (api *PrivateDebugAPI) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error)
StorageRangeAt returns the storage at the given block height and transaction index.
func (*PrivateDebugAPI) TraceBlock ¶
func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob []byte, config *TraceConfig) ([]*txTraceResult, error)
TraceBlock returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PrivateDebugAPI) TraceBlockByHash ¶
func (api *PrivateDebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
TraceBlockByHash returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PrivateDebugAPI) TraceBlockByNumber ¶
func (api *PrivateDebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error)
TraceBlockByNumber returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PrivateDebugAPI) TraceBlockFromFile ¶
func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error)
TraceBlockFromFile returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PrivateDebugAPI) TraceChain ¶
func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error)
TraceChain returns the structured logs created during the execution of EVM between two blocks (excluding start) and returns them as a JSON object.
func (*PrivateDebugAPI) TraceTransaction ¶
func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)
TraceTransaction returns the structured logs created during the execution of EVM and returns them as a JSON object.
type PrivateMinerAPI ¶
type PrivateMinerAPI struct {
// contains filtered or unexported fields
}
PrivateMinerAPI provides private RPC methods to control the miner. These methods can be abused by external users and must be considered insecure for use by untrusted users.
func NewPrivateMinerAPI ¶
func NewPrivateMinerAPI(e *Truechain) *PrivateMinerAPI
NewPrivateMinerAPI create a new RPC service which controls the miner of this node.
func (*PrivateMinerAPI) GetHashRate ¶
func (api *PrivateMinerAPI) GetHashRate() uint64
GetHashRate returns the current hashrate of the miner.
func (*PrivateMinerAPI) SetElection ¶
func (api *PrivateMinerAPI) SetElection(toElect bool, pubkey []byte) (bool, error)
SetElection sets the election .
func (*PrivateMinerAPI) SetEtherbase ¶
func (api *PrivateMinerAPI) SetEtherbase(etherbase common.Address) bool
SetEtherbase sets the etherbase of the miner
func (*PrivateMinerAPI) SetExtra ¶
func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error)
SetExtra sets the extra data string that is included when this miner mines a block.
func (*PrivateMinerAPI) SetGasPrice ¶
func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool
SetGasPrice sets the minimum accepted gas price for the miner.
func (*PrivateMinerAPI) Start ¶
func (api *PrivateMinerAPI) Start(threads *int) error
Start the miner with the given number of threads. If threads is nil the number of workers started is equal to the number of logical CPUs that are usable by this process. If mining is already running, this method adjust the number of threads allowed to use.
func (*PrivateMinerAPI) StartFruit ¶
func (api *PrivateMinerAPI) StartFruit(threads *int) error
type ProtocolManager ¶
type ProtocolManager struct { SnailPool SnailPool SubProtocols []p2p.Protocol // contains filtered or unexported fields }
func NewProtocolManager ¶
func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, networkID uint64, mux *event.TypeMux, txpool txPool, SnailPool SnailPool, engine consensus.Engine, blockchain *core.BlockChain, snailchain *snailchain.SnailBlockChain, chaindb etruedb.Database, agent *PbftAgent) (*ProtocolManager, error)
NewProtocolManager returns a new Truechain sub protocol manager. The Truechain sub protocol manages peers capable with the Truechain network.
func (*ProtocolManager) BroadcastFastBlock ¶
func (pm *ProtocolManager) BroadcastFastBlock(block *types.Block, propagate bool)
BroadcastFastBlock will either propagate a block to a subset of it's peers, or will only announce it's availability (depending what's requested).
func (*ProtocolManager) BroadcastFruits ¶
func (pm *ProtocolManager) BroadcastFruits(fruits types.Fruits)
BroadcastFruits will propagate a batch of fruits to all peers which are not known to already have the given fruit.
func (*ProtocolManager) BroadcastPbNodeInfo ¶
func (pm *ProtocolManager) BroadcastPbNodeInfo(nodeInfo *types.EncryptNodeMessage)
BroadcastPbNodeInfo will propagate a batch of EncryptNodeMessage to all peers which are not known to already have the given CryNodeInfo.
func (*ProtocolManager) BroadcastPbSign ¶
func (pm *ProtocolManager) BroadcastPbSign(pbSigns []*types.PbftSign)
BroadcastPbSign will propagate a batch of PbftVoteSigns to all peers which are not known to already have the given PbftVoteSign.
func (*ProtocolManager) BroadcastSnailBlock ¶
func (pm *ProtocolManager) BroadcastSnailBlock(snailBlock *types.SnailBlock, propagate bool)
BroadcastSnailBlock will either propagate a snailBlock to a subset of it's peers, or will only announce it's availability (depending what's requested).
func (*ProtocolManager) BroadcastTxs ¶
func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions)
BroadcastTxs will propagate a batch of transactions to all peers which are not known to already have the given transaction.
func (*ProtocolManager) NodeInfo ¶
func (pm *ProtocolManager) NodeInfo() *NodeInfo
NodeInfo retrieves some protocol metadata about the running host node.
func (*ProtocolManager) Start ¶
func (pm *ProtocolManager) Start(maxPeers int)
func (*ProtocolManager) Start2 ¶
func (pm *ProtocolManager) Start2(maxPeers int)
func (*ProtocolManager) Stop ¶
func (pm *ProtocolManager) Stop()
type PublicDebugAPI ¶
type PublicDebugAPI struct {
// contains filtered or unexported fields
}
PublicDebugAPI is the collection of Truechain full node APIs exposed over the public debugging endpoint.
func NewPublicDebugAPI ¶
func NewPublicDebugAPI(etrue *Truechain) *PublicDebugAPI
NewPublicDebugAPI creates a new API definition for the full node- related public debug methods of the Truechain service.
func (*PublicDebugAPI) DumpBlock ¶
func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error)
DumpBlock retrieves the entire state of the database at a given block.
type PublicMinerAPI ¶
type PublicMinerAPI struct {
// contains filtered or unexported fields
}
PublicMinerAPI provides an API to control the miner. It offers only methods that operate on data that pose no security risk when it is publicly accessible.
func NewPublicMinerAPI ¶
func NewPublicMinerAPI(e *Truechain) *PublicMinerAPI
NewPublicMinerAPI create a new PublicMinerAPI instance.
func (*PublicMinerAPI) GetDataset ¶
func (api *PublicMinerAPI) GetDataset() ([10240]string, error)
GetDataset returns a work package for external miner. The work package consists of 3 strings
func (*PublicMinerAPI) GetDatasetBySeedhash ¶ added in v1.1.1
func (api *PublicMinerAPI) GetDatasetBySeedhash(seedhash string) ([10240]string, error)
GetDataset returns a work package for external miner. The work package consists of 3 strings
func (*PublicMinerAPI) GetWork ¶
func (api *PublicMinerAPI) GetWork() ([4]string, error)
GetWork returns a work package for external miner. The work package consists of 3 strings result[0], 32 bytes hex encoded current block header pow-hash result[1], 32 bytes hex encoded seed hash used for DAG result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
func (*PublicMinerAPI) Mining ¶
func (api *PublicMinerAPI) Mining() bool
Mining returns an indication if this node is currently mining.
func (*PublicMinerAPI) SubmitHashrate ¶
SubmitHashrate can be used for remote miners to submit their hash rate. This enables the node to report the combined hash rate of all miners which submit work through this node. It accepts the miner hash rate and an identifier which must be unique between nodes.
func (*PublicMinerAPI) SubmitWork ¶
func (api *PublicMinerAPI) SubmitWork(nonce types.BlockNonce, solution, digest common.Hash) bool
SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note, this is not an indication if the provided work was valid!
type PublicTruechainAPI ¶
type PublicTruechainAPI struct {
// contains filtered or unexported fields
}
PublicTruechainAPI provides an API to access Truechain full node-related information.
func NewPublicTruechainAPI ¶
func NewPublicTruechainAPI(e *Truechain) *PublicTruechainAPI
NewPublicTruechainAPI creates a new Truechain protocol API for full nodes.
func (*PublicTruechainAPI) ChainId ¶ added in v1.1.2
func (api *PublicTruechainAPI) ChainId() hexutil.Uint64
ChainId retuurn current truechain's chain config.
func (*PublicTruechainAPI) Coinbase ¶
func (api *PublicTruechainAPI) Coinbase() (common.Address, error)
Coinbase is the address that mining rewards will be send to (alias for Etherbase)
func (*PublicTruechainAPI) CommitteeBase ¶
func (api *PublicTruechainAPI) CommitteeBase() common.Address
CommitteeBase is the address that generate by pubkey
func (*PublicTruechainAPI) CommitteeNumber ¶
func (api *PublicTruechainAPI) CommitteeNumber() uint64
CommitteeNumber return number of current committee
func (*PublicTruechainAPI) Etherbase ¶
func (api *PublicTruechainAPI) Etherbase() (common.Address, error)
Etherbase is the address that mining rewards will be send to
func (*PublicTruechainAPI) GetCurrentState ¶
func (api *PublicTruechainAPI) GetCurrentState() map[string]interface{}
GetCurrentState get current committee state
func (*PublicTruechainAPI) Hashrate ¶
func (api *PublicTruechainAPI) Hashrate() hexutil.Uint64
Hashrate returns the POW hashrate
func (*PublicTruechainAPI) IsCommitteeMember ¶
func (api *PublicTruechainAPI) IsCommitteeMember() bool
IsCommitteeMember return node whether current committee member
func (*PublicTruechainAPI) Pubkey ¶
func (api *PublicTruechainAPI) Pubkey() string
Pubkey is the address that mining rewards will be send to (alias for Etherbase)
type SnailPool ¶
type SnailPool interface { // AddRemoteFruits should add the given fruits to the pool. AddRemoteFruits([]*types.SnailBlock, bool) []error // PendingFruits should return pending fruits. PendingFruits() map[common.Hash]*types.SnailBlock // SubscribeNewFruitEvent should return an event subscription of // NewFruitsEvent and send events to the given channel. SubscribeNewFruitEvent(chan<- types.NewFruitsEvent) event.Subscription RemovePendingFruitByFastHash(fasthash common.Hash) }
type StorageRangeResult ¶
type StorageRangeResult struct { Storage storageMap `json:"storage"` NextKey *common.Hash `json:"nextKey"` // nil if Storage includes the last key in the trie. }
StorageRangeResult is the result of a debug_storageRangeAt API call.
type TraceConfig ¶
TraceConfig holds extra parameters to trace functions.
type TrueAPIBackend ¶
type TrueAPIBackend struct {
// contains filtered or unexported fields
}
TRUEAPIBackend implements ethapi.Backend for full nodes
func (*TrueAPIBackend) AccountManager ¶
func (b *TrueAPIBackend) AccountManager() *accounts.Manager
AccountManager returns Account Manager
func (*TrueAPIBackend) BlockByNumber ¶
func (b *TrueAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)
BlockByNumber returns block of fast chain by the number
func (*TrueAPIBackend) BloomStatus ¶
func (b *TrueAPIBackend) BloomStatus() (uint64, uint64)
BloomStatus returns Bloom Status
func (*TrueAPIBackend) ChainConfig ¶
func (b *TrueAPIBackend) ChainConfig() *params.ChainConfig
ChainConfig returns the active chain configuration.
func (*TrueAPIBackend) ChainDb ¶
func (b *TrueAPIBackend) ChainDb() etruedb.Database
ChainDb returns tht database of fastchain
func (*TrueAPIBackend) CurrentBlock ¶
func (b *TrueAPIBackend) CurrentBlock() *types.Block
CurrentBlock return the fast chain current Block
func (*TrueAPIBackend) CurrentSnailBlock ¶ added in v1.1.2
func (b *TrueAPIBackend) CurrentSnailBlock() *types.SnailBlock
CurrentSnailBlock return the Snail chain current Block
func (*TrueAPIBackend) Downloader ¶
func (b *TrueAPIBackend) Downloader() *downloader.Downloader
Downloader returns the fast downloader
func (*TrueAPIBackend) EventMux ¶
func (b *TrueAPIBackend) EventMux() *event.TypeMux
EventMux returns Event locker
func (*TrueAPIBackend) GetBalanceChangeBySnailNumber ¶
func (b *TrueAPIBackend) GetBalanceChangeBySnailNumber(snailNumber rpc.BlockNumber) *types.BalanceChangeContent
func (*TrueAPIBackend) GetChainRewardContent ¶
func (b *TrueAPIBackend) GetChainRewardContent(blockNr rpc.BlockNumber) *types.ChainReward
func (*TrueAPIBackend) GetCommittee ¶
func (b *TrueAPIBackend) GetCommittee(number rpc.BlockNumber) (map[string]interface{}, error)
func (*TrueAPIBackend) GetCurrentCommitteeNumber ¶
func (b *TrueAPIBackend) GetCurrentCommitteeNumber() *big.Int
func (*TrueAPIBackend) GetEVM ¶
func (b *TrueAPIBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error)
GetEVM returns the EVM
func (*TrueAPIBackend) GetFruit ¶
func (b *TrueAPIBackend) GetFruit(ctx context.Context, fastblockHash common.Hash) (*types.SnailBlock, error)
GetFruit returns the fruit by the block's hash
func (*TrueAPIBackend) GetPoolNonce ¶
GetPoolNonce returns user nonce by user address in txpool
func (*TrueAPIBackend) GetPoolTransaction ¶
func (b *TrueAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction
GetPoolTransaction returns Transaction by txHash in txpool
func (*TrueAPIBackend) GetPoolTransactions ¶
func (b *TrueAPIBackend) GetPoolTransactions() (types.Transactions, error)
GetPoolTransactions returns Transactions by pending state in txpool
func (*TrueAPIBackend) GetReceipts ¶
GetReceipts returns the Receipt details by txhash
func (*TrueAPIBackend) GetReward ¶
func (b *TrueAPIBackend) GetReward(number int64) *types.BlockReward
GetReward returns the Reward info by number in fastchain
func (*TrueAPIBackend) GetSnailBlock ¶
func (b *TrueAPIBackend) GetSnailBlock(ctx context.Context, hash common.Hash) (*types.SnailBlock, error)
GetSnailBlock returns the snail block by the block's hash
func (*TrueAPIBackend) GetSnailRewardContent ¶ added in v1.0.2
func (b *TrueAPIBackend) GetSnailRewardContent(snailNumber rpc.BlockNumber) *types.SnailRewardContenet
GetSnailRewardContent returns the Reward content by number in Snailchain
func (*TrueAPIBackend) GetStateChangeByFastNumber ¶
func (b *TrueAPIBackend) GetStateChangeByFastNumber(fastNumber rpc.BlockNumber) *types.BlockBalance
GetStateChangeByFastNumber returns the Committee info by committee number
func (*TrueAPIBackend) GetTd ¶
func (b *TrueAPIBackend) GetTd(blockHash common.Hash) *big.Int
GetTd returns the total diffcult with block height by blockhash
func (*TrueAPIBackend) HeaderByHash ¶
HeaderByHash returns header of fast chain by the hash
func (*TrueAPIBackend) HeaderByNumber ¶
func (b *TrueAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
HeaderByNumber returns Header of fast chain by the number rpc.PendingBlockNumber == "pending"; rpc.LatestBlockNumber == "latest" ; rpc.LatestBlockNumber == "earliest"
func (*TrueAPIBackend) ProtocolVersion ¶
func (b *TrueAPIBackend) ProtocolVersion() int
ProtocolVersion returns the version of protocol
func (*TrueAPIBackend) SendTx ¶
func (b *TrueAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
SendTx returns nil by success to add local txpool
func (*TrueAPIBackend) ServiceFilter ¶
func (b *TrueAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
ServiceFilter make the Filter for the truechian
func (*TrueAPIBackend) SetHead ¶
func (b *TrueAPIBackend) SetHead(number uint64)
SetHead Set the newest position of Fast Chain, that will reset the fast blockchain comment
func (*TrueAPIBackend) SetSnailHead ¶
func (b *TrueAPIBackend) SetSnailHead(number uint64)
SetSnailHead Set the newest position of snail chain
func (*TrueAPIBackend) SnailBlockByNumber ¶
func (b *TrueAPIBackend) SnailBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.SnailBlock, error)
SnailBlockByNumber returns block of snial chain by the number
func (*TrueAPIBackend) SnailHeaderByNumber ¶
func (b *TrueAPIBackend) SnailHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.SnailHeader, error)
SnailHeaderByNumber returns Header of snail chain by the number rpc.PendingBlockNumber == "pending"; rpc.LatestBlockNumber == "latest" ; rpc.LatestBlockNumber == "earliest"
func (*TrueAPIBackend) SnailPoolContent ¶
func (b *TrueAPIBackend) SnailPoolContent() []*types.SnailBlock
SnailPoolContent returns snail pool content
func (*TrueAPIBackend) SnailPoolInspect ¶
func (b *TrueAPIBackend) SnailPoolInspect() []*types.SnailBlock
SnailPoolInspect returns snail pool Inspect
func (*TrueAPIBackend) SnailPoolStats ¶
func (b *TrueAPIBackend) SnailPoolStats() (pending int, unVerified int)
SnailPoolStats returns snail pool Stats
func (*TrueAPIBackend) StateAndHeaderByNumber ¶
func (b *TrueAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
StateAndHeaderByNumber returns the state of block by the number
func (*TrueAPIBackend) Stats ¶
func (b *TrueAPIBackend) Stats() (pending int, queued int)
Stats returns the count tx in txpool
func (*TrueAPIBackend) SubscribeChainEvent ¶
func (b *TrueAPIBackend) SubscribeChainEvent(ch chan<- types.FastChainEvent) event.Subscription
SubscribeChainEvent registers a subscription of chainEvnet in fast blockchain
func (*TrueAPIBackend) SubscribeChainHeadEvent ¶
func (b *TrueAPIBackend) SubscribeChainHeadEvent(ch chan<- types.FastChainHeadEvent) event.Subscription
SubscribeChainHeadEvent registers a subscription of chainHeadEvnet in fast blockchain
func (*TrueAPIBackend) SubscribeChainSideEvent ¶
func (b *TrueAPIBackend) SubscribeChainSideEvent(ch chan<- types.FastChainSideEvent) event.Subscription
SubscribeChainSideEvent registers a subscription of chainSideEvnet in fast blockchain,deprecated
func (*TrueAPIBackend) SubscribeLogsEvent ¶
func (b *TrueAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
SubscribeLogsEvent registers a subscription of log in fast blockchain
func (*TrueAPIBackend) SubscribeNewTxsEvent ¶
func (b *TrueAPIBackend) SubscribeNewTxsEvent(ch chan<- types.NewTxsEvent) event.Subscription
SubscribeNewTxsEvent returns the subscript event of new tx
func (*TrueAPIBackend) SubscribeRemovedLogsEvent ¶
func (b *TrueAPIBackend) SubscribeRemovedLogsEvent(ch chan<- types.RemovedLogsEvent) event.Subscription
SubscribeRemovedLogsEvent registers a subscription of RemovedLogsEvent in fast blockchain
func (*TrueAPIBackend) SuggestPrice ¶
SuggestPrice returns tht suggest gas price
func (*TrueAPIBackend) TxPoolContent ¶
func (b *TrueAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
type Truechain ¶
type Truechain struct { APIBackend *TrueAPIBackend // contains filtered or unexported fields }
Truechain implements the Truechain full node service.
func New ¶
func New(ctx *node.ServiceContext, config *Config) (*Truechain, error)
New creates a new Truechain object (including the initialisation of the common Truechain object)
func (*Truechain) APIs ¶
APIs return the collection of RPC services the etrue package offers. NOTE, some of these services probably need to be moved to somewhere else.
func (*Truechain) AccountManager ¶
func (*Truechain) AddLesServer ¶
func (*Truechain) ArchiveMode ¶
func (*Truechain) BlockChain ¶
func (s *Truechain) BlockChain() *core.BlockChain
func (*Truechain) Downloader ¶
func (s *Truechain) Downloader() *downloader.Downloader
func (*Truechain) EthVersion ¶
func (*Truechain) IsListening ¶
func (*Truechain) NetVersion ¶
func (*Truechain) Protocols ¶
Protocols implements node.Service, returning all the currently configured network protocols to start.
func (*Truechain) ResetWithFastGenesisBlock ¶
func (*Truechain) ResetWithGenesisBlock ¶
func (*Truechain) SetEtherbase ¶
SetEtherbase sets the mining reward address.
func (*Truechain) SnailBlockChain ¶
func (s *Truechain) SnailBlockChain() *chain.SnailBlockChain
func (*Truechain) Start ¶
Start implements node.Service, starting all internal goroutines needed by the Truechain protocol implementation.
func (*Truechain) StartMining ¶
func (*Truechain) Stop ¶
Stop implements node.Service, terminating all internal goroutines used by the Truechain protocol.
func (*Truechain) StopMining ¶
func (s *Truechain) StopMining()
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package downloader contains the manual full chain synchronisation.
|
Package downloader contains the manual full chain synchronisation. |
Package downloader contains the manual full chain synchronisation.
|
Package downloader contains the manual full chain synchronisation. |
Package fetcher contains the block announcement based synchronisation.
|
Package fetcher contains the block announcement based synchronisation. |
snail
Package fetcher contains the block announcement based synchronisation.
|
Package fetcher contains the block announcement based synchronisation. |
Package filters implements an ethereum filtering system for block, transactions and log events.
|
Package filters implements an ethereum filtering system for block, transactions and log events. |
Package tracers is a collection of JavaScript transaction tracers.
|
Package tracers is a collection of JavaScript transaction tracers. |
internal/tracers
Package tracers contains the actual JavaScript tracer assets.
|
Package tracers contains the actual JavaScript tracer assets. |