eth

package
v0.9.34-1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2015 License: LGPL-2.1-or-later Imports: 36 Imported by: 48

Documentation

Index

Constants

View Source
const (
	ProtocolVersion    = 60
	NetworkId          = 0
	ProtocolLength     = uint64(8)
	ProtocolMaxMsgSize = 10 * 1024 * 1024
)
View Source
const (
	StatusMsg = iota
	NewBlockHashesMsg
	TxMsg
	GetBlockHashesMsg
	BlockHashesMsg
	GetBlocksMsg
	BlocksMsg
	NewBlockMsg
)

eth protocol message codes

View Source
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
	GenesisNonce    int

	BlockChainVersion  int
	SkipBcVersionCheck bool // e.g. blockchain export

	DataDir   string
	LogFile   string
	Verbosity int
	LogJSON   string
	VmDebug   bool
	NatSpec   bool
	AutoDAG   bool

	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      string
	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) (common.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
	// contains filtered or unexported fields
}

func New

func New(config *Config) (*Ethereum, error)

func (*Ethereum) AccountManager added in v0.9.20

func (s *Ethereum) AccountManager() *accounts.Manager

func (*Ethereum) AddPeer added in v0.9.20

func (self *Ethereum) AddPeer(nodeURL string) error

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) BlockDb added in v0.9.20

func (s *Ethereum) BlockDb() common.Database

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.20

func (s *Ethereum) ClientVersion() string

func (*Ethereum) Downloader added in v0.9.20

func (s *Ethereum) Downloader() *downloader.Downloader

func (*Ethereum) EthVersion added in v0.9.20

func (s *Ethereum) EthVersion() int

func (*Ethereum) Etherbase added in v0.9.20

func (s *Ethereum) Etherbase() (eb common.Address, err error)

func (*Ethereum) EventMux

func (s *Ethereum) EventMux() *event.TypeMux

func (*Ethereum) ExtraDb added in v0.9.20

func (s *Ethereum) ExtraDb() common.Database

func (*Ethereum) IsListening

func (s *Ethereum) IsListening() bool

func (*Ethereum) IsMining added in v0.9.20

func (s *Ethereum) IsMining() bool

func (*Ethereum) MaxPeers

func (s *Ethereum) MaxPeers() int

func (*Ethereum) Miner

func (s *Ethereum) Miner() *miner.Miner

func (*Ethereum) Name

func (s *Ethereum) Name() string

func (s *Ethereum) Logger() logger.LogSystem { return s.logger }

func (*Ethereum) NetVersion added in v0.9.20

func (s *Ethereum) NetVersion() int

func (*Ethereum) NodeInfo added in v0.9.20

func (s *Ethereum) NodeInfo() *NodeInfo

func (*Ethereum) PeerCount

func (s *Ethereum) PeerCount() int

func (*Ethereum) Peers

func (s *Ethereum) Peers() []*p2p.Peer

func (*Ethereum) PeersInfo added in v0.9.20

func (s *Ethereum) PeersInfo() (peersinfo []*PeerInfo)

PeersInfo returns an array of PeerInfo objects describing connected peers

func (*Ethereum) ResetWithGenesisBlock added in v0.9.20

func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block)

func (*Ethereum) SetSolc added in v0.9.23

func (self *Ethereum) SetSolc(solcPath string) (*compiler.Solidity, error)

set in js console via admin interface or wrapper from cli flags

func (*Ethereum) ShhVersion added in v0.9.20

func (s *Ethereum) ShhVersion() int

func (*Ethereum) Solc added in v0.9.23

func (self *Ethereum) Solc() (*compiler.Solidity, error)

func (*Ethereum) Start

func (s *Ethereum) Start() error

Start the ethereum

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.20

func (s *Ethereum) StartForTest()

func (*Ethereum) StartMining added in v0.9.20

func (s *Ethereum) StartMining(threads int) error

func (*Ethereum) StateDb added in v0.9.20

func (s *Ethereum) StateDb() common.Database

func (*Ethereum) Stop

func (s *Ethereum) Stop()

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.20

func (s *Ethereum) StopMining()

func (*Ethereum) TxPool

func (s *Ethereum) TxPool() *core.TxPool

func (*Ethereum) WaitForShutdown

func (s *Ethereum) WaitForShutdown()

This function will wait for a shutdown and resumes main thread execution

func (*Ethereum) Whisper

func (s *Ethereum) Whisper() *whisper.Whisper

type GasPriceOracle added in v0.9.30

type GasPriceOracle struct {
	// contains filtered or unexported fields
}

func NewGasPriceOracle added in v0.9.30

func NewGasPriceOracle(eth *Ethereum) (self *GasPriceOracle)

func (*GasPriceOracle) SuggestPrice added in v0.9.30

func (self *GasPriceOracle) SuggestPrice() *big.Int

type NodeInfo added in v0.9.20

type NodeInfo struct {
	Name       string
	NodeUrl    string
	NodeID     string
	IP         string
	DiscPort   int // UDP listening port for discovery protocol
	TCPPort    int // TCP listening port for RLPx
	Td         string
	ListenAddr string
}

type PeerInfo added in v0.9.20

type PeerInfo struct {
	ID            string
	Name          string
	Caps          string
	RemoteAddress string
	LocalAddress  string
}

type ProtocolManager added in v0.9.20

type ProtocolManager struct {
	SubProtocol p2p.Protocol
	// contains filtered or unexported fields
}

func NewProtocolManager added in v0.9.20

func NewProtocolManager(protocolVersion, networkId int, mux *event.TypeMux, txpool txPool, pow pow.PoW, chainman *core.ChainManager) *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.20

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.20

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.20

func (pm *ProtocolManager) Start()

func (*ProtocolManager) Stop added in v0.9.20

func (pm *ProtocolManager) Stop()

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL