Ethereum Geth客户端命令操作
1.启动自己的私有链
geth --rpc --rpccorsdomain "*" --rpcapi "personal,web3,eth" console
~xue$ geth --rpc --rpccorsdomain "*" --rpcapi "personal,web3,eth" console
INFO [08-16|08:54:48] instance:Geth/v1.6.0-unstable-105b37f1/darwin/go1.8
INFO [08-16|08:54:48] Allocated cache and file handles database=/Users/xue/Library/Ethereum/geth/chaindata cache=128 handles=1024
INFO [08-16|08:54:48] Initialised chain configuration config="{ChainID: 0 Homestead: <nil> DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: <nil> EIP158: <nil>}"
INFO [08-16|08:54:48] Disk storage enabled for ethash caches dir=/Users/xue/Library/Ethereum/geth/ethash count=3
INFO [08-16|08:54:48] Disk storage enabled for ethash DAGs dir=/Users/xue/.ethash count=2
INFO [08-16|08:54:48] Initialising Ethereum protocol versions="[63 62]" network=1
INFO [08-16|08:54:48] Loaded most recent local header number=117 hash=852594…295309 td=15753221
INFO [08-16|08:54:48] Loaded most recent local full block number=117 hash=852594…295309 td=15753221
INFO [08-16|08:54:48] Loaded most recent local fast block number=117 hash=852594…295309 td=15753221
INFO [08-16|08:54:48] Starting P2P networking
INFO [08-16|08:54:50] RLPx listener up self=enode://b2c6d6accc789106c2a05233704111ff0723d74733f0e2814e6a434a04b781e632a771721b5e1a5d85c05f1ed7c36f81bb4c07e15762b6518c591d6a5b9109ab@[::]:30303
INFO [08-16|08:54:50] IPC endpoint opened: /Users/xue/Library/Ethereum/geth.ipc
INFO [08-16|08:54:50] HTTP endpoint opened: http://localhost:8545
Welcome to the Geth JavaScript console!
instance: Geth/v1.6.0-unstable-105b37f1/darwin/go1.8
coinbase: 0xa0aee14352a0f3f5dcde30a45be6b06003c88073
at block: 117 (Tue, 15 Aug 2017 16:30:09 CST)
datadir: /Users/xue/Library/Ethereum
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
>
//私有链启动成功
2.查看当前账户信息
>eth.accounts
>["0xa0aee14352a0f3f5dcde30a45be6b06003c88073", "0xfd6f9c291fb6137f7809d13f6717baf691dc6bf1"]
3.创建新的账户
//引号内是账户密码
>personal.newAccount('1')
>INFO [08-16|08:58:27] New wallet appeared url=keystore:///Users/xue/Library/E… status=Locked
"0x9b23d981e7d7655c9483202c2404e8d8e638e19c"
4.查看当前链上区块数
>eth.blockNumber
117
5.查询当前账户余额
//账户1
> eth.getBalance(eth.accounts[0])
579531250000000000000
//账户2
> eth.getBalance(eth.accounts[1])
10000000000000000000