当前位置:主页 > 查看内容

以太坊基础环境搭建(1)

发布时间:2021-07-05 00:00| 位朋友查看

简介:以太坊基础环境搭建 系统环境 geth go geth sloc solc-select web3 npm web3 错误 error proxy.golang.org dial tcp 172.217.160.113:443: i/o timeout 注意 系统环境 系统Ubuntu20.04.2 LTS64-bit。 geth go 从github上下载源码链接: https://golang.google……

系统环境

系统:Ubuntu20.04.2 LTS(64-bit)。

geth

go

  1. 从github上下载源码链接: https://golang.google.cn/dl/
  2. 解压并移动到/usr/local文件夹下。
$ sudo mv go/ /usr/local
  1. 编辑环境变量
$ sudo vim ~/.bashrc
#文件中添加
export GOROOT=/usr/local/go
#go 项目存放地方
export GOPATH=/home/jiangwei/goPro
export PATH=$GOROOT/bin:$PATH
  1. 环境变量生效并验证go版本
#环境变量生效
$ source ~/.bashrc
#验证go版本
$ go version
  1. 结果
$ go version
go version go1.16.3 linux/amd64

geth

  1. 从源码构建geth
$ git clone https://github.com/ethereum/go-ethereum.git
$ cd go-ethereum
$ make geth
#geth命令添加到环境变量
$ sudo vim ~/.bashrc
#geth,此时我的go-ethereum放在用户目录下.
export PATH=/home/jiangwei/ge-ethereum/build/bin:$PATH
#查看geth版本
geth version
Geth
Version: 1.10.2-stable
Git Commit: 97d11b0187b4695ccf44e3b71b54155fe405a36f
Architecture: amd64
Go Version: go1.16
Operating System: linux
GOPATH=/home/jiangwei/goPro
GOROOT=/usr/local/go

sloc

$sudo add-apt-repository ppa:ethereum/ethereum 
$sudo apt-get install solc 

solc-select

#pip3
$ sudo apt-get install python3-pip

$ git clone https://github.com/crytic/solc-select.git
$ pip3 install solc-select

$ solc-select use 0.4.22
$ solc --version

web3

npm

$ sudo apt-get install npm

web3

$ mkdir web3_test
$ cd web3_test
$ npm init
$ npm install web3@0.20.1

错误 error

proxy.golang.org dial tcp 172.217.160.113:443: i/o timeout

原因:golang.org被墙,连不上去。
解决:更换代理,go1.11支持公共代理服务https://goproxy.io

#在~/.bashrc 中添加如下代码:
export GOPROXY=https://goproxy.io

注意

部分代码下载编译时,需要科学上网,请注意自己网络状态。

;原文链接:https://blog.csdn.net/veneeer/article/details/115691823
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:关于SHA256的心得理解(流程层面) 下一篇:没有了

推荐图文


随机推荐