美文网首页智能合约开发
【区块链基础08】-geth常用命令

【区块链基础08】-geth常用命令

作者: Geeks_Chen | 来源:发表于2018-06-26 10:25 被阅读142次

geth常用命令,随时更新

创建账户
personal.newAccount("0xa9436991e002986f58d948d79e737df190c4f26b")

查询账户列表
personal.listAccounts

eth.accounts

开始挖矿
miner.start()

设置挖矿地址
miner.setEtherbase(eth.accounts[0])

停止挖矿
miner.stop()

转币
eth.sendTransaction({from:sender, to:receiver, value: amount})

eth.sendTransaction({from:eth.coinbase, to:eth.accounts[1], value: web3.toWei(0.05, "ether")})


解锁
personal.unlockAccount("0xa9436991e002986f58d948d79e737df190c4f26b")

查询余额
eth.getBalance('0xB97168a67AB66E55B98B1439222Ee665E657fFc0')

查看节点信息
admin.nodeInfo

节点高度
eth.blockNumber

根据genesis.json初始化第一个区块
geth --datadir "./" init genesis.json

查看区块log
geth --datadir "./" --nodiscover console 2>>geth.log

实时跟踪log
tail -f geth.log

启动私链

geth --datadir "./" --nodiscover --rpc --rpcport "8546" --rpcapi "db,eth,net,web3,personal" --rpcaddr="[0.0.0.0](0.0.0.0)" --networkid 15 console 
2>>geth.log

geth --datadir "./" --nodiscover --rpc --rpcport "8545" --rpcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcaddr="0.0.0.0" --networkid 15 console 2>>geth.log

退出
exit

链接远程私链
geth attach http://60.8.103.54:8545 2>&1 console.log

相关文章

网友评论

    本文标题:【区块链基础08】-geth常用命令

    本文链接:https://www.haomeiwen.com/subject/bvspyftx.html