手把手教你搭建基于fabric1.4.2的blockchain-explorer

环境准备

  • fabric 1.4.2

  • fabric-sample 1.4.2

  • blockchain-explorer 0.3.9.5

  • go 1.12.8 环境安装

下载安装包

在网址 https://studygolang.com/dl 下载压缩包之后解压提取到Ubuntu中

设置环境配置

vim /etc/profile

export GOROOT=/go

export GOPATH=/Go_WorkSpace

export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

source /etc/profile 使此修改的文件立即生效

go env -w GOPROXY=https://goproxy.cn,direct

  • nodejs 8.11.4 环境安装

安装nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

安装后重启该会话或重新开一个会话即可生效

查看当前支持的版本

nvm ls-remote

安装(同时安装npm)

nvm install 8.11.4

检查node.js安装版本

node -v

检查npm的安装版本

npm -v

切换源

npm install -g nrm

nrm ls

nrm use taobao

  • PostgreSQL 10.10 环境安装

apt install postgresql

  • Jq jq-1.5-1-a5b5cbe

apt install jq

  • docker 19.03.2 环境安装

官方安装脚本

curl -fsSL https://get.docker.com | bash -s docker –mirror Aliyun

配置Docker镜像站

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

sudo systemctl restart docker.service

  • docker-compose 1.24.1 环境安装

docker-compose安装

sudo apt-get install python-pip

sudo pip install docker-compose

查看版本

docker-compose -version

first-network搭建

编译工具

go get github.com/hyperledger/fabric  go get -u github.com/golang/protobuf/protoc-gen-go  cd $GOPATH/src/github.com/hyperledger/fabric  git checkout v1.4.2  sudo apt install libtool libltdl-dev  make release  cd release/linux-amd64 (bin文件下生成了一些必要的工具)  sudo cp -r bin /usr/local (移动到/usr/local下,全局使用)  cd ../..  mkdir -p .build/docker/gotools/  cp -r $GOPATH/bin .build/docker/gotools/  cp -r $GOPATH/src/github.com/hyperledger/fabric/release/linux-amd64/bin/ .build/docker/gotools/

启动网络

go get -u github.com/hyperledger/fabric-samples  cd $GOPATH/src/github.com/hyperledger/fabric-samples/  git checkout v1.4.2  cd first-network  ./byfn.sh -m generate  ./byfn.sh -m up 

编译启动

cd $GOPATH/src/github.com/hyperledger/blockchain-explorer  npm install  cd app/test  npm install  npm run test  cd ../../client/  rm package-lock.json  npm install  npm run test:ci -- -u --coverage  npm run build

连接终端

cd $GOPATH/src/github.com/hyperledger/blockchain-explorer  ./start.sh

打开浏览器输入以下网址

http://localhost:8080/#/login

账号密码见config.json配置


发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注