太坊的js交互是靠web3.js调用的。
改完后,需要打包,放到Go Ethereum里测试,以下就是打包编译过程说明。
web3.js版本:v0.20.6。
- 安装cnpm
1
| npm install -g cnpm --registry=https://registry.npm.taobao.org
|
- 在
web3.js
的根路径下 安装web3.js
的依赖
- 安装
gulp
打包命令
- 在
web3.js
的根路径下 执行gulp
- 把
dist/web3.js
文件拷贝到项目中
1
| cp dist/web3.js ../go-cypherium/internal/jsre/deps
|
- 安装
go-bindata
(我是在~目录下执行的)
1
| go get -u github.com/jteeuwen/go-bindata/...
|
- 复制 go-bindata文件 到 go的安装目录的bin下。
1
| cp ~/go/bin/go-bindata ~/install/go/bin
|
- 在cypherium_private/go-cypherium/internal/jsre/deps下执行deps.go的倒数第二行,会看到bindata.go已变蓝色,大功告成!
1
| go-bindata -nometadata -pkg deps -o bindata.go bignumber.js web3.js |