geth下载路径
https://geth.ethereum.org/downloads/
linux系统geth钱包基本启动命令
nohup ./geth --rpc --rpcaddr 192.168.1.1 --rpcport 8080 --rpcapi personal,db,eth,net,web3 --datadir /data/coins/ethdata &
可选参数
--datadir “xxx” 数据库和keystore密钥的数据目录
--rpcaddr value HTTP-RPC服务器接口地址(默认值:“localhost”)
--rpcapi value 基于HTTP-RPC接口提供的API
--rpcport value HTTP-RPC服务器监听端口(默认值:8545)
--networkid value 网络标识符(整型, 1=Frontier, 2=Morden (弃用), 3=Ropsten, 4=Rinkeby) (默认: 1)
nodiscover: 此参数确保geth不去寻找peers节点,主要是为了控制联盟链接入的节点.
--maxpeers value 最大的网络节点数量(如果设置为0,网络将被禁用)(默认值:25)
--cache value 分配给内部缓存的内存MB数量,缓存值(最低16 mb /数据库强制要求)(默认:128)
--syncmode "fast" 同步模式 ("fast", "full", or "light")
--testnet Ropsten网络:预先配置的POW(proof-of-work)测试网络
geth其他参数参考命令
https://www.cnblogs.com/tinyxiong/p/7918706.html
//启动命令窗
./geth attach ipc:/data/coins/ETH/ethdata/geth.ipc
ipc:后为区块链数据存储目录下的geth.ipc程序
命令窗命令
查看是否开启同步
eth.syncing
同步的块数
eth.blockNumber
连接数
net.peerCount
是否有堵塞交易
eth.pendingTransactions
解锁地址
personal.unlockAccount("0x11111111111111111111111111111111111")
*将0x11111111111111111111111111111111111替换成需要解锁的地址
*将000000替换成自己要设置的私钥解锁密码
查看账户
eth.accounts
创建用户:
personal.newAccount("111111")
其中参数为此账户的密码。
也可以先创建账户,然后输入密码:
personal.newAccount()
查看区块数据
eth.blockNumber
启动挖矿
miner.start()
返回结果为true则启动成功,具体执行情况可查看日志。
停止挖矿
miner.stop()
查看账户余额
其中参数为区块链地址
eth.getBalance("0x7d1f7be4112ce63b9de04a0bf95c1e87e40000")
转账
从账户0x7d1f7be4112ce63b9de04a0bf95c1e800000000转账3个以太币到0x587e57a516730381958f86703b1f8e97000000000。
eth.sendTransaction({from:"0x7d1f7be4112ce63b9de04a0bf95c1e800000000",to:"0x587e57a516730381958f86703b1f8e97000000000",value:web3.toWei(3,"ether")})
使用旧的nonce重新发币交易 用来冲洗拥堵的交易
eth.sendTransaction({
from: '0x7d1f7be4112ce63b9de04a0bf95c1e800000000',
to: '0x587e57a516730381958f86703b1f8e97000000000',
value: 0,
gasPrice: 10000000000,
gasLimit: 24000,
nonce: 0
});