* 본 포스팅은 하이퍼레저 패브릭 docs를 번역한 내용으로, 번역 과정에서 잘못된 부분이 있을 수 있습니다.

상세 내용은 하단 링크를 참조 부탁드리며, 잘못된 내용에 대한 피드백은 언제든 환영합니다 : ) 

https://hyperledger.github.io/composer/latest/business-network/bnd-create

 

Create a Business Network Definition | Hyperledger Composer

Create a Business Network Definition A business network definition has the following layout: models/ (optional) lib/ permissions.acl (optional) package.json README.md (optional) The easiest way to create a new business network definition is to either git c

hyperledger.github.io

비즈니스 네트워크 정의는 아래 구조로 이루어져 있다.

models/ (optional)
lib/
permissions.acl (optional)
package.json
README.md (optional)

비즈니스 네트워크 정의를 생성하는 가장 쉬운 방법은 git clone에서 예제를 다운받거나 하이퍼레저 컴포저 Yeoman 제너레이터를 사용해 기본 비즈니스 네트워크를 생성하는 것이다.

 

README.md

Markdown 마크업언어를 사용하는 비즈니스 네트워크 목적에 대한 설명

 

Package.json

비즈니스 네트워크 정의는 이름 (아스키 알파벳과 -로 제한), 사람이 읽을 수 있는 description, 버전 번호를 갖고 있다. 네트워크 버전 번호는 Major.Minor.Micro 형태여야 하며 버전 번호를 올릴 때는 Semantic Versioning 원칙을 따라야 한다.

http://semver.org/

 

Semantic Versioning 2.0.0

Semantic Versioning spec and website

semver.org

네트워크 식별자는 이름, -, 버전 번호로 구성된다. 유효한 식별자는 예를 들어 mybusinessnetwork-1.0.3과 같다.

 

비즈니스 네트워크 정의의 메타데이터는 package.json에서 읽을 수 있으며, 이는 비즈니스 네트워크 정의가 npm 패키지에서도 유효함을 의미한다.

 

Models

비즈니스 네트워크 정의에 대한 일련의 도메인 모델은 네트워크 내에서 혹은 외부 시스템 (예를 들어 네트워크로 트랜잭션을 제출하는 시스템) 과 통합되었을 때 유효한 타입을 정의한다.

 

도메인 모델은 비즈니스 네트워크 정의와 패키징될 수 도 있고 (보통 models 폴더 아래 저장), 외부 종속성으로 package.json에 명시될 수도 있다. 비즈니스 네트워크 정의 간 공유하기를 원하면 npm dependency를 사용해 모델을 참조할 수도 있다.

 

 

Scripts

비즈니스 네트워크 정의 스크립트는 보통 lib 폴더 아래 저장되고 비즈니스 네트워크 정의와 함께 패키징된다. 스크립트는 ES 5 JavaScript로 작성되며 비즈니스 네트워크의 도메인 모델에 정의된 타입을 참조한다.

 

 

Permissions.acl

노출된 비즈니스 네트워크에 대한 권한은 permissions.acl 파일에 작성되기도 한다.

 

 

Cloning an Example Business Network Definition

샘플 비즈니스 네트워크 정의는 다음 Github에 저장되어 있다.

https://github.com/hyperledger/composer-sample-networks

 

hyperledger/composer-sample-networks

Sample business network definitions for Composer. Contribute to hyperledger/composer-sample-networks development by creating an account on GitHub.

github.com

이 저장소를 git clone해서 샘플 네트워크를 사용할 수 있으며, 각 샘플 네트워크는 packages 폴더 아래 저장되어 있다.

 

 

Generating a Business Network Definition

Generation

  1. yo hyperledeger-composer
? Please select the type of project: (Use arrow keys)
❯ Angular
  Business Network
  Model

 

비즈니스 네트워크를 선택한다.

  1. 아래 질문에 답변한다.
Welcome to the Hyperledger Composer project generator
? Please select the type of project: Business Network
You can run this generator using: 'yo hyperledger-composer:businessnetwork'
Welcome to the business network generator
? Business network name: mynetwork
? Description: This is my test network
? Author name:  Mr Conga
? Author email: conga@congazone.org
? License: Apache-2
? Namespace: org.conga
   create package.json
   create permissions.acl
   create README.md
   create models/org.conga.cto
   create .eslintrc.yml
   create features/sample.feature
   create features/support/index.js
   create test/logic.js
   create lib/logic.js

이는 정의된 asset, participant, transaction으로 기본 비즈니스 네트워크를 생성하며 mocha 단위테스트도 생성한다.

 

또한 이는 JS code를 위한 샘플 linting 규칙을 정의하는 eslint config file도 포함하고 있다.

 

 

+ Recent posts