Skip to content

机器配置

高级配置
CPU: 网络增强型 8 核
内存: 16GB
硬盘: 500GB SSD 固态硬盘
网络: 3M+

中产阶级配置
CPU: 通用型 4 核
内存: 8GB
硬盘: 500GB 高速云盘(机械硬盘)
网络: 1MB (独享)

贫民配置
CPU: 通用型 2 核
内存: 4GB
硬盘: 500GB 高速云盘
网络: 1M

注意:同步时间UTC

同步的时候不怎么吃负载 只吃磁盘跟网络

同步速度看使用的硬盘 以下为本人实测:
服务器 8核16G
AWS m6i
使用gp3磁盘 8K IO 200M读写 每小时同步8000个块

Google Cloud C2-standard-8
便宜的话可以用"平衡的永久性磁盘"
1TB磁盘的情况下 6K IO 240M读写 每小时大约4000-5000个块
SSD与aws速度相同
高级配置
CPU: 网络增强型 8 核
内存: 16GB
硬盘: 500GB SSD 固态硬盘
网络: 3M+

中产阶级配置
CPU: 通用型 4 核
内存: 8GB
硬盘: 500GB 高速云盘(机械硬盘)
网络: 1MB (独享)

贫民配置
CPU: 通用型 2 核
内存: 4GB
硬盘: 500GB 高速云盘
网络: 1M

注意:同步时间UTC

同步的时候不怎么吃负载 只吃磁盘跟网络

同步速度看使用的硬盘 以下为本人实测:
服务器 8核16G
AWS m6i
使用gp3磁盘 8K IO 200M读写 每小时同步8000个块

Google Cloud C2-standard-8
便宜的话可以用"平衡的永久性磁盘"
1TB磁盘的情况下 6K IO 240M读写 每小时大约4000-5000个块
SSD与aws速度相同

WARNING

注意:由于现在公网上eth的块有1T数据量

1. 配置 go 语言运行环境

https://golang.org/dl/

wget https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz

# 解压
tar xvpzf go1.13.1.linux-amd64.tar.gz

# 安装
mv go /usr/local/
sudo ln -s /usr/local/go/bin/go /usr/local/bin/
https://golang.org/dl/

wget https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz

# 解压
tar xvpzf go1.13.1.linux-amd64.tar.gz

# 安装
mv go /usr/local/
sudo ln -s /usr/local/go/bin/go /usr/local/bin/

2. 源码安装 geth

采用编译以太坊官方的源码来安装, 我安装的时候最新版本是 v1.8.17, 大家具体根据自己情况下载对应的版本,下载地址:https://github.com/ethereum/go-ethereum/tags

wget https://github.com/ethereum/go-ethereum/archive/v1.8.17.tar.gz
# 解压
tar xvpzf v1.8.17.tar.gz
mv go-ethereum-1.8.17 /usr/local/go-ethereum
cd /usr/local/go-ethereum
make all
wget https://github.com/ethereum/go-ethereum/archive/v1.8.17.tar.gz
# 解压
tar xvpzf v1.8.17.tar.gz
mv go-ethereum-1.8.17 /usr/local/go-ethereum
cd /usr/local/go-ethereum
make all

编译完成之后在 build/bin 目录下会生成很多可执行文件,geth 就是其中一个

2.1 二进制

# 查看下载页面最新版
# https://ethereum.github.io/go-ethereum/downloads/

#下载
cd /opt
Version=1.8.20-24d727b6
wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-${Version}.tar.gz

#解压安装
tar zxf geth-linux-amd64-${Version}.tar.gz
rm -f geth-linux-amd64-${Version}.tar.gz
rm -rf /opt/geth
ln -fs /opt/geth-linux-amd64-${Version} /opt/geth
ln -fs /opt/geth-linux-amd64-${Version}/geth  /usr/local/bin/

#检查
geth version
# 查看下载页面最新版
# https://ethereum.github.io/go-ethereum/downloads/

#下载
cd /opt
Version=1.8.20-24d727b6
wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-${Version}.tar.gz

#解压安装
tar zxf geth-linux-amd64-${Version}.tar.gz
rm -f geth-linux-amd64-${Version}.tar.gz
rm -rf /opt/geth
ln -fs /opt/geth-linux-amd64-${Version} /opt/geth
ln -fs /opt/geth-linux-amd64-${Version}/geth  /usr/local/bin/

#检查
geth version

或者下载二进制 https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.6-bd059680.tar.gz

3. 配置环境变量

编辑 /etc/profile 文件,添加 geth 和 go 语言的环境变量

GOROOT=/usr/local/go

PATH="/usr/local/go/bin:/usr/local/go-ethereum/build/bin:$PATH"
GOROOT=/usr/local/go

PATH="/usr/local/go/bin:/usr/local/go-ethereum/build/bin:$PATH"

4.启动

mkdir /data/coin
/data/apps/eth/geth --rpc --rpcport 8545 --rpcapi web3,db,eth,net,personal --rpcaddr=172.31.39.1  --datadir /data/coin/eth --maxpeers 100

或者
nohup geth --syncmode "fast" --networkid 1 --datadir /data --cache 2048 --identity "ddblock" --rpc --rpcapi "db,eth,net,web3" --rpccorsdomain "*" --rpcport 8545 --port 30303 --rpcaddr 127.0.0.1  & > nohup.out

#online
nohup /data/apps/eth/geth  --allow-insecure-unlock --rpc --port 8546 --rpcport 8545 --rpcapi web3,db,eth,net,personal --rpcaddr=172.31.34.215 --datadir /data/coin/eth --maxpeers 101 --cache 1024 --rpc.allow-unprotected-txs &


默认date目录在 ~/.ethereum/
mkdir /data/coin
/data/apps/eth/geth --rpc --rpcport 8545 --rpcapi web3,db,eth,net,personal --rpcaddr=172.31.39.1  --datadir /data/coin/eth --maxpeers 100

或者
nohup geth --syncmode "fast" --networkid 1 --datadir /data --cache 2048 --identity "ddblock" --rpc --rpcapi "db,eth,net,web3" --rpccorsdomain "*" --rpcport 8545 --port 30303 --rpcaddr 127.0.0.1  & > nohup.out

#online
nohup /data/apps/eth/geth  --allow-insecure-unlock --rpc --port 8546 --rpcport 8545 --rpcapi web3,db,eth,net,personal --rpcaddr=172.31.34.215 --datadir /data/coin/eth --maxpeers 101 --cache 1024 --rpc.allow-unprotected-txs &


默认date目录在 ~/.ethereum/

高本版启动方式

#1.10.13
nohup /data/apps/eth/geth  --allow-insecure-unlock  --http --http.port 8546 --http.port 8545 --http.api web3,eth,net,personal --http.addr=172.31.34.215 --datadir /data/coin/eth --maxpeers 101 --cache 1024 --rpc.allow-unprotected-txs &
#1.10.13
nohup /data/apps/eth/geth  --allow-insecure-unlock  --http --http.port 8546 --http.port 8545 --http.api web3,eth,net,personal --http.addr=172.31.34.215 --datadir /data/coin/eth --maxpeers 101 --cache 1024 --rpc.allow-unprotected-txs &

4.1 参数进行简单解释

参数描述
--syncmode同步模式,有三种fast ,full,light
--networkid网络ID(整型, 1=Main, 2=Morden (弃用), 3=Ropsten, 4=Rinkeby) 这里我们使用默认值 1 表示同步主网的数据
--datadir钱包以及区块数据等存储目录,这个建议单独使用数据盘,不要指定系统盘的文件夹
--identity节点标识符
--rpc开启 RPC 服务
--rpcapi开放那些 API 给 JSONRPC 调用,默认 personal 工具是不开放的
--rpccorsdomainRPC 调用跨域限制,*号标识不限制
--rpcportJSONRPC 服务监控的端口
--port同步服务端口
--cache调整内存分配 最小16MB,默认128MB
--rpcaddr可以调用 RPC 服务的IP地址,我这里只允许本地调用,不开放给其他用户,如果你想做成 Infura 那样作为公开的 API 的话,可以设置成 0.0.0.0
--ws开启 WS-RPC 服务
--wsaddr指定WS-RPC 服务监听地址,默认为 “localhost”
--wsport指定 WS-RPC 服务监听端口,默认值:8546
--wsapi指定WS-RPC 开启API,默认为 “eth,net,web3”
--wsorigins指定允许“websockets”请求的地址
--maxpeers设置允许最大连接节点数目,默认为25

WARNING

nohup {cmd} & > nohup.out

注意:在已经进行过正常区块同步的链上,不要使用该命令,也就是说,使用该选项必须从区块同步最初开始,当同步到最新区块后,可以正常同步区块,下次启动时就可以不用输入次选项,区块高度也会达到快速同步高度

  • 目录介绍
[root@eth eth]# ls /data/coin/eth/
geth  geth.ipc  keystore

    geth, 用于存储公链的数据
    keystore, 用于存储秘钥
    geth.ipc=, 启动时产生一个文件
[root@eth eth]# ls /data/coin/eth/
geth  geth.ipc  keystore

    geth, 用于存储公链的数据
    keystore, 用于存储秘钥
    geth.ipc=, 启动时产生一个文件

5.关闭

#!/bin/sh
pid=`ps -ef|grep geth|grep -v grep|awk '{print $2}'`
echo $pid
kill -INT $pid
#!/bin/sh
pid=`ps -ef|grep geth|grep -v grep|awk '{print $2}'`
echo $pid
kill -INT $pid

kill -INT $pid将“中断”信号发送到具有进程ID的进程pid。然而,该过程可以决定忽略该信号,或者在退出和/或忽略它之前捕获信号并做某事

kill -9 $pid发送无法捕获或忽略的“kill”信号。该过程将被强制关闭,不会通知该过程,也没有机会进行任何清理

6.进入节点 javascript 终端

[root@eth eth]# ./geth attach /data/coin/eth/geth.ipc 
Welcome to the Geth JavaScript console!

instance: Geth/v1.9.6-stable-bd059680/linux-amd64/go1.13.1
at block: 0 (Thu, 01 Jan 1970 08:00:00 CST)
 datadir: /data/coin/eth
 modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> 
命令行支持的API,这个可以在启动参数上设置
admin:1.0 
debug:1.0 
eth:1.0 
ethash:1.0 
miner:1.0 
net:1.0 
personal:1.0 
rpc:1.0 
txpool:1.0 
web3:1.0

以下方式进入,参数比较少
[root@eth eth]# ./geth attach rpc:http://172.31.171.255:8545
Welcome to the Geth JavaScript console!

instance: Geth/v1.9.6-stable-bd059680/linux-amd64/go1.13.1
at block: 0 (Thu, 01 Jan 1970 08:00:00 CST)
 datadir: /data/coin/eth
 modules: admin:1.0 eth:1.0 net:1.0 personal:1.0 rpc:1.0 web3:1.0
[root@eth eth]# ./geth attach /data/coin/eth/geth.ipc 
Welcome to the Geth JavaScript console!

instance: Geth/v1.9.6-stable-bd059680/linux-amd64/go1.13.1
at block: 0 (Thu, 01 Jan 1970 08:00:00 CST)
 datadir: /data/coin/eth
 modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> 
命令行支持的API,这个可以在启动参数上设置
admin:1.0 
debug:1.0 
eth:1.0 
ethash:1.0 
miner:1.0 
net:1.0 
personal:1.0 
rpc:1.0 
txpool:1.0 
web3:1.0

以下方式进入,参数比较少
[root@eth eth]# ./geth attach rpc:http://172.31.171.255:8545
Welcome to the Geth JavaScript console!

instance: Geth/v1.9.6-stable-bd059680/linux-amd64/go1.13.1
at block: 0 (Thu, 01 Jan 1970 08:00:00 CST)
 datadir: /data/coin/eth
 modules: admin:1.0 eth:1.0 net:1.0 personal:1.0 rpc:1.0 web3:1.0

6.1查看当前同步状态

> eth.syncing
{
  currentBlock: 6143193,
  highestBlock: 6143296,
  knownStates: 91512910,
  pulledStates: 91498893,
  startingBlock: 0
}

解释:
- startingBlock:开始同步的起始区块编号; 
- currentBlock:当前正在导入的区块编号; 
- highestBlock:通过所链接的节点获得的当前最高的区块高度; 
- pulledStates:当前已经拉取的状态条目数; 
- knownStates:当前已知的待拉取的总状态条目数

#或者查看高度
echo $((`curl -s -X POST -H "Content-Type":application/json --data  '{"jsonrpc":"2.0", "method":"eth_blockNumber","params":[],"id":67}' 172.31.34.215:8545 |awk -F'"' '{print $(NF-1)}'`))查看高度
> eth.syncing
{
  currentBlock: 6143193,
  highestBlock: 6143296,
  knownStates: 91512910,
  pulledStates: 91498893,
  startingBlock: 0
}

解释:
- startingBlock:开始同步的起始区块编号; 
- currentBlock:当前正在导入的区块编号; 
- highestBlock:通过所链接的节点获得的当前最高的区块高度; 
- pulledStates:当前已经拉取的状态条目数; 
- knownStates:当前已知的待拉取的总状态条目数

#或者查看高度
echo $((`curl -s -X POST -H "Content-Type":application/json --data  '{"jsonrpc":"2.0", "method":"eth_blockNumber","params":[],"id":67}' 172.31.34.215:8545 |awk -F'"' '{print $(NF-1)}'`))查看高度

这里有个坑就是,你会发现你每次执行 eth.syncing 命令的时候 currentBlock 和 highestBlock 都只相差几百,以为马上就要同步完了,只有几百个区块了。 其实你还只是同步了一小部分。这个是正常现象,因为我们使用了 --fast 选项,所以开始只同步了区块头,它还要慢慢的去同步区块 Body.

另外在同步的过程中我们通过 eth.blockNumber 去查看当前区块号的话会显示为 0

> eth.blockNumber
0

eth.blockNumber获得的返回结果为0
原因:
在Geth1.6和1.7客户端中默认使用快速(fast)同步,因此在同步的过程中节点只下载最近的状态,中间区块的状态是不可用的。因此,直到同步完成,最新的完整块都为0,因为所有比较新的块在同步期间是不完整的。当快速同步完成时,它会下载头部的关联状态,此时头部块完整,最新的块可以关联到当前的头部。简单来说就是在快速同步的过程中,需要构建一个头部信息,如果此信息为构建完成,通过上面的接口查询到的结果就是0。当同步完成,后续就不会再出现此问题
> eth.blockNumber
0

eth.blockNumber获得的返回结果为0
原因:
在Geth1.6和1.7客户端中默认使用快速(fast)同步,因此在同步的过程中节点只下载最近的状态,中间区块的状态是不可用的。因此,直到同步完成,最新的完整块都为0,因为所有比较新的块在同步期间是不完整的。当快速同步完成时,它会下载头部的关联状态,此时头部块完整,最新的块可以关联到当前的头部。简单来说就是在快速同步的过程中,需要构建一个头部信息,如果此信息为构建完成,通过上面的接口查询到的结果就是0。当同步完成,后续就不会再出现此问题

6.2节点连接个数

> net.peerCount
32
> net.peerCount
32

6.4 pull 完成

#说明没有在同步数据
eth.blockNumber = 0 eth.syncing = false, 

#证明正在同步中
eth.blockNumber = 0 eth.syncing = {currentBlock: 490891,highestBlock: 9702028,knownStates: 975641,pulledStates: 953009,startingBlock: 0}


#出现如下结果,块才能使用
如果你通过 eth.syncing 返回的是 false 的,或者 eth.blockNumber 返回的是大于 0 的整数的话,如下
> eth.blockNumber
6712841
> eth.syncing
false
#说明没有在同步数据
eth.blockNumber = 0 eth.syncing = false, 

#证明正在同步中
eth.blockNumber = 0 eth.syncing = {currentBlock: 490891,highestBlock: 9702028,knownStates: 975641,pulledStates: 953009,startingBlock: 0}


#出现如下结果,块才能使用
如果你通过 eth.syncing 返回的是 false 的,或者 eth.blockNumber 返回的是大于 0 的整数的话,如下
> eth.blockNumber
6712841
> eth.syncing
false

那么 Congratulations, 同步已经完成,你就可以开始调用钱包 API 转账了

Imported new block headers 导入区块的头部
Imported new block receipts 导入区块的凭据
Imported new state entries 导入区块的结构
Imported new block headers 导入区块的头部
Imported new block receipts 导入区块的凭据
Imported new state entries 导入区块的结构

7.控制端

geth attach ipc://mnt/.ethereum/geth.ipc (根据个人路径定制)

自己的全部信息
$ admin.nodeInfo

# 获取当前节点的 ID 和端口
$ admin.nodeInfo.id
$ admin.nodeInfo.ports.listener

#添加节点 
$ admin.addPeer("enode://xxx@47.52.16.149:30303")
true #返回true

#查看连接的节点
$ admin.peers

#连接数量
$ net.peerCount

#是否是监听节点
$ net.listening

# 退出命令行界面
$ exit
自己的全部信息
$ admin.nodeInfo

# 获取当前节点的 ID 和端口
$ admin.nodeInfo.id
$ admin.nodeInfo.ports.listener

#添加节点 
$ admin.addPeer("enode://xxx@47.52.16.149:30303")
true #返回true

#查看连接的节点
$ admin.peers

#连接数量
$ net.peerCount

#是否是监听节点
$ net.listening

# 退出命令行界面
$ exit

8.账户

# 查看我的账户 
> eth.accounts
[]

# 新建一个账户
> personal.newAccount("test.dan")
"0x377410e6b50762a51d54d9f26830e60124072f35"

# 再查看我的账户
> eth.accounts
["0x377410e6b50762a51d54d9f26830e60124072f35"]

# 查看账号余额
> eth.getBalance(eth.accounts[0])
0
# 查看我的账户 
> eth.accounts
[]

# 新建一个账户
> personal.newAccount("test.dan")
"0x377410e6b50762a51d54d9f26830e60124072f35"

# 再查看我的账户
> eth.accounts
["0x377410e6b50762a51d54d9f26830e60124072f35"]

# 查看账号余额
> eth.getBalance(eth.accounts[0])
0

9.高版本语法,1.10.20

官方文档,https://geth.ethereum.org/docs/getting-started

默认同步模式是snap

$ geth --help
NAME:
   geth - the go-ethereum command line interface

   Copyright 2013-2022 The go-ethereum Authors

USAGE:
   geth [options] [command] [command options] [arguments...]

VERSION:
   1.10.19-stable-23bee162

COMMANDS:
   account                            Manage accounts
   attach                             Start an interactive JavaScript environment (connect to node)
   console                            Start an interactive JavaScript environment
   db                                 Low level database operations
   dump                               Dump a specific block from storage
   dumpconfig                         Show configuration values
   dumpgenesis                        Dumps genesis block JSON configuration to stdout
   export                             Export blockchain into file
   export-preimages                   Export the preimage database into an RLP stream
   import                             Import a blockchain file
   import-preimages                   Import the preimage database from an RLP stream
   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)
   removedb                           Remove blockchain and state databases
   show-deprecated-flags              Show flags that have been deprecated
   snapshot                           A set of commands based on the snapshot
   version                            Print version numbers
   version-check                      Checks (online) whether the current version suffers from any known security vulnerabilities
   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.minfreedisk value         Minimum free disk space in MB, once reached triggers auto shut down (default = --cache.gc converted to MB, 0 = disabled)
  --keystore value                    Directory for the keystore (default = inside the datadir)
  --usb                               Enable monitoring and management of USB hardware wallets
  --pcscdpath value                   Path to the smartcard daemon (pcscd) socket file
  --networkid value                   Explicitly set network id (integer)(For testnets: use --ropsten, --rinkeby, --goerli instead) (default: 1)
  --syncmode value                    Blockchain sync mode ("snap", "full" or "light") (default: snap)
  --exitwhensynced                    Exits after block synchronisation completes
  --gcmode value                      Blockchain garbage collection mode ("full", "archive") (default: "full")
  --txlookuplimit value               Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (default: 2350000)
  --ethstats value                    Reporting URL of a ethstats service (nodename:secret@host:port)
  --identity value                    Custom node name
  --lightkdf                          Reduce key-derivation RAM & CPU usage at some expense of KDF strength
  --eth.requiredblocks value          Comma separated block number-to-hash mappings to require for peering (<number>=<hash>)
  --mainnet                           Ethereum mainnet
  --ropsten                           Ropsten network: pre-configured proof-of-stake test network
  --rinkeby                           Rinkeby network: pre-configured proof-of-authority test network
  --goerli                            Görli network: pre-configured proof-of-authority test network
  --sepolia                           Sepolia network: pre-configured proof-of-work test network
  --kiln                              Kiln network: pre-configured proof-of-work to proof-of-stake test network
  --datadir value                     Data directory for the databases and keystore (default: "~/.ethereum")
  --datadir.ancient value             Data directory for ancient chain segments (default = inside chaindata)
  --remotedb value                    URL for remote database

LIGHT CLIENT OPTIONS:
  --light.serve value                 Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100) (default: 0)
  --light.ingress value               Incoming bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0)
  --light.egress value                Outgoing bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0)
  --light.maxpeers value              Maximum number of light clients to serve, or light servers to attach to (default: 100)
  --ulc.servers value                 List of trusted ultra-light servers
  --ulc.fraction value                Minimum % of trusted ultra-light servers required to announce a new head (default: 75)
  --ulc.onlyannounce                  Ultra light server sends announcements only
  --light.nopruning                   Disable ancient light chain data pruning
  --light.nosyncserve                 Enables serving light clients before syncing
  
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)
  --dev.gaslimit value                Initial block gas limit (default: 11500000)

ETHASH OPTIONS:
  --ethash.cachedir value             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.cacheslockmmap             Lock memory maps of recent ethash caches
  --ethash.dagdir value               Directory to store the ethash mining DAGs (default: "~/.ethash")
  --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)
  --ethash.dagslockmmap               Lock memory maps for recent ethash mining DAGs

TRANSACTION POOL OPTIONS:
  --txpool.locals value               Comma separated accounts to treat as locals (no flush, priority inclusion)
  --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: 5120)
  --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 (default = 4096 mainnet full node, 128 light mode) (default: 1024)
  --cache.database value              Percentage of cache memory allowance to use for database io (default: 50)
  --cache.trie value                  Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode) (default: 15)
  --cache.trie.journal value          Disk journal directory for trie cache to survive node restarts (default: "triecache")
  --cache.trie.rejournal value        Time interval to regenerate the trie cache journal (default: 1h0m0s)
  --cache.gc value                    Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode) (default: 25)
  --cache.snapshot value              Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode) (default: 10)
  --cache.noprefetch                  Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)
  --cache.preimages                   Enable recording the SHA3/keccak preimages of trie keys
  --fdlimit value                     Raise the open file descriptor resource limit (default = system fd limit) (default: 0)

ACCOUNT OPTIONS:
  --unlock value                      Comma separated list of accounts to unlock
  --password value                    Password file to use for non-interactive password input
  --signer value                      External signer (url or path to ipc file)
  --allow-insecure-unlock             Allow insecure account unlocking when account-related RPCs are exposed by http

API AND CONSOLE OPTIONS:
  --ipcdisable                        Disable the IPC-RPC server
  --ipcpath value                     Filename for IPC socket/pipe within the datadir (explicit paths escape it)
  --http                              Enable the HTTP-RPC server
  --http.addr value                   HTTP-RPC server listening interface (default: "localhost")
  --http.port value                   HTTP-RPC server listening port (default: 8545)
  --http.api value                    API's offered over the HTTP-RPC interface
  --http.rpcprefix value              HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
  --http.corsdomain value             Comma separated list of domains from which to accept cross origin requests (browser enforced)
  --http.vhosts value                 Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --ws                                Enable the WS-RPC server
  --ws.addr value                     WS-RPC server listening interface (default: "localhost")
  --ws.port value                     WS-RPC server listening port (default: 8546)
  --ws.api value                      API's offered over the WS-RPC interface
  --ws.rpcprefix value                HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
  --ws.origins value                  Origins from which to accept websockets requests
  --authrpc.jwtsecret value           Path to a JWT secret to use for authenticated RPC endpoints
  --authrpc.addr value                Listening address for authenticated APIs (default: "localhost")
  --authrpc.port value                Listening port for authenticated APIs (default: 8551)
  --authrpc.vhosts value              Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --graphql                           Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.
  --graphql.corsdomain value          Comma separated list of domains from which to accept cross origin requests (browser enforced)
  --graphql.vhosts value              Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --rpc.gascap value                  Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) (default: 50000000)
  --rpc.evmtimeout value              Sets a timeout used for eth_call (0=infinite) (default: 5s)
  --rpc.txfeecap value                Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 1)
  --rpc.allow-unprotected-txs         Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC
  --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
  --discovery.dns value               Sets DNS discovery entry points (use "" to disable DNS)
  --port value                        Network listening port (default: 30303)
  --maxpeers value                    Maximum number of network peers (network disabled if set to 0) (default: 50)
  --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:<IP>) (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
  --miner.threads value               Number of CPU threads to use for mining (default: 0)
  --miner.notify value                Comma separated HTTP URL list to notify of new work packages
  --miner.notify.full                 Notify with pending block headers instead of work packages
  --miner.gasprice value              Minimum gas price for mining a transaction (default: 1000000000)
  --miner.gaslimit value              Target gas ceiling for mined blocks (default: 30000000)
  --miner.etherbase value             Public address for block mining rewards (default = first account) (default: "0")
  --miner.extradata value             Block extra data set by the miner (default = client version)
  --miner.recommit value              Time interval to recreate the block being mined (default: 3s)
  --miner.noverify                    Disable remote sealing verification

GAS PRICE ORACLE OPTIONS:
  --gpo.blocks value                  Number of recent blocks to check for gas prices (default: 20)
  --gpo.percentile value              Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 60)
  --gpo.maxprice value                Maximum transaction priority fee (or gasprice before London fork) to be recommended by gpo (default: 500000000000)
  --gpo.ignoreprice value             Gas price below which gpo will ignore transactions (default: 2)

VIRTUAL MACHINE OPTIONS:
  --vmdebug                           Record information useful for VM and contract debugging

LOGGING AND DEBUGGING OPTIONS:
  --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 <pattern>=<level> (e.g. eth/*=5,p2p=4)
  --log.json                          Format logs with JSON
  --log.backtrace value               Request a stack trace at a specific logging statement (e.g. "block.go:271")
  --log.debug                         Prepends log messages with call-site location (file and line number)
  --pprof                             Enable the pprof HTTP server
  --pprof.addr value                  pprof HTTP server listening interface (default: "127.0.0.1")
  --pprof.port value                  pprof HTTP server listening port (default: 6060)
  --pprof.memprofilerate value        Turn on memory profiling with the given rate (default: 524288)
  --pprof.blockprofilerate value      Turn on block profiling with the given rate (default: 0)
  --pprof.cpuprofile value            Write CPU profile to the given file
  --trace value                       Write execution trace to the given file

METRICS AND STATS OPTIONS:
  --metrics                              Enable metrics collection and reporting
  --metrics.expensive                    Enable expensive metrics collection and reporting
  --metrics.addr value                   Enable stand-alone metrics HTTP server listening interface (default: "127.0.0.1")
  --metrics.port value                   Metrics HTTP server listening port (default: 6060)
  --metrics.influxdb                     Enable metrics export/push to an external InfluxDB database
  --metrics.influxdb.endpoint value      InfluxDB API endpoint to report metrics to (default: "http://localhost:8086")
  --metrics.influxdb.database value      InfluxDB database name to push reported metrics to (default: "geth")
  --metrics.influxdb.username value      Username to authorize access to the database (default: "test")
  --metrics.influxdb.password value      Password to authorize access to the database (default: "test")
  --metrics.influxdb.tags value          Comma-separated InfluxDB tags (key/values) attached to all measurements (default: "host=localhost")
  --metrics.influxdbv2                   Enable metrics export/push to an external InfluxDB v2 database
  --metrics.influxdb.token value         Token to authorize access to the database (v2 only) (default: "test")
  --metrics.influxdb.bucket value        InfluxDB bucket name to push reported metrics to (v2 only) (default: "geth")
  --metrics.influxdb.organization value  InfluxDB organization name (v2 only) (default: "geth")

ALIASED (deprecated) OPTIONS:
  --nousb                             Disables monitoring for and managing USB hardware wallets (deprecated)
  --whitelist value                   Comma separated block number-to-hash mappings to enforce (<number>=<hash>) (deprecated in favor of --eth.requiredblocks)

MISC OPTIONS:
  --snapshot                                Enables snapshot-database mode (default = enable)
  --bloomfilter.size value                  Megabytes of memory allocated to bloom-filter for pruning (default: 2048)
  --ignore-legacy-receipts                  Geth will start up even if there are legacy receipts in freezer
  --help, -h                                show help
  --override.grayglacier value              Manually specify Gray Glacier fork-block, overriding the bundled setting (default: 0)
  --override.terminaltotaldifficulty value  Manually specify TerminalTotalDifficulty, overriding the bundled setting (default: <nil>)


COPYRIGHT:
   Copyright 2013-2022 The go-ethereum Authors
$ geth --help
NAME:
   geth - the go-ethereum command line interface

   Copyright 2013-2022 The go-ethereum Authors

USAGE:
   geth [options] [command] [command options] [arguments...]

VERSION:
   1.10.19-stable-23bee162

COMMANDS:
   account                            Manage accounts
   attach                             Start an interactive JavaScript environment (connect to node)
   console                            Start an interactive JavaScript environment
   db                                 Low level database operations
   dump                               Dump a specific block from storage
   dumpconfig                         Show configuration values
   dumpgenesis                        Dumps genesis block JSON configuration to stdout
   export                             Export blockchain into file
   export-preimages                   Export the preimage database into an RLP stream
   import                             Import a blockchain file
   import-preimages                   Import the preimage database from an RLP stream
   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)
   removedb                           Remove blockchain and state databases
   show-deprecated-flags              Show flags that have been deprecated
   snapshot                           A set of commands based on the snapshot
   version                            Print version numbers
   version-check                      Checks (online) whether the current version suffers from any known security vulnerabilities
   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.minfreedisk value         Minimum free disk space in MB, once reached triggers auto shut down (default = --cache.gc converted to MB, 0 = disabled)
  --keystore value                    Directory for the keystore (default = inside the datadir)
  --usb                               Enable monitoring and management of USB hardware wallets
  --pcscdpath value                   Path to the smartcard daemon (pcscd) socket file
  --networkid value                   Explicitly set network id (integer)(For testnets: use --ropsten, --rinkeby, --goerli instead) (default: 1)
  --syncmode value                    Blockchain sync mode ("snap", "full" or "light") (default: snap)
  --exitwhensynced                    Exits after block synchronisation completes
  --gcmode value                      Blockchain garbage collection mode ("full", "archive") (default: "full")
  --txlookuplimit value               Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (default: 2350000)
  --ethstats value                    Reporting URL of a ethstats service (nodename:secret@host:port)
  --identity value                    Custom node name
  --lightkdf                          Reduce key-derivation RAM & CPU usage at some expense of KDF strength
  --eth.requiredblocks value          Comma separated block number-to-hash mappings to require for peering (<number>=<hash>)
  --mainnet                           Ethereum mainnet
  --ropsten                           Ropsten network: pre-configured proof-of-stake test network
  --rinkeby                           Rinkeby network: pre-configured proof-of-authority test network
  --goerli                            Görli network: pre-configured proof-of-authority test network
  --sepolia                           Sepolia network: pre-configured proof-of-work test network
  --kiln                              Kiln network: pre-configured proof-of-work to proof-of-stake test network
  --datadir value                     Data directory for the databases and keystore (default: "~/.ethereum")
  --datadir.ancient value             Data directory for ancient chain segments (default = inside chaindata)
  --remotedb value                    URL for remote database

LIGHT CLIENT OPTIONS:
  --light.serve value                 Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100) (default: 0)
  --light.ingress value               Incoming bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0)
  --light.egress value                Outgoing bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0)
  --light.maxpeers value              Maximum number of light clients to serve, or light servers to attach to (default: 100)
  --ulc.servers value                 List of trusted ultra-light servers
  --ulc.fraction value                Minimum % of trusted ultra-light servers required to announce a new head (default: 75)
  --ulc.onlyannounce                  Ultra light server sends announcements only
  --light.nopruning                   Disable ancient light chain data pruning
  --light.nosyncserve                 Enables serving light clients before syncing
  
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)
  --dev.gaslimit value                Initial block gas limit (default: 11500000)

ETHASH OPTIONS:
  --ethash.cachedir value             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.cacheslockmmap             Lock memory maps of recent ethash caches
  --ethash.dagdir value               Directory to store the ethash mining DAGs (default: "~/.ethash")
  --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)
  --ethash.dagslockmmap               Lock memory maps for recent ethash mining DAGs

TRANSACTION POOL OPTIONS:
  --txpool.locals value               Comma separated accounts to treat as locals (no flush, priority inclusion)
  --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: 5120)
  --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 (default = 4096 mainnet full node, 128 light mode) (default: 1024)
  --cache.database value              Percentage of cache memory allowance to use for database io (default: 50)
  --cache.trie value                  Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode) (default: 15)
  --cache.trie.journal value          Disk journal directory for trie cache to survive node restarts (default: "triecache")
  --cache.trie.rejournal value        Time interval to regenerate the trie cache journal (default: 1h0m0s)
  --cache.gc value                    Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode) (default: 25)
  --cache.snapshot value              Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode) (default: 10)
  --cache.noprefetch                  Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)
  --cache.preimages                   Enable recording the SHA3/keccak preimages of trie keys
  --fdlimit value                     Raise the open file descriptor resource limit (default = system fd limit) (default: 0)

ACCOUNT OPTIONS:
  --unlock value                      Comma separated list of accounts to unlock
  --password value                    Password file to use for non-interactive password input
  --signer value                      External signer (url or path to ipc file)
  --allow-insecure-unlock             Allow insecure account unlocking when account-related RPCs are exposed by http

API AND CONSOLE OPTIONS:
  --ipcdisable                        Disable the IPC-RPC server
  --ipcpath value                     Filename for IPC socket/pipe within the datadir (explicit paths escape it)
  --http                              Enable the HTTP-RPC server
  --http.addr value                   HTTP-RPC server listening interface (default: "localhost")
  --http.port value                   HTTP-RPC server listening port (default: 8545)
  --http.api value                    API's offered over the HTTP-RPC interface
  --http.rpcprefix value              HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
  --http.corsdomain value             Comma separated list of domains from which to accept cross origin requests (browser enforced)
  --http.vhosts value                 Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --ws                                Enable the WS-RPC server
  --ws.addr value                     WS-RPC server listening interface (default: "localhost")
  --ws.port value                     WS-RPC server listening port (default: 8546)
  --ws.api value                      API's offered over the WS-RPC interface
  --ws.rpcprefix value                HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
  --ws.origins value                  Origins from which to accept websockets requests
  --authrpc.jwtsecret value           Path to a JWT secret to use for authenticated RPC endpoints
  --authrpc.addr value                Listening address for authenticated APIs (default: "localhost")
  --authrpc.port value                Listening port for authenticated APIs (default: 8551)
  --authrpc.vhosts value              Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --graphql                           Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.
  --graphql.corsdomain value          Comma separated list of domains from which to accept cross origin requests (browser enforced)
  --graphql.vhosts value              Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --rpc.gascap value                  Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) (default: 50000000)
  --rpc.evmtimeout value              Sets a timeout used for eth_call (0=infinite) (default: 5s)
  --rpc.txfeecap value                Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 1)
  --rpc.allow-unprotected-txs         Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC
  --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
  --discovery.dns value               Sets DNS discovery entry points (use "" to disable DNS)
  --port value                        Network listening port (default: 30303)
  --maxpeers value                    Maximum number of network peers (network disabled if set to 0) (default: 50)
  --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:<IP>) (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
  --miner.threads value               Number of CPU threads to use for mining (default: 0)
  --miner.notify value                Comma separated HTTP URL list to notify of new work packages
  --miner.notify.full                 Notify with pending block headers instead of work packages
  --miner.gasprice value              Minimum gas price for mining a transaction (default: 1000000000)
  --miner.gaslimit value              Target gas ceiling for mined blocks (default: 30000000)
  --miner.etherbase value             Public address for block mining rewards (default = first account) (default: "0")
  --miner.extradata value             Block extra data set by the miner (default = client version)
  --miner.recommit value              Time interval to recreate the block being mined (default: 3s)
  --miner.noverify                    Disable remote sealing verification

GAS PRICE ORACLE OPTIONS:
  --gpo.blocks value                  Number of recent blocks to check for gas prices (default: 20)
  --gpo.percentile value              Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 60)
  --gpo.maxprice value                Maximum transaction priority fee (or gasprice before London fork) to be recommended by gpo (default: 500000000000)
  --gpo.ignoreprice value             Gas price below which gpo will ignore transactions (default: 2)

VIRTUAL MACHINE OPTIONS:
  --vmdebug                           Record information useful for VM and contract debugging

LOGGING AND DEBUGGING OPTIONS:
  --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 <pattern>=<level> (e.g. eth/*=5,p2p=4)
  --log.json                          Format logs with JSON
  --log.backtrace value               Request a stack trace at a specific logging statement (e.g. "block.go:271")
  --log.debug                         Prepends log messages with call-site location (file and line number)
  --pprof                             Enable the pprof HTTP server
  --pprof.addr value                  pprof HTTP server listening interface (default: "127.0.0.1")
  --pprof.port value                  pprof HTTP server listening port (default: 6060)
  --pprof.memprofilerate value        Turn on memory profiling with the given rate (default: 524288)
  --pprof.blockprofilerate value      Turn on block profiling with the given rate (default: 0)
  --pprof.cpuprofile value            Write CPU profile to the given file
  --trace value                       Write execution trace to the given file

METRICS AND STATS OPTIONS:
  --metrics                              Enable metrics collection and reporting
  --metrics.expensive                    Enable expensive metrics collection and reporting
  --metrics.addr value                   Enable stand-alone metrics HTTP server listening interface (default: "127.0.0.1")
  --metrics.port value                   Metrics HTTP server listening port (default: 6060)
  --metrics.influxdb                     Enable metrics export/push to an external InfluxDB database
  --metrics.influxdb.endpoint value      InfluxDB API endpoint to report metrics to (default: "http://localhost:8086")
  --metrics.influxdb.database value      InfluxDB database name to push reported metrics to (default: "geth")
  --metrics.influxdb.username value      Username to authorize access to the database (default: "test")
  --metrics.influxdb.password value      Password to authorize access to the database (default: "test")
  --metrics.influxdb.tags value          Comma-separated InfluxDB tags (key/values) attached to all measurements (default: "host=localhost")
  --metrics.influxdbv2                   Enable metrics export/push to an external InfluxDB v2 database
  --metrics.influxdb.token value         Token to authorize access to the database (v2 only) (default: "test")
  --metrics.influxdb.bucket value        InfluxDB bucket name to push reported metrics to (v2 only) (default: "geth")
  --metrics.influxdb.organization value  InfluxDB organization name (v2 only) (default: "geth")

ALIASED (deprecated) OPTIONS:
  --nousb                             Disables monitoring for and managing USB hardware wallets (deprecated)
  --whitelist value                   Comma separated block number-to-hash mappings to enforce (<number>=<hash>) (deprecated in favor of --eth.requiredblocks)

MISC OPTIONS:
  --snapshot                                Enables snapshot-database mode (default = enable)
  --bloomfilter.size value                  Megabytes of memory allocated to bloom-filter for pruning (default: 2048)
  --ignore-legacy-receipts                  Geth will start up even if there are legacy receipts in freezer
  --help, -h                                show help
  --override.grayglacier value              Manually specify Gray Glacier fork-block, overriding the bundled setting (default: 0)
  --override.terminaltotaldifficulty value  Manually specify TerminalTotalDifficulty, overriding the bundled setting (default: <nil>)


COPYRIGHT:
   Copyright 2013-2022 The go-ethereum Authors

9.0 参数分类

1.性能调优选项

PERFORMANCE TUNING OPTIONS:           性能调整选项
  --cache value                       分配给内部缓存的内存兆字节(默认 = 4096 主网全节点,128 轻模式)(默认:1024)
  --cache.database value              用于数据库 io 的缓存内存允许百分比(默认值:50)
  --cache.trie value                  用于 trie 缓存的缓存内存允许百分比(默认值 = 15% 完整模式,30% 存档模式)(默认值:15)
  --cache.trie.journal value          trie 缓存的磁盘日志目录以在节点重新启动后继续存在(默认值:“triecache”)
  --cache.trie.rejournal value        重新生成 trie 缓存日志的时间间隔(默认值:1小时)
  --cache.gc value                    用于修剪修剪的缓存内存百分比(默认值 = 25% 完整模式,0% 存档模式)(默认值:25)
  --cache.snapshot value              用于快照缓存的缓存允许百分比(默认值 = 10% 完整模式,20% 存档模式)(默认值:10)
  --cache.noprefetch                  在块导入期间禁用启发式状态预取(更少的 CPU 和磁盘 IO,更多的时间等待数据)
  --cache.preimages                   启用记录 trie 密钥的 SHA3/keccak 原像
PERFORMANCE TUNING OPTIONS:           性能调整选项
  --cache value                       分配给内部缓存的内存兆字节(默认 = 4096 主网全节点,128 轻模式)(默认:1024)
  --cache.database value              用于数据库 io 的缓存内存允许百分比(默认值:50)
  --cache.trie value                  用于 trie 缓存的缓存内存允许百分比(默认值 = 15% 完整模式,30% 存档模式)(默认值:15)
  --cache.trie.journal value          trie 缓存的磁盘日志目录以在节点重新启动后继续存在(默认值:“triecache”)
  --cache.trie.rejournal value        重新生成 trie 缓存日志的时间间隔(默认值:1小时)
  --cache.gc value                    用于修剪修剪的缓存内存百分比(默认值 = 25% 完整模式,0% 存档模式)(默认值:25)
  --cache.snapshot value              用于快照缓存的缓存允许百分比(默认值 = 10% 完整模式,20% 存档模式)(默认值:10)
  --cache.noprefetch                  在块导入期间禁用启发式状态预取(更少的 CPU 和磁盘 IO,更多的时间等待数据)
  --cache.preimages                   启用记录 trie 密钥的 SHA3/keccak 原像

2.API和控制台选项

API AND CONSOLE OPTIONS:              API 和控制台选项
  --ipcdisable                        禁用 IPC-RPC 服务器
  --ipcpath value                     datadir 中 IPC 套接字/管道的文件名(显式路径对其进行转义)
  --http                              启用 HTTP-RPC 服务器
  --http.addr value                   HTTP-RPC 服务器监听接口(默认:“localhost”)
  --http.port value                   HTTP-RPC 服务器监听端口(默认:8545)
  --http.api value                    通过 HTTP-RPC 接口提供的 API
  --http.rpcprefix value              提供 JSON-RPC 的 HTTP 路径路径前缀。使用“/”在所有路径上提供服务。
  --http.corsdomain value             接受跨源请求的域的逗号分隔列表(浏览器强制执行)
  --http.vhosts value                 逗号分隔的虚拟主机名列表,从中接受请求(服务器强制执行)。接受“*”通配符。 (默认:“本地主机”)
  --ws                                启用 WS-RPC 服务器
  --ws.addr value                     WS-RPC 服务器监听接口(默认:“localhost”)
  --ws.port value                     WS-RPC 服务器监听端口(默认:8546)
  --ws.api value                      通过 WS-RPC 接口提供的 API
  --ws.rpcprefix value                提供 JSON-RPC 的 HTTP 路径前缀。使用“/”在所有路径上提供服务。
  --ws.origins value                  接受 websockets 请求的来源
  --graphql                           在 HTTP-RPC 服务器上启用 GraphQL。请注意,GraphQL 只能在 HTTP 服务器启动的情况下启动。
  --graphql.corsdomain value          接受跨源请求的域的逗号分隔列表(浏览器强制执行)
  --graphql.vhosts value              逗号分隔的虚拟主机名列表,从中接受请求(服务器强制执行)。接受“*”通配符。 (默认:“本地主机”)
  --rpc.gascap value                  设置可以在 eth_call/estimateGas 中使用的 gas 上限(0=无限)(默认值:50000000)
  --rpc.txfeecap value                设置可以通过 RPC API 发送的交易费用上限(以以太为单位)(0 = 无上限)(默认值:1)
  --rpc.allow-unprotected-txs         允许通过 RPC 提交不受保护的(非 EIP155 签名)交易
  --jspath loadScript                 loadScript 的 JavaScript 根路径(默认值:“.”)
  --exec value                        执行 JavaScript 语句
  --preload value                     要预加载到控制台的以逗号分隔的 JavaScript 文件列表
API AND CONSOLE OPTIONS:              API 和控制台选项
  --ipcdisable                        禁用 IPC-RPC 服务器
  --ipcpath value                     datadir 中 IPC 套接字/管道的文件名(显式路径对其进行转义)
  --http                              启用 HTTP-RPC 服务器
  --http.addr value                   HTTP-RPC 服务器监听接口(默认:“localhost”)
  --http.port value                   HTTP-RPC 服务器监听端口(默认:8545)
  --http.api value                    通过 HTTP-RPC 接口提供的 API
  --http.rpcprefix value              提供 JSON-RPC 的 HTTP 路径路径前缀。使用“/”在所有路径上提供服务。
  --http.corsdomain value             接受跨源请求的域的逗号分隔列表(浏览器强制执行)
  --http.vhosts value                 逗号分隔的虚拟主机名列表,从中接受请求(服务器强制执行)。接受“*”通配符。 (默认:“本地主机”)
  --ws                                启用 WS-RPC 服务器
  --ws.addr value                     WS-RPC 服务器监听接口(默认:“localhost”)
  --ws.port value                     WS-RPC 服务器监听端口(默认:8546)
  --ws.api value                      通过 WS-RPC 接口提供的 API
  --ws.rpcprefix value                提供 JSON-RPC 的 HTTP 路径前缀。使用“/”在所有路径上提供服务。
  --ws.origins value                  接受 websockets 请求的来源
  --graphql                           在 HTTP-RPC 服务器上启用 GraphQL。请注意,GraphQL 只能在 HTTP 服务器启动的情况下启动。
  --graphql.corsdomain value          接受跨源请求的域的逗号分隔列表(浏览器强制执行)
  --graphql.vhosts value              逗号分隔的虚拟主机名列表,从中接受请求(服务器强制执行)。接受“*”通配符。 (默认:“本地主机”)
  --rpc.gascap value                  设置可以在 eth_call/estimateGas 中使用的 gas 上限(0=无限)(默认值:50000000)
  --rpc.txfeecap value                设置可以通过 RPC API 发送的交易费用上限(以以太为单位)(0 = 无上限)(默认值:1)
  --rpc.allow-unprotected-txs         允许通过 RPC 提交不受保护的(非 EIP155 签名)交易
  --jspath loadScript                 loadScript 的 JavaScript 根路径(默认值:“.”)
  --exec value                        执行 JavaScript 语句
  --preload value                     要预加载到控制台的以逗号分隔的 JavaScript 文件列表

3.网络选项

NETWORKING OPTIONS:                   网络选项
  --bootnodes value                   用于 P2P 发现引导程序的逗号分隔的 enode URL
  --discovery.dns value               设置 DNS 发现入口点(使用“”禁用 DNS)
  --port value                        网络监听端口(默认:30303)
  --maxpeers value                    网络对等点的最大数量(如果设置为 0,则禁用网络)(默认值:50)
  --maxpendpeers value                最大挂起连接尝试次数(如果设置为 0,则使用默认值)(默认值:0)
  --nat value                         NAT 端口映射机制(any|none|upnp|pmp|extip: )(默认值:“任何”)
  --nodiscover                        禁用对等发现机制(手动对等添加)
  --v5disc                            启用实验性 RLPx V5(主题发现)机制
  --netrestrict value                 将网络通信限制到给定的 IP 网络(CIDR 掩码)
  --nodekey value                     P2P节点密钥文件
  --nodekeyhex value                  P2P 节点密钥为十六进制(用于测试)
NETWORKING OPTIONS:                   网络选项
  --bootnodes value                   用于 P2P 发现引导程序的逗号分隔的 enode URL
  --discovery.dns value               设置 DNS 发现入口点(使用“”禁用 DNS)
  --port value                        网络监听端口(默认:30303)
  --maxpeers value                    网络对等点的最大数量(如果设置为 0,则禁用网络)(默认值:50)
  --maxpendpeers value                最大挂起连接尝试次数(如果设置为 0,则使用默认值)(默认值:0)
  --nat value                         NAT 端口映射机制(any|none|upnp|pmp|extip: )(默认值:“任何”)
  --nodiscover                        禁用对等发现机制(手动对等添加)
  --v5disc                            启用实验性 RLPx V5(主题发现)机制
  --netrestrict value                 将网络通信限制到给定的 IP 网络(CIDR 掩码)
  --nodekey value                     P2P节点密钥文件
  --nodekeyhex value                  P2P 节点密钥为十六进制(用于测试)

4.日志和调试选项

LOGGING AND DEBUGGING OPTIONS:        记录和调试选项
  --fakepow                           禁用工作量证明验证
  --nocompaction                      导入后禁用数据库压缩
  --verbosity value                   日志详细程度:0=silent,1=error,2=warn,3=info,4=debug,5=detail(默认:3)
  --vmodule value                     每个模块的详细程度:逗号分隔的列表= (例如 eth/*=5,p2p=4)
  --log.json                          使用 JSON 格式化日志
  --log.backtrace value               在特定日志语句(例如“block.go:271”)处请求堆栈跟踪
  --log.debug                         使用呼叫站点位置(文件和行号)预先准备日志消息
  --pprof                             启用 pprof HTTP 服务器
  --pprof.addr value                  pprof HTTP 服务器监听接口(默认:“127.0.0.1”)
  --pprof.port value                  pprof HTTP 服务器监听端口(默认:6060)
  --pprof.memprofilerate value        以给定的速率打开内存分析(默认值:524288)
  --pprof.blockprofilerate value      以给定的速率打开块分析(默认值:0)
  --pprof.cpuprofile value            将 CPU 配置文件写入给定文件
  --trace value                       将执行跟踪写入给定文件
LOGGING AND DEBUGGING OPTIONS:        记录和调试选项
  --fakepow                           禁用工作量证明验证
  --nocompaction                      导入后禁用数据库压缩
  --verbosity value                   日志详细程度:0=silent,1=error,2=warn,3=info,4=debug,5=detail(默认:3)
  --vmodule value                     每个模块的详细程度:逗号分隔的列表= (例如 eth/*=5,p2p=4)
  --log.json                          使用 JSON 格式化日志
  --log.backtrace value               在特定日志语句(例如“block.go:271”)处请求堆栈跟踪
  --log.debug                         使用呼叫站点位置(文件和行号)预先准备日志消息
  --pprof                             启用 pprof HTTP 服务器
  --pprof.addr value                  pprof HTTP 服务器监听接口(默认:“127.0.0.1”)
  --pprof.port value                  pprof HTTP 服务器监听端口(默认:6060)
  --pprof.memprofilerate value        以给定的速率打开内存分析(默认值:524288)
  --pprof.blockprofilerate value      以给定的速率打开块分析(默认值:0)
  --pprof.cpuprofile value            将 CPU 配置文件写入给定文件
  --trace value                       将执行跟踪写入给定文件

9.1以太坊的几种同步模式

查看geth命令行参数geth --help

--syncmode value                    Blockchain sync mode ("snap", "full" or "light") (default: snap)
--syncmode value                    Blockchain sync mode ("snap", "full" or "light") (default: snap)

参数支持"full", "snap", "light" 三种模式「原先的"fast"已被 "snap"替代」

同步模式 --syncmode <mode> 您可以使用确定网络中节点类型的参数以三种不同同步模式之一启动 Geth 。

这些是:

  • Full : 下载所有区块(包括标题、交易和收据)并通过执行每个区块增量生成区块链的状态。
  • Snap(默认):与快速相同的功能,但具有更快的算法,但不对区块中的交易进行重放以生成状态数据,只会在后期对区块中的数据(包括交易)进行校验
  • Light:下载所有区块头、区块数据,并随机验证一些,不同步区块体和状态数据,仅在需要时从网络上其他节点处获取

官方推荐使用快照同步,简单说就是新的算法替代原先的fast模式

snap启动

修改默认启动端口,第一个数字加1

bash
nohup /data/apps/snapeth/geth --syncmode snap --allow-insecure-unlock --authrpc.port 9551 --port 40303 --http --http.port 9546 --http.port 9545 --http.api web3,db,eth,net,personal --http.addr=172.31.34.215 --datadir /data/coin/snapETH --maxpeers 101 --cache 1024 --rpc.allow-unprotected-txs &


#线上
nohup /data/apps/snapeth/geth --authrpc.jwtsecret /data/apps/prysm/jwt.hex --syncmode snap --allow-insecure-unlock --authrpc.port 8551 --port 30303 --http --http.port 8546 --http.port 8545 --http.api web3,db,eth,net,personal --http.addr=172.31.34.215 --datadir /data/coin/snapETH --maxpeers 101 --cache 1024 --rpc.allow-unprotected-txs &
nohup /data/apps/snapeth/geth --syncmode snap --allow-insecure-unlock --authrpc.port 9551 --port 40303 --http --http.port 9546 --http.port 9545 --http.api web3,db,eth,net,personal --http.addr=172.31.34.215 --datadir /data/coin/snapETH --maxpeers 101 --cache 1024 --rpc.allow-unprotected-txs &


#线上
nohup /data/apps/snapeth/geth --authrpc.jwtsecret /data/apps/prysm/jwt.hex --syncmode snap --allow-insecure-unlock --authrpc.port 8551 --port 30303 --http --http.port 8546 --http.port 8545 --http.api web3,db,eth,net,personal --http.addr=172.31.34.215 --datadir /data/coin/snapETH --maxpeers 101 --cache 1024 --rpc.allow-unprotected-txs &

10.删除块

[root@eth_new snapeth]# tree -L 1 /data/coin/snapETH/geth
/data/coin/snapETH/geth
├── chaindata
    |
    ancient
├── ethash
├── jwtsecret
├── LOCK
├── nodekey
├── nodes
└── transactions.rlp
[root@eth_new snapeth]# tree -L 1 /data/coin/snapETH/geth
/data/coin/snapETH/geth
├── chaindata
    |
    ancient
├── ethash
├── jwtsecret
├── LOCK
├── nodekey
├── nodes
└── transactions.rlp

removedb

geth removedb

#This is useful for deleting an old chain and sync’ing to a new one. It only affects data directories that can be re-created on synchronisation and does not touch the keystore
geth removedb

#This is useful for deleting an old chain and sync’ing to a new one. It only affects data directories that can be re-created on synchronisation and does not touch the keystore

rmdb

#删除chaindata即可,排除ancient
rsync --delete-before -d test/ hantest/
#删除chaindata即可,排除ancient
rsync --delete-before -d test/ hantest/

手册参考地址:

https://www.netkiller.cn/blockchain/ethereum/geth/index.html

ETH手续费价格查询

官方github-API

官方github-RPC

汇智网-RPC-中文

GitBook-RPC-英文