安装devtools报错
想要开发以太坊,就需要开发智能合约,需要安装aligen,Mac版本需要通过安装devtools的方式安装abigen
$ make devtools
env GOBIN= go install golang.org/x/tools/cmd/stringer@latest
env GOBIN= go install github.com/kevinburke/go-bindata/go-bindata@latest
go: downloading github.com/kevinburke/go-bindata v3.11.0
go install github.com/kevinburke/go-bindata/go-bindata@latest: zip for github.com/kevinburke/go-bindata@v3.11.0 has unexpected file github.com/kevinburke/go-bindata@v0.0.0-20180804232615-06af60a4461b/.gitignore
这个原因是和镜像云有关系,导致不能安装go-bindata,我之前使用的是阿里云的镜像库,切换成官方的镜像,重新安装一下
$ go env -w GOPROXY=https://goproxy.io,direct
$ make devtools
env GOBIN= go install golang.org/x/tools/cmd/stringer@latest
env GOBIN= go install github.com/kevinburke/go-bindata/go-bindata@latest
go: downloading github.com/kevinburke/go-bindata v3.22.0+incompatible
env GOBIN= go install github.com/fjl/gencodec@latest
go: downloading github.com/fjl/gencodec v0.0.0-20191126094850-e283372f291f
go: downloading github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61
go: downloading golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9
env GOBIN= go install github.com/golang/protobuf/protoc-gen-go@latest
go: downloading github.com/golang/protobuf v1.5.2
go: downloading google.golang.org/protobuf v1.26.0
env GOBIN= go install ./cmd/abigen
# gopkg.in/olebedev/go-duktape.v3
In file included from _cgo_export.c:4:
debugger.go:23:13: warning: unused function '_duk_debugger_attach' [-Wunused-function]
Please install solc
Please install protoc
看到最后两句意思应该是缺少了solc和protoc
$ npm install -g solc-cli solc protoc
$ brew install protoc-gen-go
重试下
$ make devtools
In file included from _cgo_export.c:4:
debugger.go:23:13: warning: unused function '_duk_debugger_attach' [-Wunused-function]
还是有报错,
没办法,只能换个思路,
后来通过官网发现,有现成的build工具 geth.ethereum.org/downloads/
所以又重新下载解压了一次
$ wget -c https://gethstore.blob.core.windows.net/builds/geth-alltools-darwin-amd64-1.10.4-unstable-b3a1fda6.tar.gz
--2021-05-19 08:18:56-- https://gethstore.blob.core.windows.net/builds/geth-alltools-darwin-amd64-1.10.4-unstable-b3a1fda6.tar.gz
Resolving gethstore.blob.core.windows.net... 40.113.27.176
Connecting to gethstore.blob.core.windows.net|40.113.27.176|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 45363864 (43M) [application/octet-stream]
Saving to: ‘geth-alltools-darwin-amd64-1.10.4-unstable-b3a1fda6.tar.gz’
geth-alltools-darwin-amd64-1.10.4-unsta 100%[=============================================================================>] 43.26M 324KB/s in 3m 19s
2021-05-19 08:22:16 (223 KB/s) - ‘geth-alltools-darwin-amd64-1.10.4-unstable-b3a1fda6.tar.gz’ saved [45363864/45363864]
$ tar zxvf geth-alltools-darwin-amd64-1.10.4-unstable-b3a1fda6.tar.gz
$ cd geth-alltools-darwin-amd64-1.10.4-unstable-b3a1fda6
$ ./abigen --help
abigen [global options] command [command options] [arguments...]
VERSION:
1.10.4-unstable-b3a1fda6-20210518
COMMANDS:
help Shows a list of commands or help for one command
GLOBAL OPTIONS:
--abi value Path to the Ethereum contract ABI json to bind, - for STDIN
--bin value Path to the Ethereum contract bytecode (generate deploy method)
--type value Struct name for the binding (default = package name)
--combined-json value Path to the combined-json file generated by compiler
--sol value Path to the Ethereum contract Solidity source to build and bind
--solc value Solidity compiler to use if source builds are requested (default: "solc")
--vy value Path to the Ethereum contract Vyper source to build and bind
--vyper value Vyper compiler to use if source builds are requested (default: "vyper")
--exc value Comma separated types to exclude from binding
--pkg value Package name to generate the binding into
--out value Output file for the generated binding (default = stdout)
--lang value Destination language for the bindings (go, java, objc) (default: "go")
--alias value Comma separated aliases for function and event renaming, e.g. original1=alias1, original2=alias2
--help, -h show help
--version, -v print the version
安装成功了
欢迎大家参考我的博客,让我们一起成长: feilong.tech