以太坊私链控制台操作

更详细

linux

初始化
./geth init --datadir data genesis.json

新建账户
./geth --datadir data account new

导入账户
./geth --datadir data account import 0x79D7150F66a1945B3C86c257F83a7176dBaA54b9.txt

后台启动并解锁
nohup ./geth --config ./geth.toml  --mine --unlock 0 --password  ./password --allow-insecure-unlock  &

打开控制台
./geth attach --datadir ./data

开启挖矿(矿机执行)
使用一张卡
nohup ./nbminer -a ethash -o stratum+tcp://192.168.1.121:8008 --platform 1 -d 0  -u 0x57c5431167F264024Dc355fbA04859D6069E22E7.worker -log &
全部卡
nohup ./nbminer -a ethash -o stratum+tcp://192.168.1.121:8008 --platform 1  -u 0x57c5431167F264024Dc355fbA04859D6069E22E7.worker -log &

cpu挖矿
miner.start()

查询矿工挖矿余额
默认矿工
web3.fromWei(eth.getBalance(eth.coinbase), "ether")
指定账户
web3.fromWei(eth.getBalance("0x79d7150f66a1945b3c86c257f83a7176dbaa54b9"), "ether")

账户解锁
personal.unlockAccount("0x79d7150f66a1945b3c86c257f83a7176dbaa54b9","111111")

查看nodeinfo
admin.nodeInfo.enode

win cmd

初始化
geth.exe init --datadir data genesis.json

创建账户
geth.exe --datadir data account new

geth.exe --datadir data account import 0x79D7150F66a1945B3C86c257F83a7176dBaA54b9.txt


默认开启http解锁 启动 直接打开控制台
geth.exe  --config ./geth.toml --mine  --unlock 0 --password  password  --allow-insecure-unlock  console 2>>geth.log


打开控制台
geth.exe attach --datadir ./data

cpu挖矿
miner.start()

停止cpu挖矿
miner.stop()