概述
以太坊中,常用的一些命令和操作
一、geth启动命令
1.连接命令
1 2 3 4 5 6 7 8 9 10 11 COPY # 部署以太坊节点ropsten,同步数据 snap nohup ./geth --ropsten --datadir ./ropsten_data/ --syncmode snap --cache=1024 --http --http.api "eth,net,web3,personal,admin" --http.addr 0.0.0.0 --http.corsdomain '*' --maxpeers 32 --allow-insecure-unlock >> ropsten-log.out & # geth客户端连接 ./geth attach http://localhost:8545 # 部署以太坊节点rinkeby,同步数据 snap nohup ./geth --rinkeby --datadir ./rinkeby_data/ --syncmode snap --cache=1024 --port 40303 --http --http.api "eth,net,web3,personal,admin" --http.addr 0.0.0.0 --http.port 9545 --http.corsdomain '*' --maxpeers 32 --allow-insecure-unlock >> rinkeby-log.out & # geth客户端连接 ./geth attach http://localhost:9545
二、geth环境启动后命令
1. eth命令
1 2 3 4 5 COPY # 查看数据同步状态 eth.syncing # 查看账户余额 eth.getBalance("0xc99d160ad804Ee5B7ac9552bEF3B25f53E659d79")
2. net命令
1 2 3 4 5 COPY # 是否在监听节点 net.listening # 连接的节点数 net.peerCount
3. admin命令
1 2 3 4 5 COPY # 查看节点 admin.peers # 查看自身节点信息 admin.nodeInfo
4. web3命令
1 2 COPY # 查看账户余额 web3.fromWei(eth.getBalance("0xc99d160ad804Ee5B7ac9552bEF3B25f53E659d79"), "ether")
clef命令
1 2 3 4 5 6 7 8 COPY # 初始化硬件钱包 ./clef --configdir ./conf/clef/ init # 创建账号 0xcDa104CB9412e6cdd1a2b576e115E0a8e27Cd5F0 ./clef --keystore ./account/ newaccount # 启动服务 Ropsten ./clef --keystore ./account --configdir ./conf/clef/ --chainid 3
Copyright:
Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.