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)

你可能感兴趣的:(Geth console基本操作)