一、下載和安裝:
? ? 1双炕、下載
鏈接:https://pan.baidu.com/s/1qYYYYny
密碼:47x0
? ? 2狞悲、安裝:比如安裝到 D://work//geth 目錄中
? ? ? ? 安裝完成之后的目錄結(jié)構(gòu)
? ? 3、CMD進入終端
? ? ? ? geth -help? (geth -h)
二妇斤、創(chuàng)建創(chuàng)世區(qū)塊
? ? 1摇锋、拷貝sspgenesis.json 到 安裝目錄中 (D://work//geth)
? ? 2、在CMD 終端站超,進入到安裝目錄中
? ? ? ? cd D://work//geth
? ? ? ? geth --datadir "D://work//geth//ichain" init sspgenesis.json
? ? 3荸恕、啟動命令
? ? ? ? geth? --identity "niubit" --rpc --rpcaddr "0.0.0.0" --port 30303 --rpccorsdomain "*" --datadir "cdata"? --networkid 999? --rpcport 9090 console
? ? 4、后續(xù)的啟動
? ? ? ? geth -datadir "D://work//geth//ichain" console
? ? ? ? geth -datadir "D://work//geth//ichain" console 2>> geth.log(geth -datadir "%cd%\chain" console 2>> geth.log)
? ? 5死相、geth 和 eth
? ? ? ? geth 命令為服務端命令
? ? ? ? eth 命令為客戶端命令
? ? 6戚炫、創(chuàng)建賬戶:
? ? ? ? personal.newAccount()
? ? ? ? 輸入密碼
? ? ? ? 確認密碼
三、常用命令
? ? 退出:exit
? ? 查詢賬戶:eth.accounts? (eth.accounts[0])
? ? 查詢賬戶余額
? ? eth.getBalance(user1)
? ? 當前區(qū)塊
? ? eth.blockNumber
? ? 開始挖礦 miner.start()
? ? 結(jié)束挖礦 miner.stop()
? ? 轉(zhuǎn)賬
? ? eth.sendTransaction({from:user1, to:user2, value:web3.toWei(3, "ether")})
? ? 解鎖賬號
? ? personal.unlockAccount(user1, password)
? ? 查看自己節(jié)點的信息
? ? admin.nodeInfo
? ? 添加節(jié)點
? ? admin.addPeer(‘enode://1e3c1727cd3bee9f25edeb5dbb3b880e03e41f8eec99566557f3ee0422734a8fcad17c161aa93d61bdbfb28ed152c143c7eb501db58bc63502a104a84b62d742@192.168.1.101:30303’)
? ? 查看添加新節(jié)點的信息
? ? admin.peers
? ? #將wei轉(zhuǎn)換為ether
? ? web3.fromWei(21000000000000, 'ether')
? ? #檢查交易池
? ? txpool.status
? ? #查看正在交易的數(shù)據(jù)
? ? eth.getBlock("pending",true).transactions
? ? #獲取某個區(qū)塊的信息
? ? eth.getBlock(294)
? ? #gas
? ? eth.estimateGas({from:eth.accounts[1], to: eth.accounts[2], value:50000000000000})
? ? eth.gasPrice