Centos7 quickly build a fabric 1.0 environment

Source: Internet
Author: User
Tags install go
This is a creation in Article, where the information may have evolved or changed.

Installing Docker

Yum-y Install Docker
Docker version
To enable the Docker official China Zone Accelerator:
Vim/etc/sysconfig/docker
--registry-mirror=https://registry.docker-cn.com
Service Docker start

Installing Docker-compose

Yum-y Install Epel-release
Yum-y Install Python-pip
Pip Install--upgrade pip
Pip Install Docker-compose

Install Go

wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
TAR-XVF go1.8.3.linux-amd64.tar.gz
MV go/usr/local/
Mkdir-p/root/golang
Vim/etc/profile
Export Gopath=/root/golang
Export path= $PATH:/usr/local/go/bin: $GOPATH/bin
Source/etc/profile
Ln-s $GOPATH/opt/gopath

Install Git

Yum-y Install git

Fabric Source Download

git clone https://github.com/hyperledger/fabric $GOPATH/src/github.com/hyperledger/fabric
git clone https://github.com/hyperledger/fabric-ca $GOPATH/src/github.com/hyperledger/fabric-ca
Or
Go get github.com/hyperledger/fabric
Go get Github.com/hyperledger/fabric-ca

Fabric Docker image Download

CD $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli/
SOURCE Download-dockerimages.sh-c x86_64-1.0.0-f x86_64-1.0.0

Start the fabric network and complete the Chaincode test

CD $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli/
./network_setup.sh Up
1 Compile the program to generate the fabric Public private key, certificate, program in directory: Fabric/release/linux-amd64/bin
2 Generate Genesis blocks and channel-related information based on Configtx.yaml and save them in the Channel-artifacts folder.
3 generate the Public private key and certificate information based on CRYPTO-CONFIG.YAML and save it in the Crypto-config folder.
4 fabric container Based on the Docker-compose-cli.yaml boot 1orderer+4peer+1cli.
5 When the CLI starts, it runs the scripts/script.sh file, which contains functions such as creating channel, adding channel, installing EXAMPLE02, running EXAMPLE02, and so on.

Test the Fabric network manually

Docker exec-it CLI Bash
The following command can query the balance of a account
Peer Chaincode query-c mychannel-n mycc-c ' {"Args": ["Query", "a"]} '
Re-transfer the balance of account A to the B account by 20 yuan
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", "20"]} '
Check the balance of a account
Peer Chaincode query-c mychannel-n mycc-c ' {"Args": ["Query", "a"]} '

Close Fabric Network

CD $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli/
./network_setup.sh Down

Reference documents

Quickly build a Fabric 1.0 environment
Http://www.cnblogs.com/studyzy/p/7437157.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.