Documentation ¶
Overview ¶
Package eth implements the Ethereum protocol.
Index ¶
- Constants
- Variables
- type Config
- type Ethereum
- func (s *Ethereum) AccountManager() *accounts.Manager
- func (self *Ethereum) AddPeer(nodeURL string) error
- func (s *Ethereum) BlockProcessor() *core.BlockProcessor
- func (s *Ethereum) ChainDb() ethdb.Database
- func (s *Ethereum) ChainManager() *core.ChainManager
- func (s *Ethereum) ClientVersion() string
- func (s *Ethereum) DappDb() ethdb.Database
- 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) 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 (self *Ethereum) SetEtherbase(etherbase common.Address)
- func (self *Ethereum) SetSolc(solcPath string) (*compiler.Solidity, error)
- func (s *Ethereum) ShhVersion() int
- func (self *Ethereum) Solc() (*compiler.Solidity, error)
- func (s *Ethereum) Start() error
- func (self *Ethereum) StartAutoDAG()
- func (s *Ethereum) StartForTest()
- func (s *Ethereum) StartMining(threads int) error
- func (s *Ethereum) Stop()
- func (self *Ethereum) StopAutoDAG()
- func (s *Ethereum) StopMining()
- func (s *Ethereum) TxPool() *core.TxPool
- func (s *Ethereum) WaitForShutdown()
- func (s *Ethereum) Whisper() *whisper.Whisper
- type GasPriceOracle
- type NodeInfo
- type PeerInfo
- type ProtocolManager
Constants ¶
const ( NetworkId = 1 ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message )
const ( // Protocol messages belonging to eth/61 StatusMsg = 0x00 NewBlockHashesMsg = 0x01 TxMsg = 0x02 GetBlockHashesMsg = 0x03 BlockHashesMsg = 0x04 GetBlocksMsg = 0x05 BlocksMsg = 0x06 NewBlockMsg = 0x07 GetBlockHashesFromNumberMsg = 0x08 // Protocol messages belonging to eth/62 (new protocol from scratch) // StatusMsg = 0x00 (uncomment after eth/61 deprecation) // NewBlockHashesMsg = 0x01 (uncomment after eth/61 deprecation) // TxMsg = 0x02 (uncomment after eth/61 deprecation) GetBlockHeadersMsg = 0x03 BlockHeadersMsg = 0x04 GetBlockBodiesMsg = 0x05 BlockBodiesMsg = 0x06 // Protocol messages belonging to eth/63 GetNodeDataMsg = 0x0d NodeDataMsg = 0x0e GetReceiptsMsg = 0x0f ReceiptsMsg = 0x10 // Protocol messages belonging to eth/64 GetAcctProofMsg = 0x11 GetStorageDataProof = 0x12 Proof = 0x13 )
eth protocol message codes
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNetworkIdMismatch ErrGenesisBlockMismatch ErrNoStatusMsg ErrExtraStatusMsg ErrSuspendedPeer )
Variables ¶
var ProtocolLengths = []uint64{15, 12, 8, 9}
Number of implemented message corresponding to different protocol versions.
var ProtocolVersions = []uint{eth64, eth63, eth62, eth61}
Supported versions of the eth protocol (first is primary).
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { DevMode bool Name string NetworkId int GenesisNonce int GenesisFile string GenesisBlock *types.Block // used by block tests Olympic bool BlockChainVersion int SkipBcVersionCheck bool // e.g. blockchain export DatabaseCache int DataDir string LogFile string Verbosity int LogJSON string VmDebug bool NatSpec bool AutoDAG bool PowTest bool ExtraData []byte MaxPeers int MaxPendingPeers int Discovery bool 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 common.Address GasPrice *big.Int MinerThreads int AccountManager *accounts.Manager SolcPath string GpoMinGasPrice *big.Int GpoMaxGasPrice *big.Int GpoFullBlockRatio int GpobaseStepDown int GpobaseStepUp int GpobaseCorrectionFactor int // NewDB is used to create databases. // If nil, the default is to create leveldb databases on disk. NewDB func(path string) (ethdb.Database, error) }
type Ethereum ¶
type Ethereum struct { SolcPath string GpoMinGasPrice *big.Int GpoMaxGasPrice *big.Int GpoFullBlockRatio int GpobaseStepDown int GpobaseStepUp int GpobaseCorrectionFactor int Mining bool MinerThreads int NatSpec bool DataDir string AutoDAG bool PowTest bool // 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) SetEtherbase ¶ added in v0.9.38
set in js console via admin interface or wrapper from cli flags
func (*Ethereum) SetSolc ¶ added in v0.9.23
set in js console via admin interface or wrapper from cli flags
func (*Ethereum) ShhVersion ¶ added in v0.9.17
func (*Ethereum) StartAutoDAG ¶ added in v0.9.23
func (self *Ethereum) StartAutoDAG()
StartAutoDAG() spawns a go routine that checks the DAG every autoDAGcheckInterval by default that is 10 times per epoch in epoch n, if we past autoDAGepochHeight within-epoch blocks, it calls ethash.MakeDAG to pregenerate the DAG for the next epoch n+1 if it does not exist yet as well as remove the DAG for epoch n-1 the loop quits if autodagquit channel is closed, it can safely restart and stop any number of times. For any more sophisticated pattern of DAG generation, use CLI subcommand makedag
func (*Ethereum) StartForTest ¶ added in v0.9.17
func (s *Ethereum) StartForTest()
func (*Ethereum) StartMining ¶ added in v0.9.17
func (*Ethereum) StopAutoDAG ¶ added in v0.9.23
func (self *Ethereum) StopAutoDAG()
stopAutoDAG stops automatic DAG pregeneration by quitting the loop
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 GasPriceOracle ¶ added in v0.9.32
type GasPriceOracle struct {
// contains filtered or unexported fields
}
func NewGasPriceOracle ¶ added in v0.9.32
func NewGasPriceOracle(eth *Ethereum) (self *GasPriceOracle)
func (*GasPriceOracle) SuggestPrice ¶ added in v0.9.32
func (self *GasPriceOracle) SuggestPrice() *big.Int
type ProtocolManager ¶ added in v0.9.17
type ProtocolManager struct { SubProtocols []p2p.Protocol // contains filtered or unexported fields }
func NewProtocolManager ¶ added in v0.9.17
func NewProtocolManager(networkId int, mux *event.TypeMux, txpool txPool, pow pow.PoW, chainman *core.ChainManager, chaindb ethdb.Database) *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(block *types.Block, propagate bool)
BroadcastBlock 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) BroadcastTx ¶ added in v0.9.17
func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *types.Transaction)
BroadcastTx will propagate a transaction to all peers which are not known to already have the given transaction.
func (*ProtocolManager) Start ¶ added in v0.9.17
func (pm *ProtocolManager) Start()
func (*ProtocolManager) Stop ¶ added in v0.9.17
func (pm *ProtocolManager) Stop()
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package downloader contains the manual full chain synchronisation.
|
Package downloader contains the manual full chain synchronisation. |
Package fetcher contains the block announcement based synchonisation.
|
Package fetcher contains the block announcement based synchonisation. |