geth常用命令
geth常用命令
更多技术博客 http://vilins.top/
初始化私链
geth --datadir /path/to/datadir init /path/to/genesis.json启动私链
geth --identity "TestNode" --rpc --rpcport "8545" --datadir /path/to/datadir --port "30303" --nodiscover consol创建账户
可直接在括号加密码
personal.newAccount()获取账户余额
eth.getBalance(myAddress)编译
solc --bin testContract.sol solc --abi testContract.sol解锁账户
personal.unlockAccount(myAddress)发送部署的合约
myContract = eth.contract(abi) contract = myContract.new({from:myAddress,data:code,gas:1000000})获取正在等待确认的交易
eth.getBlock("pending",true).transactions调用智能合约
contract.multiply.sendTransaction(10, {from:myAddress})本地测试合约
contract.multiply.call(10)获取区块
eth.getBlock()获取交易
eth.getTransaction()