Geth console基本操作

Personal
personal.listAccounts
personal.newAccount("mypasswd")
personal.unlockAccount(eth.coinbase, "mypasswd", 300) //解鎖時間300

TxPool
txpool.status //查看Number of pending/queued transactions

admin
admin.nodeInfo //查看information on the node
admin.addPeer(nodeURL) //添加Pass a nodeURL to connect a to a peer on the network.
admin.peers //an array of objects with information about connected peers.
查看合約內容

info = admin.getContractInfo(contractaddress)
source = info.source
abi = info.abiDefinition

合約部署和合約保存在本地
source = "contract test {\n" +
" /// @notice will multiply a by 7.\n" +
" function multiply(uint a) returns(uint d) {\n" +
" return a * 7;\n" +
" }\n" +
"} ";
contract = eth.compile.solidity(source).test;
txhash = eth.sendTransaction({from: primary, data: contract.code });
// after it is uncluded
contractaddress = eth.getTransactionReceipt(txhash);
filename = "/tmp/info.json";
contenthash = admin.saveInfo(contract.info, filename);

Sets the extra data for the block when finding a block. Limited to 32 bytes.
miner.setExtra("extra data")

Sets the the ether base, the address that will receive mining rewards.
miner.setEtherbase(account)

Sending ether

var sender = eth.accounts[0];
var receiver = eth.accounts[1];
var amount = web3.toWei(0.01, "ether")
eth.sendTransaction({from:sender, to:receiver, value: amount})

debug.seedHash(eth.blockNumber)
'0xf2e59013a0a379837166b59f871b20a8a0d101d1c355ea85d35329360e69c000'
debug.printBlock(131805)

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

  • Spring Cloud為開發(fā)人員提供了快速構建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,534評論 19 139
  • 二月四日自我擴張的機會 階級次第為自我膨脹帶來了大好的機會。你也許渴望兄弟愛,但是一個追求卓越境界的人如何能體認兄...
    17grow閱讀 439評論 0 2
  • 孩子們放學了!心里瞬間輕松不少,有種如釋重負的愜意! 把桌兜里的零食都送給門房的爺爺,把該收拾的全部...
    綠蘿悠悠閱讀 244評論 1 0
  • kaykaykaykaykay閱讀 197評論 0 0

友情鏈接更多精彩內容