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)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,314评论 19 139
  • 二月四日自我扩张的机会 阶级次第为自我膨胀带来了大好的机会。你也许渴望兄弟爱,但是一个追求卓越境界的人如何能体认兄...
    17grow阅读 427评论 0 2
  • 孩子们放学了!心里瞬间轻松不少,有种如释重负的惬意! 把桌兜里的零食都送给门房的爷爷,把该收拾的全部...
    绿萝悠悠阅读 244评论 1 0
  • kaykaykaykaykay阅读 195评论 0 0

友情链接更多精彩内容