func main() { app := utils.NewApp(Version, "the geth-tmsp command line interface") app.Action = run app.Flags = []cli.Flag{ gethapp.TendermintCoreHostFlag, utils.IdentityFlag, utils.UnlockedAccountFlag, utils.PasswordFileFlag, utils.GenesisFileFlag, utils.BootnodesFlag, utils.DataDirFlag, utils.BlockchainVersionFlag, utils.OlympicFlag, utils.FastSyncFlag, utils.CacheFlag, utils.LightKDFFlag, utils.JSpathFlag, utils.ListenPortFlag, utils.MaxPeersFlag, utils.MaxPendingPeersFlag, utils.EtherbaseFlag, utils.GasPriceFlag, utils.MinerThreadsFlag, utils.MiningEnabledFlag, utils.MiningGPUFlag, utils.AutoDAGFlag, utils.NATFlag, utils.NatspecEnabledFlag, utils.NoDiscoverFlag, utils.NodeKeyFileFlag, utils.NodeKeyHexFlag, utils.RPCEnabledFlag, utils.RPCListenAddrFlag, utils.RPCPortFlag, utils.RpcApiFlag, utils.IPCDisabledFlag, utils.IPCApiFlag, utils.IPCPathFlag, utils.ExecFlag, utils.WhisperEnabledFlag, utils.DevModeFlag, utils.TestNetFlag, utils.VMDebugFlag, utils.VMForceJitFlag, utils.VMJitCacheFlag, utils.VMEnableJitFlag, utils.NetworkIdFlag, utils.RPCCORSDomainFlag, utils.VerbosityFlag, utils.BacktraceAtFlag, utils.LogVModuleFlag, utils.LogFileFlag, utils.PProfEanbledFlag, utils.PProfPortFlag, utils.MetricsEnabledFlag, utils.SolcPathFlag, utils.GpoMinGasPriceFlag, utils.GpoMaxGasPriceFlag, utils.GpoFullBlockRatioFlag, utils.GpobaseStepDownFlag, utils.GpobaseStepUpFlag, utils.GpobaseCorrectionFactorFlag, utils.ExtraDataFlag, } app.Before = func(ctx *cli.Context) error { utils.SetupLogger(ctx) utils.SetupNetwork(ctx) utils.SetupVM(ctx) if ctx.GlobalBool(utils.PProfEanbledFlag.Name) { utils.StartPProf(ctx) } return nil } app.Run(os.Args) }
func init() { if gitCommit == "" { nodeNameVersion = Version } else { nodeNameVersion = Version + "-" + gitCommit[:8] } app = utils.NewApp(Version, "the go-ethereum command line interface") app.Action = run app.HideVersion = true // we have a command to print the version app.Commands = []cli.Command{ { Action: blockRecovery, Name: "recover", Usage: "attempts to recover a corrupted database by setting a new block by number or hash. See help recover.", Description: ` The recover commands will attempt to read out the last block based on that. recover #number recovers by number recover <hex> recovers by hash `, }, blocktestCommand, importCommand, exportCommand, upgradedbCommand, removedbCommand, dumpCommand, monitorCommand, { Action: makedag, Name: "makedag", Usage: "generate ethash dag (for testing)", Description: ` The makedag command generates an ethash DAG in /tmp/dag. This command exists to support the system testing project. Regular users do not need to execute it. `, }, { Action: version, Name: "version", Usage: "print ethereum version numbers", Description: ` The output of this command is supposed to be machine-readable. `, }, { Name: "wallet", Usage: "ethereum presale wallet", Subcommands: []cli.Command{ { Action: importWallet, Name: "import", Usage: "import ethereum presale wallet", }, }, Description: ` get wallet import /path/to/my/presale.wallet will prompt for your password and imports your ether presale account. It can be used non-interactively with the --password option taking a passwordfile as argument containing the wallet password in plaintext. `}, { Action: accountList, Name: "account", Usage: "manage accounts", Description: ` Manage accounts lets you create new accounts, list all existing accounts, import a private key into a new account. ' help' shows a list of subcommands or help for one subcommand. It supports interactive mode, when you are prompted for password as well as non-interactive mode where passwords are supplied via a given password file. Non-interactive mode is only meant for scripted use on test networks or known safe environments. Make sure you remember the password you gave when creating a new account (with either new or import). Without it you are not able to unlock your account. Note that exporting your key in unencrypted format is NOT supported. Keys are stored under <DATADIR>/keys. It is safe to transfer the entire directory or the individual keys therein between ethereum nodes by simply copying. Make sure you backup your keys regularly. In order to use your account to send transactions, you need to unlock them using the '--unlock' option. The argument is a comma And finally. DO NOT FORGET YOUR PASSWORD. `, Subcommands: []cli.Command{ { Action: accountList, Name: "list", Usage: "print account addresses", }, { Action: accountCreate, Name: "new", Usage: "create a new account", Description: ` ethereum account new Creates a new account. Prints the address. The account is saved in encrypted format, you are prompted for a passphrase. You must remember this passphrase to unlock your account in the future. For non-interactive use the passphrase can be specified with the --password flag: ethereum --password <passwordfile> account new Note, this is meant to be used for testing only, it is a bad idea to save your password to file or expose in any other way. `, }, { Action: accountUpdate, Name: "update", Usage: "update an existing account", Description: ` ethereum account update <address> Update an existing account. The account is saved in the newest version in encrypted format, you are prompted for a passphrase to unlock the account and another to save the updated file. This same command can therefore be used to migrate an account of a deprecated format to the newest format or change the password for an account. For non-interactive use the passphrase can be specified with the --password flag: ethereum --password <passwordfile> account new Since only one password can be given, only format update can be performed, changing your password is only possible interactively. Note that account update has the a side effect that the order of your accounts changes. `, }, { Action: accountImport, Name: "import", Usage: "import a private key into a new account", Description: ` ethereum account import <keyfile> Imports an unencrypted private key from <keyfile> and creates a new account. Prints the address. The keyfile is assumed to contain an unencrypted private key in hexadecimal format. The account is saved in encrypted format, you are prompted for a passphrase. You must remember this passphrase to unlock your account in the future. For non-interactive use the passphrase can be specified with the -password flag: ethereum --password <passwordfile> account import <keyfile> Note: As you can directly copy your encrypted accounts to another ethereum instance, this import mechanism is not needed when you transfer an account between nodes. `, }, }, }, { Action: console, Name: "console", Usage: `Geth Console: interactive JavaScript environment`, Description: ` The Geth console is an interactive shell for the JavaScript runtime environment which exposes a node admin interface as well as the Ðapp JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console `}, { Action: attach, Name: "attach", Usage: `Geth Console: interactive JavaScript environment (connect to node)`, Description: ` The Geth console is an interactive shell for the JavaScript runtime environment which exposes a node admin interface as well as the Ðapp JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console. This command allows to open a console on a running geth node. `, }, { Action: execJSFiles, Name: "js", Usage: `executes the given JavaScript files in the Geth JavaScript VM`, Description: ` The JavaScript VM exposes a node admin interface as well as the Ðapp JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console `, }, } app.Flags = []cli.Flag{ utils.IdentityFlag, utils.UnlockedAccountFlag, utils.PasswordFileFlag, utils.GenesisFileFlag, utils.BootnodesFlag, utils.DataDirFlag, utils.BlockchainVersionFlag, utils.OlympicFlag, utils.CacheFlag, utils.JSpathFlag, utils.ListenPortFlag, utils.MaxPeersFlag, utils.MaxPendingPeersFlag, utils.EtherbaseFlag, utils.GasPriceFlag, utils.MinerThreadsFlag, utils.MiningEnabledFlag, utils.AutoDAGFlag, utils.NATFlag, utils.NatspecEnabledFlag, utils.NoDiscoverFlag, utils.NodeKeyFileFlag, utils.NodeKeyHexFlag, utils.RPCEnabledFlag, utils.RPCListenAddrFlag, utils.RPCPortFlag, utils.RpcApiFlag, utils.IPCDisabledFlag, utils.IPCApiFlag, utils.IPCPathFlag, utils.ExecFlag, utils.WhisperEnabledFlag, utils.VMDebugFlag, utils.VMForceJitFlag, utils.VMJitCacheFlag, utils.VMEnableJitFlag, utils.NetworkIdFlag, utils.RPCCORSDomainFlag, utils.VerbosityFlag, utils.BacktraceAtFlag, utils.LogToStdErrFlag, utils.LogVModuleFlag, utils.LogFileFlag, utils.LogJSONFlag, utils.PProfEanbledFlag, utils.PProfPortFlag, utils.MetricsEnabledFlag, utils.SolcPathFlag, utils.GpoMinGasPriceFlag, utils.GpoMaxGasPriceFlag, utils.GpoFullBlockRatioFlag, utils.GpobaseStepDownFlag, utils.GpobaseStepUpFlag, utils.GpobaseCorrectionFactorFlag, } app.Before = func(ctx *cli.Context) error { utils.SetupLogger(ctx) utils.SetupVM(ctx) if ctx.GlobalBool(utils.PProfEanbledFlag.Name) { utils.StartPProf(ctx) } return nil } // Start system runtime metrics collection go metrics.CollectProcessMetrics(3 * time.Second) }
func init() { if gitCommit == "" { nodeNameVersion = Version } else { nodeNameVersion = Version + "-" + gitCommit[:8] } app = utils.NewApp(Version, "the go-ethereum command line interface") app.Action = run app.HideVersion = true // we have a command to print the version app.Commands = []cli.Command{ blocktestCmd, { Action: makedag, Name: "makedag", Usage: "generate ethash dag (for testing)", Description: ` The makedag command generates an ethash DAG in /tmp/dag. This command exists to support the system testing project. Regular users do not need to execute it. `, }, { Action: version, Name: "version", Usage: "print ethereum version numbers", Description: ` The output of this command is supposed to be machine-readable. `, }, { Name: "wallet", Usage: "ethereum presale wallet", Subcommands: []cli.Command{ { Action: importWallet, Name: "import", Usage: "import ethereum presale wallet", }, }, }, { Action: accountList, Name: "account", Usage: "manage accounts", Description: ` Manage accounts lets you create new accounts, list all existing accounts, import a private key into a new account. 'account help' shows a list of subcommands or help for one subcommand. It supports interactive mode, when you are prompted for password as well as non-interactive mode where passwords are supplied via a given password file. Non-interactive mode is only meant for scripted use on test networks or known safe environments. Make sure you remember the password you gave when creating a new account (with either new or import). Without it you are not able to unlock your account. Note that exporting your key in unencrypted format is NOT supported. Keys are stored under <DATADIR>/keys. It is safe to transfer the entire directory or the individual keys therein between ethereum nodes. Make sure you backup your keys regularly. And finally. DO NOT FORGET YOUR PASSWORD. `, Subcommands: []cli.Command{ { Action: accountList, Name: "list", Usage: "print account addresses", }, { Action: accountCreate, Name: "new", Usage: "create a new account", Description: ` ethereum account new Creates a new account. Prints the address. The account is saved in encrypted format, you are prompted for a passphrase. You must remember this passphrase to unlock your account in the future. For non-interactive use the passphrase can be specified with the --password flag: ethereum --password <passwordfile> account new Note, this is meant to be used for testing only, it is a bad idea to save your password to file or expose in any other way. `, }, { Action: accountImport, Name: "import", Usage: "import a private key into a new account", Description: ` ethereum account import <keyfile> Imports an unencrypted private key from <keyfile> and creates a new account. Prints the address. The keyfile is assumed to contain an unencrypted private key in hexadecimal format. The account is saved in encrypted format, you are prompted for a passphrase. You must remember this passphrase to unlock your account in the future. For non-interactive use the passphrase can be specified with the -password flag: ethereum --password <passwordfile> account import <keyfile> Note: As you can directly copy your encrypted accounts to another ethereum instance, this import mechanism is not needed when you transfer an account between nodes. `, }, }, }, { Action: dump, Name: "dump", Usage: `dump a specific block from storage`, Description: ` The arguments are interpreted as block numbers or hashes. Use "ethereum dump 0" to dump the genesis block. `, }, { Action: console, Name: "console", Usage: `Geth Console: interactive JavaScript environment`, Description: ` The Geth console is an interactive shell for the JavaScript runtime environment which exposes a node admin interface as well as the Ðapp JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console `, }, { Action: execJSFiles, Name: "js", Usage: `executes the given JavaScript files in the Geth JavaScript VM`, Description: ` The JavaScript VM exposes a node admin interface as well as the Ðapp JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console `, }, { Action: importchain, Name: "import", Usage: `import a blockchain file`, }, { Action: exportchain, Name: "export", Usage: `export blockchain into file`, }, { Action: upgradeDb, Name: "upgradedb", Usage: "upgrade chainblock database", }, } app.Flags = []cli.Flag{ utils.IdentityFlag, utils.UnlockedAccountFlag, utils.PasswordFileFlag, utils.BootnodesFlag, utils.DataDirFlag, utils.BlockchainVersionFlag, utils.JSpathFlag, utils.ListenPortFlag, utils.MaxPeersFlag, utils.EtherbaseFlag, utils.MinerThreadsFlag, utils.MiningEnabledFlag, utils.NATFlag, utils.NatspecEnabledFlag, utils.NodeKeyFileFlag, utils.NodeKeyHexFlag, utils.RPCEnabledFlag, utils.RPCListenAddrFlag, utils.RPCPortFlag, utils.WhisperEnabledFlag, utils.VMDebugFlag, utils.ProtocolVersionFlag, utils.NetworkIdFlag, utils.RPCCORSDomainFlag, utils.LogLevelFlag, utils.BacktraceAtFlag, utils.LogToStdErrFlag, utils.LogVModuleFlag, utils.LogFileFlag, utils.LogJSONFlag, utils.PProfEanbledFlag, utils.PProfPortFlag, } app.Before = func(ctx *cli.Context) error { if ctx.GlobalBool(utils.PProfEanbledFlag.Name) { utils.StartPProf(ctx) } return nil } // missing: // flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") // flag.BoolVar(&DiffTool, "difftool", false, "creates output for diff'ing. Sets LogLevel=0") // flag.StringVar(&DiffType, "diff", "all", "sets the level of diff output [vm, all]. Has no effect if difftool=false") }