Documentation
¶
Index ¶
- Constants
- type Config
- type Ethereum
- func (s *Ethereum) AccountManager() *accounts.Manager
- func (self *Ethereum) AddPeer(nodeURL string) error
- func (s *Ethereum) BlockDb() common.Database
- func (s *Ethereum) BlockProcessor() *core.BlockProcessor
- func (s *Ethereum) ChainManager() *core.ChainManager
- func (s *Ethereum) ClientVersion() string
- func (s *Ethereum) Downloader() *downloader.Downloader
- func (s *Ethereum) EthVersion() int
- func (s *Ethereum) Etherbase() (eb common.Address, err error)
- func (s *Ethereum) EventMux() *event.TypeMux
- func (s *Ethereum) ExtraDb() common.Database
- func (s *Ethereum) IsListening() bool
- func (s *Ethereum) IsMining() bool
- func (s *Ethereum) MaxPeers() int
- func (s *Ethereum) Miner() *miner.Miner
- func (s *Ethereum) Name() string
- func (s *Ethereum) NetVersion() int
- func (s *Ethereum) NodeInfo() *NodeInfo
- func (s *Ethereum) PeerCount() int
- func (s *Ethereum) Peers() []*p2p.Peer
- func (s *Ethereum) PeersInfo() (peersinfo []*PeerInfo)
- func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block)
- func (s *Ethereum) ShhVersion() int
- func (s *Ethereum) Start() error
- func (s *Ethereum) StartForTest()
- func (s *Ethereum) StartMining(threads int) error
- func (s *Ethereum) StateDb() common.Database
- func (s *Ethereum) Stop()
- func (s *Ethereum) StopMining()
- func (s *Ethereum) TxPool() *core.TxPool
- func (s *Ethereum) WaitForShutdown()
- func (s *Ethereum) Whisper() *whisper.Whisper
- type NodeInfo
- type PeerInfo
- type ProtocolManager
Constants ¶
const ( ProtocolVersion = 60 NetworkId = 0 ProtocolLength = uint64(8) ProtocolMaxMsgSize = 10 * 1024 * 1024 )
const ( StatusMsg = iota GetTxMsg // unused TxMsg GetBlockHashesMsg BlockHashesMsg GetBlocksMsg BlocksMsg NewBlockMsg )
eth protocol message codes
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNetworkIdMismatch ErrGenesisBlockMismatch ErrNoStatusMsg ErrExtraStatusMsg ErrSuspendedPeer )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Name string
ProtocolVersion int
NetworkId int
BlockChainVersion int
SkipBcVersionCheck bool // e.g. blockchain export
DataDir string
LogFile string
Verbosity int
LogJSON string
VmDebug bool
NatSpec bool
MaxPeers int
MaxPendingPeers int
Port string
// Space-separated list of discovery node URLs
BootNodes string
// This key is used to identify the node on the network.
// If nil, an ephemeral key is used.
NodeKey *ecdsa.PrivateKey
NAT nat.Interface
Shh bool
Dial bool
Etherbase string
GasPrice *big.Int
MinerThreads int
AccountManager *accounts.Manager
// NewDB is used to create databases.
// If nil, the default is to create leveldb databases on disk.
NewDB func(path string) (common.Database, error)
}
type Ethereum ¶
type Ethereum struct {
Mining bool
NatSpec bool
DataDir string
// contains filtered or unexported fields
}
func (*Ethereum) AccountManager ¶ added in v0.9.17
func (*Ethereum) AddPeer ¶ added in v0.9.17
AddPeer connects to the given node and maintains the connection until the server is shut down. If the connection fails for any reason, the server will attempt to reconnect the peer.
func (*Ethereum) BlockProcessor ¶
func (s *Ethereum) BlockProcessor() *core.BlockProcessor
func (*Ethereum) ChainManager ¶
func (s *Ethereum) ChainManager() *core.ChainManager
func (*Ethereum) ClientVersion ¶ added in v0.9.17
func (*Ethereum) Downloader ¶ added in v0.9.17
func (s *Ethereum) Downloader() *downloader.Downloader
func (*Ethereum) EthVersion ¶ added in v0.9.17
func (*Ethereum) IsListening ¶
func (*Ethereum) NetVersion ¶ added in v0.9.17
func (*Ethereum) PeersInfo ¶ added in v0.9.17
PeersInfo returns an array of PeerInfo objects describing connected peers
func (*Ethereum) ResetWithGenesisBlock ¶ added in v0.9.17
func (*Ethereum) ShhVersion ¶ added in v0.9.17
func (*Ethereum) StartForTest ¶ added in v0.9.17
func (s *Ethereum) StartForTest()
func (*Ethereum) StartMining ¶ added in v0.9.17
func (*Ethereum) StopMining ¶ added in v0.9.17
func (s *Ethereum) StopMining()
func (*Ethereum) WaitForShutdown ¶
func (s *Ethereum) WaitForShutdown()
This function will wait for a shutdown and resumes main thread execution
type ProtocolManager ¶ added in v0.9.17
func NewProtocolManager ¶ added in v0.9.17
func NewProtocolManager(protocolVersion, networkId int, mux *event.TypeMux, txpool txPool, chainman *core.ChainManager, downloader *downloader.Downloader) *ProtocolManager
NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable with the ethereum network.
func (*ProtocolManager) BroadcastBlock ¶ added in v0.9.17
func (pm *ProtocolManager) BroadcastBlock(hash common.Hash, block *types.Block)
BroadcastBlock will propagate the block to its connected peers. It will sort out which peers do not contain the block in their block set and will do a sqrt(peers) to determine the amount of peers we broadcast to.
func (*ProtocolManager) BroadcastTx ¶ added in v0.9.17
func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *types.Transaction)
BroadcastTx will propagate the block to its connected peers. It will sort out which peers do not contain the block in their block set and will do a sqrt(peers) to determine the amount of peers we broadcast to.
func (*ProtocolManager) Start ¶ added in v0.9.17
func (pm *ProtocolManager) Start()
func (*ProtocolManager) Stop ¶ added in v0.9.17
func (pm *ProtocolManager) Stop()