以太坊学习之常用命令

miner.start(1) 启动挖矿
miner.stop() 停止挖矿
miner.setEtherbase(addr) 设置主账户

personal.unlockAccount(eth.accounts[0]) 解锁账户
personal.newAccount() 创建一个账户

eth.accounts 查询所有账户
eth.coinbase 主账户
eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:amount}) 交易
eth.getBalance(addr) 查询账户余额
eth.blockNumber 查看区块总数
eth.getTransaction(“transactionAddr”) 查看交易
eth.getBlock(blockNumber) 通过区块号查看区块

web3.fromWei(eth.getBalance(eth.accounts[0]), ‘ether’) 从wei换算成以太币
web3.toWei(1) 以太币换算成wei

selfdestruct(recipient) 销毁合约,余额转到recipient中

猜你喜欢

转载自blog.csdn.net/chenyingjie_Android/article/details/78273857