三亩地 三亩地SAN MU DI · CODE DIARY
ARTICLE DETAIL

日记详情

真实记录编程学习的某一天,欢迎挑你感兴趣的翻一翻。

geth常用命令

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()

更多技术博客 http://vilins.top/

← 返回列表