[블록체인] - 하이퍼레저 패브릭 v1.4 환경 설정 : 설치 및 실행

jsbak·2021년 9월 14일
0

BlockChain

목록 보기
5/6
post-thumbnail

🅱 하이퍼레저 패브릭 설치 및 실행

하이퍼레저 패브릭 1.4.x 버전

참고 링크 : 1, 2

📒 1. 하이퍼레저 패브릭 설치

$  cd $GOPATH/src
  • 최신 버전으로 설치
curl -sSL https://bit.ly/2ysbOFE | bash -s
  • 특정 버전으로 설치하고 싶은 경우
$ curl -sSL https://bit.ly/2ysbOFE | bash -s -- <fabric_version> <fabric-ca_version>
  • 안정화 1.4 : ⭕최신버전 으로 깔아야함.⭕
    $ curl -sSL https://bit.ly/2ysbOFE | bash -s -- 1.4.12 1.4.9 0.4.22
  • 책 설치 버전 : ❌책 버전으로 하면 나중에 체인코드 개발에 문제 생김❌
    $ curl -sSL https://bit.ly/2ysbOFE | bash -s -- 1.4.3 1.4.3 0.4.15

이렇게 설치하면 Samples , Binaries, Docker Images가 설치되는것을 터미널을 통해 확인 가능

📒 2. 하이퍼레저 패브릭 테스트 네트워크 동작 확인

  • fabric-samples 가 있는 위치로 이동
$ cd $GOPATH/src
  • fabric-sample/test-network로 이동
$ cd fabric-samples/first-network

network.sh 라는 쉡 스크립트 파일을 통해 로컬 시스템의 Docker 이미지를 사용하여 Fabric 네트워크를 시작할 수 있다.

  • 스크립트 도움말 보기
$ ./byfn.sh -h
Usage: 
  byfn.sh <mode> [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>] [-l <language>] [-o <consensus-type>] [-i <imagetag>] [-a] [-n] [-v]
    <mode> - one of 'up', 'down', 'restart', 'generate' or 'upgrade'
      - 'up' - bring up the network with docker-compose up
      - 'down' - clear the network with docker-compose down
      - 'restart' - restart the network
      - 'generate' - generate required certificates and genesis block
      - 'upgrade'  - upgrade the network from version 1.3.x to 1.4.0
    -c <channel name> - channel name to use (defaults to "mychannel")
    -t <timeout> - CLI timeout duration in seconds (defaults to 10)
    -d <delay> - delay duration in seconds (defaults to 3)
    -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)
    -s <dbtype> - the database backend to use: goleveldb (default) or couchdb
    -l <language> - the chaincode language: golang (default) or node
    -o <consensus-type> - the consensus-type of the ordering service: solo (default), kafka, or etcdraft
    -i <imagetag> - the tag to be used to launch the network (defaults to "latest")
    -a - launch certificate authorities (no certificate authorities are launched by default)
    -n - do not deploy chaincode (abstore chaincode is deployed by default)
    -v - verbose mode
  byfn.sh -h (print this message)

Typically, one would first generate the required certificates and 
genesis block, then bring up the network. e.g.:

	byfn.sh generate -c mychannel
	byfn.sh up -c mychannel -s couchdb
        byfn.sh up -c mychannel -s couchdb -i 1.4.0
	byfn.sh up -l node
	byfn.sh down -c mychannel
        byfn.sh upgrade -c mychannel

Taking all defaults:
	byfn.sh generate
	byfn.sh up
	byfn.sh down
  • generate : 각종 필요한 인증서들을 생성하고 제네시스 블록을 생성
  • up : First Network를 시작
  • down : Frist Network를 종료

byfn.sh generate를 이용해 제네시스 블록 및 인증서를 생성

./byfn.sh generate

byfn.sh up으로 네트워크 가동

./byfn.sh up

byfn.sh down으로 네트워크 종료

./byfn.sh down

하이퍼레저 컴포저 개발 환경 구성

하이퍼 레저 컴포저 Installing the development environment

설치 쉘 스크립트
0. 자기 폴더로 이동 cd ~
1. curl -O https://hyperledger.github.io/composer/latest/prereqs-ubuntu.sh
2. chmod u+x prereqs-ubuntu.sh
3. ./prereqs-ubuntu.sh

• Step 1 컴포저 도구 설치

  1. 필수 CLI 도구 설치 : npm install -g composer-cli@0.20

  2. composer-rest-server 설치 -> RESTful API로 비즈니스 네트워크를 노출하기 위해 컴퓨터에 REST 서버를 실행하는 유틸리티 npm install -g composer-rest-server@0.20

  3. 응용 프로그램 assets 생성에 유용한 유틸리티 npm install -g generator-hyperledger-composer@0.20

  4. Yeoman은 응용 프로그램을 생성하기 위한 툴, 그리고 그것은 generator-hyperledger-compose 유틸리티들이다. npm install -g yo

• Step 2: Playground 설치 npm install -g composer-playground

누구라도 쉽게 블록체인 네트워크 개발과 관리, 테스트 등을 할 수 있는 웹 기반 개발, 운영 관리 도구
npm install -g composer-playground
composer-playground




하이퍼레저 컴포저 README.md
하이퍼레저 컴포저 사이트

As of the 29th August 2019, the Hyperledger Composer project is in deprecated status. None of the maintainers are actively developing new features. None of the maintainers are actively providing support via GitHub issues. However, if you wish to submit code changes via pull requests, these will be merged.

It is highly recommended that you use Hyperledger Fabric v1.4+ instead, which features significant improvements to the developer experience, including a new programming model.

⚠️ ⚠️ ⚠️
2019년 8월 29일부로 Hyperledger Composer 프로젝트는 더 이상 사용되지 않는 상태입니다. 유지 관리자 중 누구도 새로운 기능을 적극적으로 개발하지 않습니다. 유지 관리자 중 누구도 GitHub 문제를 통해 적극적으로 지원하지 않습니다. 그러나 pull 요청을 통해 코드 변경 사항을 제출하려는 경우 이러한 변경 사항이 병합됩니다.

새로운 프로그래밍 모델을 포함하여 개발자 경험이 크게 개선된 Hyperledger Fabric v1.4+를 대신 사용하는 것이 좋습니다.
⚠️ ⚠️ ⚠️

패브릭과 컴포저

As of the 29th August 2019, the Hyperledger Composer project is in deprecated status. You can still use it, but thinking for the future it is better to start with fabric docs. And now the fabric tutorials are much improved.

2019년 8월 29일부로 Hyperledger Composer 프로젝트는 더 이상 사용되지 않는 상태입니다. 여전히 사용할 수 있지만 미래를 위해 패브릭 문서로 시작하는 것이 좋습니다. 이제 패브릭 튜토리얼이 훨씬 개선되었습니다.

Hyperedger Fabric: Hyperledger Fabric은 Hyperledger 프레임워크 중 하나입니다. Enterprise 응용 프로그램을 구축하는 데 일반적으로 사용되는 개인 권한이 부여된 블록체인입니다.

Hyperledger Composer: Hyperledger Framework의 도구 중 하나입니다. 이 도구의 주요 목적은 Hyperledger Fabric Framework에 비해 더 짧은 시간에 Blockchain 응용 프로그램을 개발하는 것입니다.

두 가지의 주요 차이점

  • Hyperledger Composer의 도움으로 블록체인 애플리케이션을 개발하는 것이 훨씬 쉽고 빠릅니다.
  • Hyperledger Composer의 체인코드는 자바스크립트로만 작성할 수 있습니다.
  • Hyperledger Composer는 연결 파일을 통해 주요 구성 요소를 활용하여 Hyperledger Fabric 네트워크 위에 구축됩니다.
profile
끄적끄적 쓰는곳

1개의 댓글

comment-user-thumbnail
2023년 2월 9일

책보면서 설치하다가 오류로 너무 힘들었는데 덕분에 설치 성공했습니다..감사합니다...

답글 달기