承接区块链(三)–常用命令(1)
6.两个账户间转账
> acc1=eth.accounts[0] "0xa0aee14352a0f3f5dcde30a45be6b06003c88073"
> acc2=eth.accounts[1] "0xfd6f9c291fb6137f7809d13f6717baf691dc6bf1"
//转账需要对账户进行解锁
>personal.unlockAccount(acc1,'1')
true >eth.sendTransaction({from:acc1,to:acc2,value:web3.toWei(10,"ether")})
INFO [08-16|09:08:41] Submitted transaction fullhash=0xd00eb2613476be17b43784d8ea24cc5aadb686d7696f6633ab954853ade90490 recipient=0xfd6f9c291fb6137f7809d13f6717baf691dc6bf1 "0xd00eb2613476be17b43784d8ea24cc5aadb686d7696f6633ab954853ade90490"
7.账户交易产生,产生后等待挖矿,进行转账,返回的有交易Hash
> miner.start()
INFO [08-16|09:10:46] Starting mining operation (CPU=4 TOT=5)
true
> INFO [08-16|09:10:46] commit new work on block 118 with 1 txs & 0 uncles. Took 3.768493ms
> INFO [08-16|09:10:51]
8.查询当前区块数,与之前的做对比
>eth.blockNumber
117
> eth.blockNumber
120
9.查询当前账户余额,与之前的对比
//账户1
> eth.getBalance(eth.accounts[0])
579531250000000000000
> eth.getBalance(eth.accounts[0])
584531250000000000000
//账户2
> eth.getBalance(eth.accounts[1])
10000000000000000000
> eth.getBalance(eth.accounts[1])
20000000000000000000