前言
本文主要是分类的方式将geth的命令行参数,属性进行介绍和解释,如有翻译,理解上的偏差欢迎讨论交流。
总览
$ geth help
NAME:
geth - the go-ethereum command line interface
Copyright 2013-2017 The go-ethereum Authors
USAGE:
geth [options] command [command options] [arguments...]
VERSION:
1.7.3-stable
COMMANDS:
account Manage accounts
attach Start an interactive JavaScript environment (connect to node)
bug opens a window to report a bug on the geth repo
console Start an interactive JavaScript environment
copydb Create a local chain from a target chaindata folder
dump Dump a specific block from storage
dumpconfig Show configuration values
export Export blockchain into file
import Import a blockchain file
init Bootstrap and initialize a new genesis block
js Execute the specified JavaScript files
license Display license information
makecache Generate ethash verification cache (for testing)
makedag Generate ethash mining DAG (for testing)
monitor Monitor and visualize node metrics
removedb Remove blockchain and state databases
version Print version numbers
wallet Manage Ethereum presale wallets
help, h Shows a list of commands or help for one command
ETHEREUM OPTIONS:
--config value TOML configuration file
--datadir "/home/karalabe/.ethereum" Data directory for the databases and keystore
--keystore Directory for the keystore (default = inside the datadir)
--nousb Disables monitoring for and managing USB hardware wallets
--networkid value Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby) (default: 1)
--testnet Ropsten network: pre-configured proof-of-work test network
--rinkeby Rinkeby network: pre-configured proof-of-authority test network
--syncmode "fast" Blockchain sync mode ("fast", "full", or "light")
--ethstats value Reporting URL of a ethstats service (nodename:secret@host:port)
--identity value Custom node name
--lightserv value Maximum percentage of time allowed for serving LES requests (0-90) (default: 0)
--lightpeers value Maximum number of LES client peers (default: 20)
--lightkdf Reduce key-derivation RAM & CPU usage at some expense of KDF strength
DEVELOPER CHAIN OPTIONS:
--dev Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled
--dev.period value Block period to use in developer mode (0 = mine only if transaction pending) (default: 0)
ETHASH OPTIONS:
--ethash.cachedir Directory to store the ethash verification caches (default = inside the datadir)
--ethash.cachesinmem value Number of recent ethash caches to keep in memory (16MB each) (default: 2)
--ethash.cachesondisk value Number of recent ethash caches to keep on disk (16MB each) (default: 3)
--ethash.dagdir "/home/karalabe/.ethash" Directory to store the ethash mining DAGs (default = inside home folder)
--ethash.dagsinmem value Number of recent ethash mining DAGs to keep in memory (1+GB each) (default: 1)
--ethash.dagsondisk value Number of recent ethash mining DAGs to keep on disk (1+GB each) (default: 2)
TRANSACTION POOL OPTIONS:
--txpool.nolocals Disables price exemptions for locally submitted transactions
--txpool.journal value Disk journal for local transaction to survive node restarts (default: "transactions.rlp")
--txpool.rejournal value Time interval to regenerate the local transaction journal (default: 1h0m0s)
--txpool.pricelimit value Minimum gas price limit to enforce for acceptance into the pool (default: 1)
--txpool.pricebump value Price bump percentage to replace an already existing transaction (default: 10)
--txpool.accountslots value Minimum number of executable transaction slots guaranteed per account (default: 16)
--txpool.globalslots value Maximum number of executable transaction slots for all accounts (default: 4096)
--txpool.accountqueue value Maximum number of non-executable transaction slots permitted per account (default: 64)
--txpool.globalqueue value Maximum number of non-executable transaction slots for all accounts (default: 1024)
--txpool.lifetime value Maximum amount of time non-executable transaction are queued (default: 3h0m0s)
PERFORMANCE TUNING OPTIONS:
--cache value Megabytes of memory allocated to internal caching (min 16MB / database forced) (default: 128)
--trie-cache-gens value Number of trie node generations to keep in memory (default: 120)
ACCOUNT OPTIONS:
--unlock value Comma separated list of accounts to unlock
--password value Password file to use for non-interactive password input
API AND CONSOLE OPTIONS:
--rpc Enable the HTTP-RPC server
--rpcaddr value HTTP-RPC server listening interface (default: "localhost")
--rpcport value HTTP-RPC server listening port (default: 8545)
--rpcapi value API's offered over the HTTP-RPC interface
--ws Enable the WS-RPC server
--wsaddr value WS-RPC server listening interface (default: "localhost")
--wsport value WS-RPC server listening port (default: 8546)
--wsapi value API's offered over the WS-RPC interface
--wsorigins value Origins from which to accept websockets requests
--ipcdisable Disable the IPC-RPC server
--ipcpath Filename for IPC socket/pipe within the datadir (explicit paths escape it)
--rpccorsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced)
--jspath loadScript JavaScript root path for loadScript (default: ".")
--exec value Execute JavaScript statement
--preload value Comma separated list of JavaScript files to preload into the console
NETWORKING OPTIONS:
--bootnodes value Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)
--bootnodesv4 value Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)
--bootnodesv5 value Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes)
--port value Network listening port (default: 30303)
--maxpeers value Maximum number of network peers (network disabled if set to 0) (default: 25)
--maxpendpeers value Maximum number of pending connection attempts (defaults used if set to 0) (default: 0)
--nat value NAT port mapping mechanism (any|none|upnp|pmp|extip:) (default: "any")
--nodiscover Disables the peer discovery mechanism (manual peer addition)
--v5disc Enables the experimental RLPx V5 (Topic Discovery) mechanism
--netrestrict value Restricts network communication to the given IP networks (CIDR masks)
--nodekey value P2P node key file
--nodekeyhex value P2P node key as hex (for testing)
MINER OPTIONS:
--mine Enable mining
--minerthreads value Number of CPU threads to use for mining (default: 8)
--etherbase value Public address for block mining rewards (default = first account created) (default: "0")
--targetgaslimit value Target gas limit sets the artificial target gas floor for the blocks to mine (default: 4712388)
--gasprice "18000000000" Minimal gas price to accept for mining a transactions
--extradata value Block extra data set by the miner (default = client version)
GAS PRICE ORACLE OPTIONS:
--gpoblocks value Number of recent blocks to check for gas prices (default: 10)
--gpopercentile value Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 50)
VIRTUAL MACHINE OPTIONS:
--vmdebug Record information useful for VM and contract debugging
LOGGING AND DEBUGGING OPTIONS:
--metrics Enable metrics collection and reporting
--fakepow Disables proof-of-work verification
--nocompaction Disables db compaction after import
--verbosity value Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3)
--vmodule value Per-module verbosity: comma-separated list of = (e.g. eth/*=5,p2p=4)
--backtrace value Request a stack trace at a specific logging statement (e.g. "block.go:271")
--debug Prepends log messages with call-site location (file and line number)
--pprof Enable the pprof HTTP server
--pprofaddr value pprof HTTP server listening interface (default: "127.0.0.1")
--pprofport value pprof HTTP server listening port (default: 6060)
--memprofilerate value Turn on memory profiling with the given rate (default: 524288)
--blockprofilerate value Turn on block profiling with the given rate (default: 0)
--cpuprofile value Write CPU profile to the given file
--trace value Write execution trace to the given file
WHISPER (EXPERIMENTAL) OPTIONS:
--shh Enable Whisper
--shh.maxmessagesize value Max message size accepted (default: 1048576)
--shh.pow value Minimum POW accepted (default: 0.2)
DEPRECATED OPTIONS:
--fast Enable fast syncing through state downloads
--light Enable light client mode
MISC OPTIONS:
--help, -h show help
COPYRIGHT:
Copyright 2013-2017 The go-ethereum Authors
复制代码
命令
account 管理账户
attach 启动一个交互式的JavaScript环境,(通过连接到远程节点)
bug 打开一个窗口来反馈bug
console 启动一个交互式的JavaScript环境
copydb 复制一个datadir,需要指定另一个datadir的路径
dump 从区块链上dump指定的区块
dumpconfig 显示配置信息
export 导出区块信息到文件
import 从文件导入区块信息
init 初始化一个新的创世区块
js 执行指定的js文件
license 显示license信息
makecache 生成 ethash验证信息缓存?(用于测试)
makedag 生成ethash挖矿DAG(用于测试)
monitor 监控,显示节点指标
removedb 删除区块链和状态数据库
version 打印版本号
wallet 管理以太坊钱包
help, h 显示所有的命令,和帮助信息
复制代码
以太坊选项
ETHEREUM OPTIONS:
--config value TOML 配置文件
--datadir "/home/karalabe/.ethereum" 制定datadir位置
--keystore 制定keystore位置(默认在datadir里面)
--nousb 关闭监控usb钱包
--networkid value 网络标识符(数字,1=Frontier, 2=Morden (没有使用), 3=Ropsten, 4=Rinkeby)(默认: 1)
--testnet 测试网络: 预设为工作量证明模式的测试网络
--rinkeby 测试网络: 预设为权益证明模式的测试网络
--syncmode "fast" 区块同步模式('fast','full',"light")
--ethstats value ethstats服务器的URL(nodename:secret@host:port)
--identity value 自定义节点名称
--lightserv value 最大允许的轻量级节点服务百分比 requests (0-90) (default: 0)
--lightpeers value 最多允许接入的轻量级节点数量(默认:20
--lightkdf 减少秘钥生成时 内存和cup的使用量?
复制代码
开发者选项
DEVELOPER CHAIN OPTIONS:
--dev 启动一个 权益证明 方式的网络,预先存一笔钱到开发者账户,并且启动挖矿
--dev.period value 区块处理时间?,在开发模式下(0=事务被处理时挖矿) (默认: 0)
复制代码
ETHASH算法相关选项
部分我也了解的不清楚的,以后再翻译,或你们指导下我。
ETHASH OPTIONS:
--ethash.cachedir 存储ethash验证缓存的目录(目录:在datadir里面
--ethash.cachesinmem value ethash 保存在内存中的数量,每16mb(默认2)
--ethash.cachesondisk value 缓存在磁盘的ethash caches的百分比(默认: 3)
--ethash.dagdir "/home/karalabe/.ethash" 存储ethash挖矿DAG的目录地址,默认(home目录)
--ethash.dagsinmem value Number of recent ethash mining DAGs to keep in memory (1+GB each) (default: 1)
--ethash.dagsondisk value Number of recent ethash mining DAGs to keep on disk (1+GB each) (default: 2)
复制代码
事务池相关选项
TRANSACTION POOL OPTIONS:
--txpool.nolocals 禁止对于本地提交的交易的价格豁免
--txpool.journal value 本地事务磁盘日志(用于磁盘重启?)Disk journal for local transaction to survive node restarts (default: "transactions.rlp")
--txpool.rejournal value Time interval to regenerate the local transaction journal (default: 1h0m0s)
--txpool.pricelimit value Minimum gas price limit to enforce for acceptance into the pool (default: 1)
--txpool.pricebump value Price bump percentage to replace an already existing transaction (default: 10)
--txpool.accountslots value Minimum number of executable transaction slots guaranteed per account (default: 16)
--txpool.globalslots value Maximum number of executable transaction slots for all accounts (default: 4096)
--txpool.accountqueue value Maximum number of non-executable transaction slots permitted per account (default: 64)
--txpool.globalqueue value 所有账户最大非执行事务槽数量 (默认: 1024)
--txpool.lifetime value 最大非执行的事务队列时间总量 (默认: 3h0m0s)
复制代码
性能调优选项
PERFORMANCE TUNING OPTIONS:
--cache value 分配多少给内部缓存(兆字节) (最小 16MB / 数据库要求) (默认: 128)
--trie-cache-gens value 保存在内存中的 trie node数量 (默认: 120)
复制代码
账户相关选项
ACCOUNT OPTIONS:
--unlock value 账户解锁,只有这个参数需要交互式输入密码
--password value 账户的密码,非交互式输入
复制代码
控制台API相关选项
API AND CONSOLE OPTIONS:
--rpc 启动http-rpc 服务
--rpcaddr value http rpc 位于哪一个地址(ip) (默认: "localhost")
--rpcport value http rpc 位于哪一个端口 (默认: 8545)
--rpcapi value HTTP-RPC 提供哪些服务(可选:personal,db,eth,net,web3等)
--ws 启动 WS-RPC 服务
--wsaddr value WS-RPC 位于哪一个地址(ip) (默认: "localhost")
--wsport value WS-RPC 位于哪一个端口 (默认: 8546)
--wsapi value API's 提供哪些服务(可选:personal,db,eth,net,web3等)
--wsorigins value 允许哪些域可以以访问websockts服务
--ipcdisable 禁止 IPC-RPC 服务(windows多节点可选)
--ipcpath ipc服务 文件/管道地址 (转译后的)
--rpccorsdomain value prc服务允许的跨域访问的地址。
--jspath loadScript 执行本地js文件的路径 (默认 .)
--exec value 执行JavaScript
--preload value 预加载到控制台的JavaScript文件列表(逗号分隔)
复制代码
网络相关选项
NETWORKING OPTIONS:
--bootnodes value 用于P2P发现引导的节点(启动节点),用逗号隔开(轻量级服务使用v4+v5代替) Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)
--bootnodesv4 value Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)
--bootnodesv5 value Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes)
--port value 网络监听端口 (默认: 30303)
--maxpeers value 最大节点数(设置为0时,网络被禁用)默认25
--maxpendpeers value 最大连接节点数,默认0
--nat value NAT端口映射机制(any|none|upnp|pmp|extip:) (默认: "any")
--nodiscover 禁止节点发现机制(手工添加)
--v5disc Enables the experimental RLPx V5 (Topic Discovery) mechanism
--netrestrict value Restricts network communication to the given IP networks (CIDR masks)
--nodekey value P2P 节点 秘钥文件
--nodekeyhex value 十六进制的P2P节点密钥(用于测试)
复制代码
挖矿相关选项
MINER OPTIONS:
--mine 启动挖矿
--minerthreads value 挖矿时启动的CPU线程数量(默认:8)
--etherbase value 挖矿奖励账户(默认account[0])无账号时默认0
--targetgaslimit value gas限制,低于该值的事务无法被记录 (默认:4712388)
--gasprice "18000000000" 挖矿接受交易的最低gas价格
--extradata value 矿工对区块设置的扩展数据内容,默认客户端版本号
复制代码
GAS价格相关选项
GAS PRICE ORACLE OPTIONS:
--gpoblocks value 通过最近的块数量来计算gas价格 (默认: 10)
--gpopercentile value 参考近期交易区块gas价格的百分比来计算gas价格 (默认: 50)
复制代码
虚拟机相关选项
VIRTUAL MACHINE OPTIONS:
--vmdebug 记录VM和合约相关的debug信息
复制代码
日志和调试相关选项
LOGGING AND DEBUGGING OPTIONS:
--metrics 启动指标收集和报告
--fakepow 关闭POW工作量证明验证
--nocompaction 输入框导入后禁止压缩? Disables db compaction after import
--verbosity value 日志等级 0=安静, 1=错误, 2=警告, 3=info, 4=debug, 5=详细 (默认: 3)
--vmodule value Per-module verbosity: comma-separated list of = (e.g. eth/*=5,p2p=4)
--backtrace value Request a stack trace at a specific logging statement (e.g. "block.go:271")
--debug 突出显示调用位置日志(文件名及行号)
--pprof 启动pprof http服务(一种go语言的调试服务器)
--pprofaddr value pprof HTTP 服务监听ip (默认: "127.0.0.1")
--pprofport value pprof HTTP 服务监听端口 (默认: 6060)
--memprofilerate value Turn on memory profiling with the given rate (default: 524288)
--blockprofilerate value Turn on block profiling with the given rate (default: 0)
--cpuprofile value 将cpuWrite CPU profile to the given file
--trace value 将错误信息写给定的文件中
复制代码
WHISPER相关选项
WHISPER 是一种信息检索协议,它允许节点间直接以一种安全的形式互发信息,并对第三方组织窥探者隐藏发送者和接收者的信息。 引用:
WHISPER (EXPERIMENTAL) OPTIONS:
--shh 启动 Whisper
--shh.maxmessagesize value 最大接收的消息大小 (默认: 1048576)
--shh.pow value 可接受的最小的POW (默认值: 0.2)
复制代码
被弃用的选项
DEPRECATED OPTIONS:
--fast 开启快速同步
--light 启用轻客户端模式
复制代码
帮助和版权
MISC OPTIONS:
--help, -h 显示帮助
COPYRIGHT:
Copyright 2013-2017 The go-ethereum Authors
复制代码
参考了http://www.h3399.cn/201711/201789.html的翻译内容,加上自己的一些理解,无法做到信雅达,但求多交流指正。
Command-Line-Options
以太坊客户端Geth命令用法-参数详解