์•ˆ๋…•ํ•˜์„ธ์š”?

์ด๋ฒˆ ๊ธ€์—์„œ๋Š” Fabric V1.0 ์„ ๊ธฐ๋ฐ˜์œผ๋กœ CA(Certificate Authority) ์ฆ‰, v0.6 ์—์„œ๋Š” Membership Service ๋ฅผ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ด…๋‹ˆ๋‹ค.

1. Fabric CA ํŠน์ง•

์ƒˆ๋กœ์šด ๋ฒ„์ „์˜ Fabric v1.0 ์—์„œ๋Š” Certificate Authority๋ฅผ ์ œ๊ณตํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด์ „๋ฒ„์ „ ์ฆ‰, Fabric v0.6์—์„œ๋Š” Membership Service๋กœ ์กด์žฌํ•˜๋˜ ์ปดํฌ๋„ŒํŠธ ์ž…๋‹ˆ๋‹ค.
๋ณ€ํ™”๋œ ๋Œ€ํ‘œ์ ์ธ ๊ธฐ๋Šฅ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • ํด๋Ÿฌ์Šคํ„ฐ๋ง ์ง€์› (High Availability>
  • ์‚ฌ์šฉ์ž ์ •๋ณด์™€ ์ธ์ฆ์„œ๋ฅผ ๋ณด๊ด€ํ•˜๊ธฐ ์œ„ํ•œ ์ €์žฅ์†Œ ์„ ํƒ ๊ฐ€๋Šฅ (PostgreSQL, MySQL, LDAP)
  • Fabric CA Client, REST API ์ง€์›

์‹ค์ œ ๋ธ”๋ก์ฒด์ธ์„ ์šด์˜ํ™˜๊ฒฝ์— ์ ์šฉํ•˜๊ธฐ ์œ„ํ•œ ์•„ํ‚คํ…์ฒ˜๋ฅผ ๊ณ ๋ คํ•  ๋•Œ ์™ธ๋ถ€์—์„œ ํ˜ธ์ถœํ•ด์•ผํ•˜๋Š” ๋Œ€์ƒ์˜ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ํด๋Ÿฌ์Šคํ„ฐ๋ง์ด ๋ถˆ๊ฐ€๋Šฅํ•œ ์ ์— ๋Œ€ํ•ด์„œ ๊ฐ€์žฅ ํž˜๋“ ์ ์ด์—ˆ์Šต๋‹ˆ๋‹ค.
๋Œ€ํ‘œ์ ์ธ ์ปดํฌ๋„ŒํŠธ๊ฐ€ Membership Service ์˜€๋Š”๋ฐ ํ˜„์žฌ ๋ฒ„์ „๋ถ€ํ„ด ํด๋Ÿฌ์Šคํ„ฐ๋ง์„ ์ง€์›ํ•˜๊ณ  ๊ทธ์— ๋”ฐ๋ผ ์‚ฌ์šฉ์ž ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ์ €์žฅ์†Œ๋„ ์„ ํƒ๊ฐ€๋Šฅํ•˜๋‹ˆ ์ •๋ง ๋งŽ์€ ๋ถ€๋ถ„์ด ๊ฐœ์„ ๋˜์—ˆ๋‹ค๊ณ  ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋ณ€ํ™”๋œ ๊ธฐ๋Šฅ์— ๋Œ€ํ•ด์„œ ์•„๋ž˜ ๊ทธ๋ฆผ์—์„œ ํ•œ ๋ˆˆ์— ์„ค๋ช…์„ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

2. Fabric CA Server ์„ค์ •ํ•˜๊ธฐ

์ด๋ฒˆ ์„ค์ •์—์„œ๋Š” MySQL ์„ ์ €์žฅ์†Œ๋กœ ์„ค์ •ํ•˜๋ฉด์„œ Fabric CA Client๋กœ ์ƒˆ๋กœ์šด ์œ ์ €๋ฅผ ์ƒ์„ฑํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
์„ค์ • ํŽธ์˜์„ฑ์„ ๊ณ ๋ คํ•ด์„œ ubuntu docker image๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์„ค์ •ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.(Docker์˜ ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•œ ์„ค๋ช…์€ ํ•˜์ง€ ์•Š๊ฒ ์Šต๋‹ˆ๋‹ค.)

์‚ฌ์ „ ์ค€๋น„ ํ™˜๊ฒฝ

  • Docker ๊ธฐ๋ฐ˜ ubuntu
  • Go 1.7 ์ด์ƒ
  • GOPATH ์„ค์ •
  • libtool, libtdhl-dev, git ํŒจํ‚ค์ง€ ์„ค์น˜

์œ„์˜ ์‚ฌ์ „ ์ค€๋น„ ์‚ฌํ•ญ์ด ubuntu ์ด๋ฏธ์ง€์— ๋ชจ๋‘ ์„ค์น˜๊ฐ€ ๋˜์—ˆ์œผ๋ฉด ๋‹ค์Œ์˜ ๋ช…๋ น์„ ํ†ตํ•ด์„œ Fabric CA Server๋ฅผ ๋จผ์ € ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

go get -u github.com/hyperledger/fabric-ca/cmd/fabric-ca-server

์œ„์˜ ๋ช…๋ น์ด ์ •์ƒ์ ์œผ๋กœ ์ง„ํ–‰๋˜์—ˆ์œผ๋ฉด $GOPATH/bin ์— fabric-ca-server ์‹คํ–‰ํŒŒ์ผ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
์‹คํ–‰๋ช…๋ น์„ ํ†ตํ•ด fabric ca๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ ์ „์— ๋‹ค์Œ์˜ ๋ช…๋ น์–ด๋“ค์„ ํ†ตํ•ด์„œ fabric ca server์˜ ์„ค์ •ํŒŒ์ผ๋“ค์ด ์ƒ์„ฑ๋  ์œ„์น˜๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

mkdir $HOME/fabric-ca
export FABRIC_CA_SERVER_HOME=$HOME/fabric-ca

๋‹ค์Œ์œผ๋กœ fabric-ca-server๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์‹คํ–‰์„ ํ•  ๋•Œ ์ฃผ์˜ํ•  ์ ์€ ๊ด€๋ฆฌ์ž์˜ ์•„์ด๋””/ํŒจ์Šค์›Œ๋“œ ์ •๋ณด๋ฅผ ๋ช…๋ น์–ด์˜ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

fabric-ca-server start -b admin:password

์œ„์˜ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ์•ž์„œ ์„ค์ •ํ•œ $FABRIC_CA_SERVER_HOME/server ๋””๋ ‰ํ† ๋ฆฌ์— “fabric-ca-server-config.yaml” ํŒŒ์ผ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
์œ ์ € ์ •๋ณด๋ฅผ Mysql์— ์ €์žฅํ•˜๊ธฐ ์œ„ํ•ด์„œ ์„ค์ •ํŒŒ์ผ์„ ์—ด์–ด์„œ Datasource ์„ค์ •์„ ํ•ฉ๋‹ˆ๋‹ค.

datasource: :@tcp(:)/?parseTime=true

Fabric CA Server๋ฅผ ์žฌ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.
(๊ธฐ์กด์— ์‹คํ–‰ํ–ˆ๋˜ ํ™”๋ฉด์—์„œ Ctrl + C ๋ฅผ ํ†ตํ•ด ์ข…๋ฃŒํ•˜๊ณ  ๋‹ค์‹œ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.)

3. Fabric CA Client ์‚ฌ์šฉํ•˜๊ธฐ

Fabric CA Server์— ํ˜ธ์ถœํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” CLI, SDK, REST API๋กœ ๊ฐ€๋Šฅํ•˜๋ฉฐ, ์ด๋ฒˆ ๊ธ€์—์„œ ๊ทธ ์‹œ์ž‘์œผ๋กœ CLI๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์œ ์ €๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•๊นŒ์ง€ ์ง„ํ–‰ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

Fabric CA Server์—์„œ์™€ ๊ฐ™์ด ubuntu ์ด๋ฏธ์ง€์— ํ•„์š”ํ•œ ์‚ฌ์ „ ์ค€๋น„ํ™˜๊ฒฝ์„ ์„ค์น˜ํ•˜๊ณ  ๋‹ค์Œ๊ณผ ๊ฐ™์ด Fabric CA Client๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

go get -u github.com/hyperledger/fabric-ca/cmd/fabric-ca-client

์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์œผ๋ฉด ๋‹ค์Œ์˜ ๋ช…๋ น์–ด๋กœ admin ์‚ฌ์šฉ์ž๋ฅผ ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค.

export FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/admin
fabric-ca-client enroll -u http://:7054

๊ทธ๋ฆฌ๊ณ , ์ƒˆ๋กœ์šด ์‚ฌ์šฉ์ž๋ฅผ ๋“ฑ๋กํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋‹ค์Œ์˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด์„œ ์‚ฌ์šฉ์ž ๋“ฑ๋ก์„ ํ•ฉ๋‹ˆ๋‹ค.

fabric-ca-client register --id.name user1 --id.secret password --id.type user --id.affiliation org1.department1

์œ„์˜ ๋ช…๋ น์–ด์—์„œ affilitation ์€ fabric-ca-server ์˜ ์„ค์ •ํŒŒ์ผ์— ๋ช…์‹œ๋˜์–ด ์žˆ๋Š” ํ•ญ๋ชฉ์œผ๋กœ ์ž‘์„ฑํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜ ๊ทธ๋ฆผ์„ ์ฐธ์กฐ๋ฐ”๋ž๋‹ˆ๋‹ค.

์—ฌ๊ธฐ๊นŒ์ง€ ๊ฐ„๋‹จํžˆ Fabric v1.0 ์˜ CA๋ฅผ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ดค์Šต๋‹ˆ๋‹ค.
๋‹ค์Œ์—” ๋“ฑ๋ก๋œ ์‚ฌ์šฉ์ž๋ฅผ ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•˜๋Š”์ง€์™€ ํด๋Ÿฌ์Šคํ„ฐ ์„ค์ •๋“ฑ์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

8 ๊ฐœ์˜ ๋Œ“๊ธ€"๋ณธ๊ฒฉ์ ์œผ๋กœ ์‹œ์ž‘ํ•˜๋Š” ๋ธ”๋ก์ฒด์ธ
  โ€“ 03 โ€“ 

Fabric CA ์‚ฌ์šฉํ•˜๊ธฐ"

  1. ReoDongminLee 4์›” 05, 2017

    ์•ˆ๋…•ํ•˜์„ธ์š” ๊ณต๋ฌด์ œ๋‹˜. ํฌ์ŠคํŒ… ์ •๋ง ์ž˜ ๋ณด๊ณ  ๋ฐฐ์šฐ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
    ๋ณธ๊ฒฉ์ ์œผ๋กœ ์‹œ์ž‘ํ•˜๋Š” ๋ธ”๋ก์ฒด์ธ 01ํŽธ์— Node sdk ์†Œ์Šค ๋ฐ›์•„์˜ค๋Š” ๋ถ€๋ถ„ github ๋ธŒ๋ Œ์น˜ v1.0-alpha ๊ฐ€ ์—†์–ด์ ธ์„œ ์˜ฌ๋ ค์ฃผ์‹  curl ๋ช…๋ น์–ด๋กœ ์†Œ์Šค๋ฅผ ๋ฐ›์•„์˜ค๋ฉด ๋นˆ ํŒŒ์ผ๋“ค์ด ํ˜•์„ฑ ๋ฉ๋‹ˆ๋‹ค.
    2์ผ ์ „๊นŒ์ง€๋งŒ ํ•ด๋„ ๋ฌธ์ œ์—†์ด ํ…Œ์ŠคํŠธ ํ–ˆ์—ˆ๋Š”๋ฐ ์ตœ๊ทผ์— ๋ฐ”๋€๋“ฏ ํ•ด์š”. ํ˜„์žฌ๋Š” master branch๋งŒ ์žˆ์–ด์„œ
    curl -OOOOOO https://raw.githubusercontent.com/hyperledger/fabric-sdk-node/master/examples/balance-transfer/{config.json,deploy.js,helper.js,invoke.js,query.js,package.json}
    ์ด๋ ‡๊ฒŒ ๋ฐ”๊ฟ” ์ฃผ์…”์•ผ ํ• ๋“ฏ ํ•ฉ๋‹ˆ๋‹ค.

    • ๊ณต๋ฌด์ œ 4์›” 06, 2017

      ์•ˆ๋…•ํ•˜์„ธ์š”?
      ๊ด€์‹ฌ์žˆ๊ฒŒ ๋ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋ง์”€ํ•ด์ฃผ์‹  ๋ถ€๋ถ„์€ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
      Fabric์ด ๋น ๋ฅด๊ฒŒ ๊ฐœ๋ฐœ๋˜๊ณ  ์žˆ์–ด์„œ ๋ณ€ํ™”๋˜๋Š” ๋ถ€๋ถ„์ด ๋งŽ์Šต๋‹ˆ๋‹ค. ๋ฒŒ์จ ์›๋ฌธ ์‚ฌ์ดํŠธ์—๋Š” Getting started ์˜ ๋‚ด์šฉ์ด ์—…๋ฐ์ดํŠธ ๋˜์—ˆ๋„ค์š”.
      ์กฐ๋งŒ๊ฐ„ ์ „๋ฐ˜์ ์œผ๋กœ ์—…๋ฐ์ดํŠธ ํ•ด์•ผ๊ฒ ์Šต๋‹ˆ๋‹ค.

  2. fabric-ca-client register –id.name user1 –id.secret password –id.type user –id.affiliation org1.department1
    ์ด ๋ช…๋ น์–ด๋ฅผ ์น˜๋ฉด, ์•„๋ž˜์™€ ๊ฐ™์€ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๊ฐ€ ๋‚˜์˜ต๋‹ˆ๋‹ค.
    Error: Enrollment information does not exist. Please execute enroll command first. Example: fabric-ca-client enroll -u http://user:userpw@serverAddr:serverPort
    ๊ทธ๋ž˜์„œ,
    fabric-ca-client enroll -u http://user1:user1@localhost:7054
    ์„ ํ•˜๋ฉด,
    Error: Error response from server was: Authorization failure ๊ฐ€ ๋œน๋‹ˆ๋‹ค..
    ์•ฝ๊ฐ„์˜ ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ณด์•˜๋Š”๋ฐ์š”, $HOME/fabric-ca/fabric-ca-server-config.yaml์˜ identities์—์„œ ์‚ฌ์šฉ์ž๋ฅผ ์ง์ ‘ ์ถ”๊ฐ€์‹œ์ผœ์ค˜์•ผ enrollment๊ฐ€ ๋˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. config ํŒŒ์ผ ์ˆ˜์ •ํ•˜์ง€ ์•Š๊ณ  ์ปค๋งจ๋“œ๋ผ์ธ์œผ๋กœ ๋™์ ์œผ๋กœ ์ผ๋ฐ˜ client๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์—†์„๊นŒ์š”?… ์ ์–ด์ฃผ์‹  ๋ฐฉ๋ฒ•์€ (์•„๋งˆ) ๋ฒ„์ „ ์ฐจ์ด ๋•Œ๋ฌธ์— ์•ˆ ๋˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  3. fabric 0.6 ๊ฐ„์‹ ํžˆ ๋ฐฐ์›Œ ๋†“์•˜๋Š”๋ฐ, 1.0 ์—์„œ๋„ ๋งŽ์€ ๋ณ€ํ™”๊ฒŒ ์žˆ๋„ค์š” TT
    ์ฒ˜์Œ ๋ฐฐ์šฐ์‹œ๋Š” ๋ถ„๋“ค์€ docker ์— ์–ด๋Š์ •๋„ ์ต์ˆ™ํ•ด์ง€์‹œ๋ฉด, ํฐ ๋ฌด๋ฆฌ ์—†์„ ๋“ฏ ํ•ฉ๋‹ˆ๋‹ค.

  4. ์ถ”๊ฐ€์ ์œผ๋กœ ์งˆ๋ฌธ ์‚ฌํ•ญ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
    ๊ฐ•์ขŒ์—์„œ
    “๊ฐœ๋ฐœ๋œ ์ฒด์ธ์ฝ”๋“œ๋Š” ์‹คํ–‰์ค‘์ธ Validating Peer ์ปจํ…Œ์ด๋„ˆ๋กœ ๋ณต์‚ฌ๋ฅผ ํ•ด์„œ deploy๋ฅผ ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค”
    ์ด ๋ถ€๋ถ„์„ ๊ตฌ์ฒด์ ์œผ๋กœ ์–ด๋–ป๊ฒŒ ํ•˜๋Š”์ง€ ์„ค๋ช…์„ ์ถ”๊ฐ€ํ•ด ์ฃผ์‹œ๋ฉด ์•ˆ๋ ๊นŒ์š”?
    ๋‹ค๋ฅธ ๋ถ€๋ถ„์€ ๋‹ค ๋˜๋Š”๋ฐ, ์ด ๋ถ€๋ถ„๋งŒ ์•ˆ๋˜์–ด์„œ query ๊ฐ€ ์•ˆ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ~~;:

  5. enrollID ํ• ๋•Œ, membersrvc.yaml ๊ฐ€ ์•„๋‹Œ core.yaml ์— ์žˆ๋Š” vp ๋‚˜ user ๊ฐ’์„ ์‚ฌ์šฉํ•˜๋ฉด query ๊ฐ€ ์ œ๋Œ€๋กœ ๋˜๋„ค์š”.

  6. Error endorsing chaincode: rpc error: code = 2 desc = Illegal file mode detected for file src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02/chaincode_example02.go: 100755

    ํ˜„์žฌ 1.0 ์•ŒํŒŒ ๋ฒ„์ „์— ์ด๋Ÿฐ ์—๋Ÿฌ๊ฐ€ ์žˆ์–ด์„œ ๊ทธ๋Ÿฐ์ง€, chaincode ์„คใ……๋ถ€๋ถ„์—์„œ ์œ„์™€ ๊ฐ™์€ ์—๋Ÿฌ ๋‚˜์˜ต๋‹ˆ๋‹ค. 4์›” 17์ผ ๋ฒ„์ „ ๋ถ€ํ„ฐ ์ˆ˜์ •ํ–ˆ๋‹ค๊ณ  ํ•˜๋Š”๋ฐ, ํ˜„์žฌ ์Šคํƒ€ํŠธ ๋ฒ„์ „์—” ๋ฐ˜์˜ ์•ˆ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค. ๊ฑด๊ฐ•์‹œ ์•ˆ์ „ํ™” ๋œ ์ดํ›„๋‚˜ ํ•ด๋ณด์‹œ๋Š” ๊ฒŒ ์ข‹์„ ๋“ฏ ํ•ฉ๋‹ˆ๋‹ค. TT ์•„๋‹˜ ๋ธ”๋ก์ฒด์ธ ๋„คํŠธ์›Œํฌ ํ™˜๊ฒฝ์€ ibm ํด๋ผ์šฐ๋“œ๋ฅผ ์“ฐ์‹œ๋Š” ๊ฒŒ ์ข‹์€๋“ฏ.

  7. ใ„ดใ…‡ใ„ดใ…‡ 10์›” 08, 2017

    bluemix ๊ฐ€์ž…ํ•˜๊ณ  ๋ธ”๋ก์ฒด์ธ ์„œ๋น„์Šค ์‹คํ–‰ํ•  ๋•Œ
    pricing plan์—์„œ free๊ฐ€ ์—†๊ณ  enterprise member plan (์œ ๋ฃŒ ์›” 1000๋‹ฌ๋Ÿฌ) ๋ฐ–์— ์•ˆ๋œจ๋Š”๋ฐ ์™œ ๊ทธ๋Ÿด๊นŒ์š”?ใ… 

ํ† ๋ก  ์ฐธ๊ฐ€

์ด๋ฉ”์ผ์€ ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ์ž…๋ ฅ์ฐฝ์€ * ๋กœ ํ‘œ์‹œ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.