Hyperledger

Introduction to the

Hyperledger is an umbrella term for open source projects that drive applications in the blockchain industry. Members of the organization can initiate new blockchain projects and join the Hyperledger project, but still follow the Hyperledger lifecycle.

Management structure

  • TSC is responsible for leading community development efforts.
  • A board of directors is a group of organizations and large corporations that govern the community.

background

The first open source distributed ledger platform for enterprise application scenarios. Provide an open source reference implementation for transparent, open, and decentralized enterprise-level distributed ledger technology, and promote the development of protocols, specifications, and standards related to blockchain and distributed ledger projects.

As a joint project, the Superledger consists of sub-projects for different purposes and scenarios. Projects fall into two categories: framework and tool.

Framework classes: Burrow, Hyperledger Fabric, Hyperledger Indy, Hyperledger Iroha and Hyperledger Sawtooth

Tools: Hyperledger Caliper, Hyperledger Cello, Hyperledger Composer, Hyperledger Explorer, Hyperledger Quilt and other five projects

Fabric

Introduction to the

It is the first top project to join the Superledger project. It is positioned as a distributed ledger platform for enterprises, innovatively introduces permission management support, and is designed to support pluggable, extensible, multi-channel, and multiple consensus mechanisms. It is the first open source project facing the alliance chain scenario.

Overall logical architecture

Node logical architecture

The deal architecture

Blockchain ledger data structure

Research and development of architecture

Setting up the development environment

[Environment] VM15Pro + Ubuntu20.04

Git configuration

  1. Git Curl
sudo apt-get install git
Copy the code
  1. Configure Git at the terminal
git config --global user.name "your name"
git config --global user.email "your email"
Copy the code
  1. Create a public key
ssh-keygen -C "your email" -t rsa
Copy the code

  1. Add SSH keys to github and copy all the contents in. SSH /id_rsa.pub. Go to Settings and select SSH and GPG keys.

Outside the chain picture archiving failure, the source station might be hotlinking prevention mechanism, proposed to directly upload picture preserved (img – mWFfigdn – 1620982576322) (C: \ Users \ \ Administrator \ AppData \ Roaming \ Typora \ Typora – user -images\image-20210514095148402.png)]

5. Add the key to the ssh-agent

ssh-agent bash
ssh-add ~/.ssh/id_rsa
Copy the code

6. Test, enter a value on the terminal

ssh -T [email protected]
Copy the code

Docker configuration

  1. Uninstalling an old version
sudo apt-get remove docker docker-engine docker.io containerd runc
Copy the code

  1. Set up the warehouse

    Before you first install Docker Engine on a new host, you need to set up the Docker repository. After that, you can install and update Docker from the repository. Update the APT package index

sudo apt-get update
Copy the code

Install the APT dependency, which is used to get the repository over HTTPS

sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Copy the code

Added official Docker GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Copy the code

Download the stability repository

sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
Copy the code

Install the Docker Engine

  1. Update the APT package index
sudo apt-get update
Copy the code
  1. Install the latest version of Docker Engine and ContainerD
sudo apt-get install docker-ce docker-ce-cli containerd.io
Copy the code
  1. Install a specific version of Docker Engine:
apt-cache madison docker-ce
Copy the code
  1. Installs the specified version using the version number in the second column
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
Copy the code
  1. The author directly
sudo apt-get install docker-ce
Copy the code
  1. test
sudo docker run hello-world
Copy the code

Install the Docker Compose

  1. download
Sudo curl - L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname - s) - $(uname -m)" - o /usr/local/bin/docker-composeCopy the code
  1. After downloading the executable permission will be applied in the file
sudo chmod +x /usr/local/bin/docker-compose
Copy the code
  1. Check the version
docker-compose --version
Copy the code

Install a Fabric script

  1. create
sudo mkdir -p $GOPATH/src/github.com/hyperledger
Copy the code
  1. download
cd $GOPATH/src/github.com/hyperledger
sudo git clone https://github.com.cnpmjs.org/hyperledger/fabric.git
Copy the code
  1. Viewing the version number

  2. Switch to the 1.4.7 branch

Sudo git checkout v1.4.7Copy the code

View the current branch

git branch -a
Copy the code

Pay attention to must have GCC, check whether GCC, no words by baidu installation

gcc --version
Copy the code

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.0Copy the code

The download is complete

We are still in the e2e_CLI folder, which provides automated scripts for starting and shutting down the Fabric network. We want to start the Fabric network and automatically run the Example02 ChainCode test by executing the following command:

./network_setup.sh up
Copy the code
  • Compile a program that generates Fabric public and private keys and certificates in the Fabric /release/linux-amd64/bin directory
  • Create blocks and channel information based on configTx. Yaml and save them in the channel-artifacts folder.
  • Generate public and private keys and certificate information based on crypto-config.yaml and save them in the crypto-config folder.
  • Start Fabric container 1Orderer+4Peer+1CLI based on docker-compose cli.yaml.
  • When the CLI is started, the scripts/script.sh file is run. This script file contains the functions such as creating and adding channels, installing and running Example02.