第一次安装fabric有很多坑。记录一下,主要跟版本问题。

参考的是http://www.cnblogs.com/aberic/p/7532114.html 这篇博客。

我用的阿里云centOs 7.X的版本。

前面安装go,docker的过程不在描述。

安装完docker后下载fabric源码。

mkdir –p ~/go/src/github.com/hyperledger 
cd ~/go/src/github.com/hyperledger 
用git命令下载完整源码 
git clone https://github.com/hyperledger/fabric.git

切换到1.0.0版本

git checkout v1.0.0

后面通过 ~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/ 下执行 ./download-dockerimages.sh 下载镜像。 这种方法下载的镜像一直启动报错,具体错误信息错过了截不到了。总之跟peer启动不了有关。

后来参考 https://blog.csdn.net/yeasy/article/details/54928343这个博客下载镜像的部分。镜像下载成功以后启动依然不错。网上有人说需要把官方提供的二进制文件放到  go/src/github.com/hyperledger/fabric/examples/e2e_cli/这个项目的bin下,也有人说应该放到

go/src/github.com/hyperledger/fabric的release。第一种尝试失败。第二种尝试,发现我下载的源码没有release文件夹。后来查阅,发现需要在 go/src/github.com/hyperledger/fabric下,执行 make release方法生成release文件夹,也会自动产生对应的二进制文件

执行 go/src/github.com/hyperledger/fabric/examples/e2e_cli/network_setup.sh up.

启动成功!

我的路径是放在 /root/go/src下的。前面为了怕误导他人,没有加root路径。实际是有的。

启动网络的过程也实例化了一个chainCode,名字是mycc。

所以在上步之后,先 ctrl+c退出当前。后台不会退出。然后执行docker exec -it cli bash 进入peer下。

执行 :peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'   如下:

root@d5f2911e3007:/go/src/github.com/hyperledger/fabric/peer# peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'

这个是查询账户a余额的命令。可以看到余额是90.

执行:peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","50"]}'  由a账户转账50到b账户。

root@d5f2911e3007:/go/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","50"]}'

这里的 /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem 我尝试改成我自己linux系统的实际路径,发现失败。报错文件找不到。

Error: Error getting broadcast client: Error connecting to orderer.example.com:7050 due to open /root/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem: no such file or directory。

个人猜测可能源码内部只识别此路径。但是这个路径实际是没有文件的,所以可能是个虚拟路径。(有待学习)。

转账以后再查看a账户,

到这里基本就结束了,

exit

./network_setup down

Hyperledger Fabric 第一次安装的更多相关文章

  1. Ubuntu下配置Hyperledger Fabric环境

    在win10系统的台式机上安装配置Hyperledger Fabric环境 安装Ubuntu 16.04 双系统 镜像下载地址:https://www.ubuntu.com/download/desk ...

  2. 使用docker加载已有镜像安装Hyperledger Fabric v1.1.0

    背景 每次在新的服务器上安装Hyperledger Fabric网络时,通过fabric官方提供的脚本安装时,需要从网络上down下近10G的fabric相关镜像,这个过程是漫长及痛苦的,有时因网络问 ...

  3. Ubuntu16.04下安装Hyperledger Fabric 1.0.0

    系统环境 * Ubuntu: 16.04 * Go: 1.9.2 * NodeJS: v6.12.0 * Docker: 17.09.0-ce * HyperLedger Fabric: 1.0.0 ...

  4. Fedora 25-64位操作系统中安装配置Hyperledger Fabric过程

    安装过程参照Hyperledger Fabric的官方文档,文档地址:http://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html 0 ...

  5. Hyperledger fabric 1.3版本的安装部署(原创多机多Orderer部署

    首先,我们在安装前,要考虑一个问题 Hyperledger Fabric,通过指定的节点进行背书授权,才能完成交易的存储 延伸开来,就是为了实现容错.高并发.易扩展,需要zookeeper来选择排序引 ...

  6. 安装hyperledger fabric V1.0.1

      安装文档位置: https://github.com/hyperledger/fabric   fabric代码托管地址 https://hyperledger-fabric.readthedoc ...

  7. 安装hyperledger fabric V1.0.0-beta

      安装文档位置: https://github.com/hyperledger/fabric   fabric代码托管地址 https://hyperledger-fabric.readthedoc ...

  8. Hyperledger Fabric v1.1.0安装记录(国内源版)

    1. 安装虚拟机     虚拟机软件采用:VirtualBox     操作系统选择:Ubuntu 14.04     内存:4G     CPU:2核     硬盘:20G     2.(可选)更改 ...

  9. (三)Hyperledger Fabric 1.1安装部署-chaincode测试

    环境搭建完毕,需要的工具和镜像安装完毕,就可以进行chaincode测试了,接下来参考官方教程运行first-network. 进入first-netwok: cd first-network fir ...

随机推荐

  1. x86 寻址学习

    x86 寻址方式众多,什么直接寻址.间接寻址.基址寻址.基址变址寻址等等让人眼花缭乱,而 AT&T 语法对内存寻址方式做了一个很好的统一,其格式为 section:displacement(b ...

  2. Java for LeetCode 120 Triangle

    Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n ...

  3. HDU - 2612 Find a way 【BFS】

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=2612 题意 有两个人 要去一个城市中的KFC 一个城市中有多个KFC 求两个人到哪一个KFC的总时间最 ...

  4. OC中RAC编程block的基本使用

    在OC中block的基本使用 // // ViewController.h // RAC--test // // Created by Aaron on 17/1/17. // Copyright © ...

  5. linux下安装https证书

    https://www.aliyun.com/jiaocheng/165422.html

  6. 3D文字特效

    在线演示 本地下载

  7. git format-patch的使用【转】

    本文转载自:http://blog.chinaunix.net/uid-28621021-id-3487102.html git format-patch的使用   1.在dev1分支上,打出所有de ...

  8. struts + hibernate笔记

    1.hibernate: 1) Restrictions.eq  判断是否相等== (场景:一个类A中的属性t,这个属性t是另一个类B中的ID,找出输入为这个属性t的所有类A) tasks = ses ...

  9. Linux CentOS系统上安装Eclipse

    Linux CentOS系统上安装Eclipse 1. 下载Eclipse软件 下载网址:http://www.eclipse.org/downloads/packages/release/Juno/ ...

  10. Spring Boot2.0之注解方式启动Springmvc

    回顾下springmvc原理图: DispatcherServlet是Spring MVC的核心,每当应用接受一个HTTP请求,由DispatcherServlet负责将请求分发给应用的其他组件. 在 ...