以太坊geth主網全節點部署

以太坊geth主網全節點部署

#環境 ubuntu 16.4
#硬盤500GB(目前佔用200G)linux

#客戶端安裝

# 查看下載頁面最新版
# https://ethereum.github.io/go-ethereum/downloads/

#下載
cd /opt
Version=1.8.20-24d727b6
wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-${Version}.tar.gz

#解壓安裝
tar zxf geth-linux-amd64-${Version}.tar.gz
rm -f geth-linux-amd64-${Version}.tar.gz
rm -rf /opt/geth
ln -fs /opt/geth-linux-amd64-${Version} /opt/geth
ln -fs /opt/geth-linux-amd64-${Version}/geth  /usr/local/bin/

#檢查
geth version

#啓動

nohup geth --rpc --rpcapi web3,eth,net,db,personal --rpcaddr 0.0.0.0 --rpcport 8545

#默認date目錄在 ~/.ethereum/
#可添加參數指定 --datadir "/data/geth_data"git

# geth客戶端登錄操做

#登錄
geth attach rpc:http://127.0.0.1:8545

#查看狀態
eth

#查看最新區塊高度
eth.blockNumber

# 查看同步狀態,返回 false 未同步或同步到最新了
eth.syncing

#生成帳戶,密碼 password123
personal.newAccount('password123')

# 區塊瀏覽器,查看最新區塊
# https://etherscan.iogithub


# docker方式部署geth節點

#date dir
mkdir -p /data/eth_date

#run eth
docker run -dit --name eth -h eth \
 -v /etc/localtime:/etc/localtime:ro \
 -v /data/eth_date:/root/.ethereum \
 -p 30303:30303 -p 8545:8545 \
  --restart=always \
ethereum/client-go:stable  --rpc --rpcaddr "0.0.0.0" \
  --rpcapi "web3,eth,net,db,personal" --maxpeers=50 --rpccorsdomain "*"
相關文章
相關標籤/搜索