天天看點

Ubuntu 安裝 Geth

PPA安裝:

apt-get install software-properties-common

add-apt-repository -y ppa:ethereum/ethereum

apt-get update

apt-get install ethereum
           

驗證是否安裝成功:

geth help
           

安裝位置及目錄結構:

安裝目錄:
cd $HOME/.ethereum

目錄結構:
geth: 主目錄

geth.ipc:(interprocess communication)運作時産生的用于提供node to UI 的管道連接配接

history: 曆史的一些資訊
 
keystore: 密鑰管理
           

 啟動:

geth help 可用于檢視指令及參數

常用的有:

1:--datadir 區塊資料儲存目錄

2:--syncmode 資料同步方式(full 全節點并做交易驗證;fast: 全節點 同步期間不做驗證;light: 輕量級節點隻同步塊頭)

3:--rpc 遠端協定調用 (對應的值有 db, eth, net, web3, personal)

4:console 由于啟動後會有大量同步資料的資訊列印在視窗,可使用重定向将其輸入到日志檔案 console 2>> geth.log

啟動過程可寫成shell腳本友善後續運作:

start.sh

#!/bin/sh

geth --datadir "/home/sean/.ethereum" --syncmode "full" --rpc --rpcapi "db,eth,net,web3,personal" console 2>> /home/sean/.ethereum/geth/geth.log
           

停止:在啟動視窗exit

繼續閱讀