geth用于开始挖掘的常见命令
创建新帐户 :
personal.newAccount(‘12345678’) #密码 0x539bcbb3dfc0c06ca9166325bfb6b1bfa51569b3
解锁帐户 :
personal.unlockAccount(web3.eth.coinbase, “123456”, 15000)
开始挖掘 :
miner.start()
停止挖掘 :
miner.stop()
执行设置miner地址:
miner.setEtherbase(eth.coinbase)
true
也可以执行执行以下命令进行设置:
miner.setEtherbase(eth.accounts[0])
true
初始化创世区块:
geth init ./genesis.json –datadir “D:\Eth”
启动节点:
geth –datadir “D:\Eth” –networkid 10 –port 30303 –rpc –rpcaddr 127.0.0.1 –rpcapi “db,eth,personal,net,web3” –allow-insecure-unlock console
开始挖矿:
miner.start() miner.stop()
账户余额:
eth.getBalance(“地址”)
创建账户:
personal.newAccount(“”);
“0xf1c4dabd99003feaef5bff65658bf5976627e3fa” 0
“0xccc915534b908fcb4e1ee9063e5b1d0d3be5672d” 1
账号列表:
eth.accounts
解锁账号:
personal.unlockAccount(eth.accounts[5],””,0) 启动–allow-insecure-unlock
定义数量:
amount = web3.toWei(50,’ether’)
转账:
eth.sendTransaction({from:eth.accounts[0],to:””, value:amount)}
挖矿奖励账户:
eth.coinbase miner.setEtherbase(eth.accounts[1])
交易池状态:
txpool.status
获取区块:
eth.getBlock()
获取交易信息:
eth.getTransaction(“0xbee5007e38adf954f8a6cf699f771d39c9c8235920d71b6f96d66c72254d7724”)