geth

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2019 License: GPL-3.0 Imports: 57 Imported by: 3

README

Embedded geth

So it turns out embedding geth is not straightforward. The only technique that I have found that makes it marginally easier is to vendor the entire go-ethereum code base (and all their vendored packages) so that the types match, and then copy the cmd/geth package source to a new package, go through and remove access to internal packages (i.e we needed to bring the debug package out into a debug.go file). Then main can be rewritten to take args as a parameter rather than from os.Args

Documentation

Overview

geth is the official command-line client for Ethereum.

Index

Constants

This section is empty.

Variables

View Source
var AppHelpFlagGroups = []flagGroup{
	{
		Name: "ETHEREUM",
		Flags: []cli.Flag{
			configFileFlag,
			utils.DataDirFlag,
			utils.KeyStoreDirFlag,
			utils.NoUSBFlag,
			utils.NetworkIdFlag,
			utils.TestnetFlag,
			utils.RinkebyFlag,
			utils.DevModeFlag,
			utils.SyncModeFlag,
			utils.EthStatsURLFlag,
			utils.IdentityFlag,
			utils.LightServFlag,
			utils.LightPeersFlag,
			utils.LightKDFFlag,
		},
	},
	{
		Name: "ETHASH",
		Flags: []cli.Flag{
			utils.EthashCacheDirFlag,
			utils.EthashCachesInMemoryFlag,
			utils.EthashCachesOnDiskFlag,
			utils.EthashDatasetDirFlag,
			utils.EthashDatasetsInMemoryFlag,
			utils.EthashDatasetsOnDiskFlag,
		},
	},
	{
		Name: "TRANSACTION POOL",
		Flags: []cli.Flag{
			utils.TxPoolNoLocalsFlag,
			utils.TxPoolJournalFlag,
			utils.TxPoolRejournalFlag,
			utils.TxPoolPriceLimitFlag,
			utils.TxPoolPriceBumpFlag,
			utils.TxPoolAccountSlotsFlag,
			utils.TxPoolGlobalSlotsFlag,
			utils.TxPoolAccountQueueFlag,
			utils.TxPoolGlobalQueueFlag,
			utils.TxPoolLifetimeFlag,
		},
	},
	{
		Name: "PERFORMANCE TUNING",
		Flags: []cli.Flag{
			utils.CacheFlag,
			utils.TrieCacheGenFlag,
		},
	},
	{
		Name: "ACCOUNT",
		Flags: []cli.Flag{
			utils.UnlockedAccountFlag,
			utils.PasswordFileFlag,
		},
	},
	{
		Name: "API AND CONSOLE",
		Flags: []cli.Flag{
			utils.RPCEnabledFlag,
			utils.RPCListenAddrFlag,
			utils.RPCPortFlag,
			utils.RPCApiFlag,
			utils.WSEnabledFlag,
			utils.WSListenAddrFlag,
			utils.WSPortFlag,
			utils.WSApiFlag,
			utils.WSAllowedOriginsFlag,
			utils.IPCDisabledFlag,
			utils.IPCPathFlag,
			utils.RPCCORSDomainFlag,
			utils.JSpathFlag,
			utils.ExecFlag,
			utils.PreloadJSFlag,
		},
	},
	{
		Name: "NETWORKING",
		Flags: []cli.Flag{
			utils.BootnodesFlag,
			utils.BootnodesV4Flag,
			utils.BootnodesV5Flag,
			utils.ListenPortFlag,
			utils.MaxPeersFlag,
			utils.MaxPendingPeersFlag,
			utils.NATFlag,
			utils.NoDiscoverFlag,
			utils.DiscoveryV5Flag,
			utils.NetrestrictFlag,
			utils.NodeKeyFileFlag,
			utils.NodeKeyHexFlag,
		},
	},
	{
		Name: "MINER",
		Flags: []cli.Flag{
			utils.MiningEnabledFlag,
			utils.MinerThreadsFlag,
			utils.EtherbaseFlag,
			utils.TargetGasLimitFlag,
			utils.GasPriceFlag,
			utils.ExtraDataFlag,
		},
	},
	{
		Name: "GAS PRICE ORACLE",
		Flags: []cli.Flag{
			utils.GpoBlocksFlag,
			utils.GpoPercentileFlag,
		},
	},
	{
		Name: "VIRTUAL MACHINE",
		Flags: []cli.Flag{
			utils.VMEnableDebugFlag,
		},
	},
	{
		Name: "LOGGING AND DEBUGGING",
		Flags: append([]cli.Flag{
			utils.MetricsEnabledFlag,
			utils.FakePoWFlag,
			utils.NoCompactionFlag,
		}, debugFlags...),
	},
	{
		Name:  "WHISPER (EXPERIMENTAL)",
		Flags: whisperFlags,
	},
	{
		Name: "DEPRECATED",
		Flags: []cli.Flag{
			utils.FastSyncFlag,
			utils.LightModeFlag,
		},
	},
	{
		Name: "MISC",
	},
}

AppHelpFlagGroups is the application flags, grouped by functionality.

View Source
var AppHelpTemplate = `` /* 685-byte string literal not displayed */

AppHelpTemplate is the test template for the default, global app help topic.

View Source
var Handler = new(HandlerT)

Handler is the global debugging handler.

Functions

func Main

func Main(args []string) error

Types

type HandlerT

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

HandlerT implements the debugging API. Do not create values of this type, use the one in the Handler variable instead.

func (*HandlerT) BacktraceAt

func (*HandlerT) BacktraceAt(location string) error

BacktraceAt sets the log backtrace location. See package log for details on the pattern syntax.

func (*HandlerT) BlockProfile

func (*HandlerT) BlockProfile(file string, nsec uint) error

BlockProfile turns on CPU profiling for nsec seconds and writes profile data to file. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually.

func (*HandlerT) CpuProfile

func (h *HandlerT) CpuProfile(file string, nsec uint) error

CpuProfile turns on CPU profiling for nsec seconds and writes profile data to file.

func (*HandlerT) FreeOSMemory

func (*HandlerT) FreeOSMemory()

FreeOSMemory returns unused memory to the OS.

func (*HandlerT) GcStats

func (*HandlerT) GcStats() *debug.GCStats

GcStats returns GC statistics.

func (*HandlerT) GoTrace

func (h *HandlerT) GoTrace(file string, nsec uint) error

GoTrace turns on tracing for nsec seconds and writes trace data to file.

func (*HandlerT) MemStats

func (*HandlerT) MemStats() *runtime.MemStats

MemStats returns detailed runtime memory statistics.

func (*HandlerT) SetBlockProfileRate

func (*HandlerT) SetBlockProfileRate(rate int)

SetBlockProfileRate sets the rate of goroutine block profile data collection. rate 0 disables block profiling.

func (*HandlerT) SetGCPercent

func (*HandlerT) SetGCPercent(v int) int

SetGCPercent sets the garbage collection target percentage. It returns the previous setting. A negative value disables GC.

func (*HandlerT) Stacks

func (*HandlerT) Stacks() string

Stacks returns a printed representation of the stacks of all goroutines.

func (*HandlerT) StartCPUProfile

func (h *HandlerT) StartCPUProfile(file string) error

StartCPUProfile turns on CPU profiling, writing to the given file.

func (*HandlerT) StartGoTrace

func (*HandlerT) StartGoTrace(string) error

func (*HandlerT) StopCPUProfile

func (h *HandlerT) StopCPUProfile() error

StopCPUProfile stops an ongoing CPU profile.

func (*HandlerT) StopGoTrace

func (*HandlerT) StopGoTrace() error

func (*HandlerT) Verbosity

func (*HandlerT) Verbosity(level int)

Verbosity sets the log verbosity ceiling. The verbosity of individual packages and source files can be raised using Vmodule.

func (*HandlerT) Vmodule

func (*HandlerT) Vmodule(pattern string) error

Vmodule sets the log verbosity pattern. See package log for details on the pattern syntax.

func (*HandlerT) WriteBlockProfile

func (*HandlerT) WriteBlockProfile(file string) error

WriteBlockProfile writes a goroutine blocking profile to the given file.

func (*HandlerT) WriteMemProfile

func (*HandlerT) WriteMemProfile(file string) error

WriteMemProfile writes an allocation profile to the given file. Note that the profiling rate cannot be set through the API, it must be set on the command line.

Jump to

Keyboard shortcuts

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