以太坊
在centos上安装以太坊
安装所需环境
- yum update -y && yum install git wget bzip2 vim gcc-c++ ntp epel-release nodejs cmake -y
安装go
wget https://dl.google.com/go/go1.10.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.10.linux-amd64.tar.gz
echo 'export GOROOT=/usr/local/go' >> /etc/profile
echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/profile
echo 'export GOPATH=/root/go' >> /etc/profile
echo 'export PATH=$PATH:$GOPATH/bin' >> /etc/profile
source /etc/profile
验证
$ go version
go version go1.10 linux/amd64
克隆编译项目go-ethereum
git clone https://github.com/ethereum/go-ethereum.git
cd go-ethereum
make all
在path中加入geth路径
echo 'export PATH=$PATH:/opt/go-ethereum/build/bin' >> /etc/profile
source /etc/profile
验证
$ geth version
Geth
Version: 1.8.2-unstable
Git Commit: bd6879ac518431174a490ba42f7e6e822dcb3ee1
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10
Operating System: linux
GOPATH=/root/go
GOROOT=/usr/local/go
到此geth环境已经安装完毕
启动geth
- 正式环境后台启动geth,
nohup geth --datadir "/data/database/eth" --fast -cache 2048 --rpc --rpcaddr "0.0.0.0" --rpcport "12345" --rpcapi "eth,net,web3,personal,admin" --trie-cache-gens 3000> /data/database/eth/block.log 2>&1 &
- 启动以太坊测试服务(控制台)
geth --networkid "3" --datadir "/data/database/eth" --testnet --fast -cache 2048 --rpc --rpcaddr "0.0.0.0" --rpcport "12345" --rpcapi "eth,net,web3,personal,admin" console 2>> geth.log
- 在更新中请耐心等待,一般需要48个小时,甚至需要更多时间.
二.使用java操作:web3j开发文档
参考文档