区块链浏览器

  • 为fabric项目中的first network部署一个浏览器
    • 环境依赖
    • PostgreSQL 9.5 or greater安装
    • 检查first network情况
    • 具体步骤
      • git项目
      • 修改文件夹权限
      • 改数据库的内容
      • 新建表
      • jwt修改
      • 修改你的fabric网络的配置
      • 编译浏览器
      • 运行

记录了我遇到的坑和一些解决方案。

为fabric项目中的first network部署一个浏览器

https://github.com/hyperledger/blockchain-explorer
以上为项目的github地址,本文大部分资料来源于这里。

环境依赖

**Nodejs 8.11.x (Note that v9.x is not yet supported)**
$ node -v
v8.11.0
**PostgreSQL 9.5 or greater**
安装见另一篇文章
sudo apt-get install postgresql-9.5.20
**jq**
sudo apt-get install jq
**Linux-based operating system, such as Ubuntu or MacOS**
**Docker CE 18.09.2 or later**docker 版本说明: docker自1.13版本以后发行版本有了很大不同分为了CE(community edition)社区版和EE(enterprise edition)**Docker Compose 1.14.0**

sudo pip uninstall docker-compose
sudo pip install docker-compose==1.14.0

PostgreSQL 9.5 or greater安装

cielo@cielo-ubuntu:~/go/src/github.com/hyperledger/fabric/fabric-samples/first-network$ sudo apt-get update | grep "Failed".
E: 仓库'https://download.docker.com/linux/ubuntu bionic InRelease'将其'Label'值从'Docker EE'修改到了'Docker CE'
cielo@cielo-ubuntu:~/go/src/github.com/hyperledger/fabric/fabric-samples/first-network$ sudo add-apt-repository --remove ppa:chris-lea/node.jsEvented I/O for V8 javascript. Node's goal is to provide an easy way to build scalable network programs更多信息: https://launchpad.net/~chris-lea/+archive/ubuntu/node.js
按 [ENTER] 继续或Ctrl-c 取消卸载。cielo@cielo-ubuntu:~/go/src/github.com/hyperledger/fabric/fabric-samples/first-network$ sudo apt-get update
命中:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease
命中:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease
命中:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease
命中:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease
获取:5 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
正在读取软件包列表... 完成
E: 仓库'https://download.docker.com/linux/ubuntu bionic InRelease'将其'Label'值从'Docker EE'修改到了'Docker CE'
N: 为了让这个仓库能够应用,这必须在更新之前显式接受。更多细节请参阅 apt-secure(8) 手册。
cielo@ciel
  • 解决方法见另一篇文章,如何安装制定版本的postgresql(主要是源的问题,ubuntu18.04的名字要注意一下,16.04才是debian)

检查first network情况

运行起来

$ sudo ./byfn.sh up
Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
LOCAL_VERSION=1.4.0
DOCKER_IMAGE_VERSION=1.4.3
=================== WARNING ===================Local fabric binaries and docker images are  out of  sync. This may cause problems.
===============================================
……
===================== Query successful on peer1.org2 on channel 'mychannel' ===================== ========= All GOOD, BYFN execution completed =========== _____   _   _   ____
| ____| | \ | | |  _ \
|  _|   |  \| | | | | |
| |___  | |\  | | |_| |
|_____| |_| \_| |____/  

具体步骤

git项目

git clone https://github.com/hyperledger/blockchain-explorer.git
cd blockchain-explorer

修改文件夹权限

** Important repeat after every git pull (in some case you may need to apply permission to db/ directory, from blockchain-explorer/app/persistence/fabric/postgreSQL run: chmod -R 775 db/ **

改数据库的内容

首先修改PostgreSQL数据库默认用户postgres的密码,具体百度。

cd blockchain-explorer/app
在这个目录下的exploreconfig文件中修改,将数据库的用户改成你想要新建的用户名和密码,不改也行就用这个。
"postgreSQL": {"host": "127.0.0.1","port": "5432","database": "fabricexplorer","username": "hppoc","passwd": "password"
}

新建表

Ubuntu
这个脚本是建用户名和建表的,里面调用了其他文件,默认的用户名和密码见上,如果上一步改了那这一步也要改。
我在这遇到了一个问题,当时忘记记录了……

    cd blockchain-explorer/app/persistence/fabric/postgreSQL/dbsudo -u postgres ./createdb.sh

jwt修改

官网是这么说的,不需要可以不改。
cd blockchain-explorer/app
Modify explorerconfig.json to update Authorization (JWT) settings.

“jwt”: {
“secret” : “a secret phrase!!”,
“expiresIn”: “2 days”
}

修改你的fabric网络的配置

github教程见下:
On another terminal:
cd blockchain-explorer/app/platform/fabric
Modify config.json to define your fabric network connection profile:

{"network-configs": {"first-network": {"name": "firstnetwork","profile": "./connection-profile/first-network.json","enableAuthentication": false}},"license": "Apache-2.0"
}

profile就是你的网络的配置信息的文件。它给的例子是first-network的,还有两个其他的例子。可以该profile。
需要进入./connection-profile/first-network.json修改具体配置信息。

我的目录:

~/go/src/github.com/hyperledger/fabric/blockchain-explorer/app/platform/fabric/connection-profile$

我修改后的内容:
重点是path!!!!!!!!!!!!!!!!!!!!!!!
这里特别坑
!!!!

注意两点:
1、路径是从/home/开始的。
2、“adminPrivateKey”: {
“path”: “/home/cielo/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/f1e11fef244b2d3c727a14917649b4f19601e79e2fb0f833362cbeff0658ac0c_sk”
},
此处的路径最后的sk文件名是会变的,除了path前面的路径,后面sk的名称也需要修改!!!!!

{"name": "first-network","version": "1.0.0","license": "Apache-2.0","client": {"tlsEnable": true,"adminUser": "admin","adminPassword": "adminpw","enableAuthentication": false,"organization": "Org1","connection": {"timeout": {"peer": {"endorser": "300"},"orderer": "300"}}},"channels": {"mychannel": {"peers": {"peer0.org1.example.com": {}},"connection": {"timeout": {"peer": {"endorser": "6000","eventHub": "6000","eventReg": "6000"}}}}},"organizations": {"Org1MSP": {"mspid": "Org1MSP","fullpath": true,"adminPrivateKey": {"path": "/home/cielo/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/f1e11fef244b2d3c727a14917649b4f19601e79e2fb0f833362cbeff0658ac0c_sk"},"signedCert": {"path": "/home/cielo/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem"}}},"peers": {"peer0.org1.example.com": {"tlsCACerts": {"path": "/home/cielo/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"},"url": "grpcs://localhost:7051","eventUrl": "grpcs://localhost:7053","grpcOptions": {"ssl-target-name-override": "peer0.org1.example.com"}}}
}

编译浏览器

Important: repeat the below steps after every git pull.

On another terminal:

./main.sh installto install, run tests, and build project
./main.sh cleanto clean the /node_modules, client/node_modules client/build, client/coverage, app/test/node_modules directories
./main.sh testto test REST API, and UI componentsto generate code coverage report

Or

cd blockchain-explorer
npm install
cd blockchain-explorer/app/test
npm install
npm run test
cd client/
npm install
npm run test:ci -- -u --coverage
npm run build

这里我遇到一个问题,是node的权限。原本我的nodejs安装在用户cielo下而不是root下,所以sudo的时候找不到node命令。重新用sudo安装一个node即可。

运行

From a new terminal:

cd blockchain-explorer/
./start.sh (it will have the backend up).
./start.sh debug (it will have the backend in debug mode).
./start.sh print (it will print help).
Launch the URL http(s)://localhost:8080 on a browser.
./stop.sh (it will stop the node server).

达达,成功啦

主要问题是版本/路径/权限,其实还是挺好用的。

后续我要学一下node然后学一下这个项目的源码。
hhhhh

区块链浏览器的部署记录相关推荐

  1. blockchain-explorer区块链浏览器中文版部署

    部署步骤 1. 启动区块链网络 ./byfn.sh up 2. 下载中文版Fabric区块链浏览器代码 git clone https://github.com/ezpod/blockchain-ex ...

  2. 区块链学习2——区块链浏览器的搭建

    目录 1.环境准备 2.下载区块链浏览器并部署 3.部署项目 5.配置4个节点 6.合约配置 7.区块链信息-预览 1.环境准备 一键部署模式,采用的是同机部署. Java jdk1.8.0_121及 ...

  3. 联盟链Quorum(基于raft共识)部署流程(三)- 部署基于Quorum链的区块链浏览器

    这篇文章算得上是继联盟链Quorum(基于raft共识)部署流程(二)的续篇 我的演示系统环境时 Ubuntu 18.04 LTS. 环境要求: DockerDocker-Compose 安装方法见下 ...

  4. 第06篇 部署区块链浏览器(1)

    本文基于POA联盟链部署开源区块链浏览器. 浏览器源码选用:https://github.com/carsenk/explorer 操作系统:centos_7_06_64 查找文件或目录: find ...

  5. 16. Fabric2.2 区块链农产品溯源系统 - 区块链浏览器部署(Fabric Explorer)

    匹配Fabric2.2 版本的区块链浏览器部署. 1.在/root下创建目录explorer 2. 构建以下目录,其中pgdata.walletstore目录是运行时动态创建的数据库,如果重新部署区块 ...

  6. Ubuntu部署 Blockscout 区块链浏览器流程

    Ubuntu部署 Blockscout 区块链浏览器流程 基础环境安装 Erlang 和 Elixir # 安装最新的erlang包源,不执行这一步,无法安装最新版本的erlang wget http ...

  7. docker部署fisco bcos区块链浏览器

    首先你要搭建一个myql数据库(理论上mariadb也支持),并创建一个数据库,再建个账号给区块链浏览器使用,如: CREATE DATABASE `fisco` CHARACTER SET utf8 ...

  8. (Fabric学习八)部署区块链浏览器Hyperledger explorer

    区块链浏览器Hyperledger explorer: 区块链浏览器:官方网站https://github.com/hyperledger-labs/blockchain-explorer 可以看到他 ...

  9. FISCO-BCOS学习——区块链浏览器搭建

    注意: 本系列文章遇到的问题都可以参考查找 官方文档 或 本系列问题总结! FISCO-BCOS 及 WeBase 问题记录 FISCO-BCOS 官方文档 WeBase 官方文档 FISCO BCO ...

最新文章

  1. 假设你有一个多层感知机网络(MLP),输入层有10个节点、一个单隐层共50个神经元,最后是一个3个神经元的输出层。请问网络的结构是什么样子的使用数学形式进行描述?
  2. 以get方式传递json字符串问题。
  3. 在php中插入数据显示在html_PHP中的浮点型数据计算之程序员脱发问题
  4. PHP专题-开发基础(七)
  5. string replace
  6. 矩形波如何傅立叶展开_金科文化会不会连续拉板?两位同学展开激辩
  7. java home bin java home jre bin_Tomcat 启动找不到配置好的 $JAVA_HOME和$JRE_HOME 变量?
  8. ldap java 对象 存储_java - 修改UID在LDAP存储库 - SO中文参考 - www.soinside.com
  9. fpga学习——zynq图像处理中的DVP流接口封装
  10. AcWing 2005. 马蹄铁(DFS)
  11. nios2 c语言编程方法nios2系列教程,nios2 c语言编程方法
  12. win10 高分屏显示模糊的解决办法
  13. Matlab 指定分辨率保存图片
  14. 基于51控制的人体感应灯
  15. ST-LINK使用注意
  16. Java调用Zebra800条码打印机
  17. Android 与其他基于 Linux 的系统有何不同?
  18. java[逾期检测]开发图书租借系统
  19. Jquery中把一段html代码动态写入到DIV中(简单实例)
  20. 广东海洋大学微型计算机控制技术,电容式液位传感器的设计.pdf

热门文章

  1. 紫色商务对比关系图表PPT模板
  2. 异常检测阅读笔记《Inpainting Transformer for Anomaly Detection》CVPR 2021
  3. 2021年熔化焊接与热切割考试及熔化焊接与热切割作业考试题库
  4. 测试员在面试中被问到 “你对加班的看法” 该如何回答?
  5. 【AWS云从业者基础知识笔记】——模块6:安全
  6. 计算机开机显示接口,电脑开机提示reboot and select proper boot device处理办法大全
  7. 照片游技术会取代街景车吗?
  8. Intel还是跪了,成功夺得台积电3nm工艺产能,苹果出局
  9. 编织信用“大数据”平台 让诚信归位
  10. iOS 图片转NSData