원서 : https://hyperledger-fabric.readthedocs.io/en/release-1.4/developapps/smartcontract.html

  • Smart Contract Processing
    • blockchain-network의 핵심은 머니머니해도 smart-contract입니다. PaperNet에서는 smart-contract으로 '기업어음'의 유효상태 및 상태를 전이하는 'transaction 로직' 을 정의하였습니다.
    • 그래서 이번장에서는 실제 '기업어음'을 발행, 구매, 상환 하는 smart-contract를 어떻게 개발하는지? 알아보려고 합니다.
  • Smart Contract (What is a smart contract and why it’s important)
    • smart-contract는 '비지니스 대상의 상태' 와 '그 상태변화 처리방법' 을 정의한다고 볼수있습니다.
    • 즉,  blockchain-network상에서 서로다른 organization간에 주고받는 데이터 및 프로세스라는것 입니다.
    • PaperNet에서 smart-contract는 서로다른 참여자들에게 모두 공유가 되고, 모두 똑같은 버전의 smart-contract를 함께 써야 합니다.
  • Contract class (How to define a smart contract)
    • '기업어음' smart-contract는 아래와 같은 정의가 있습니다.
    • class CommercialPaperContract extends Contract {...}
      • CommercialPaperContract 클래스에는 '발행 구매 상환 transaction'가 정의됨
      • Contract 클래스를 extend 함 (built-in 클래스)
      • const { Contract, Context } = require('fabric-contract-api');
      • 이 built-in 클래스는 'per-transaction context' 'transaction handlers' 'class-shared state' 등 기능이 있죠
      • 생성자를 통해서 superclass로 초기화 하는데... 음... 이런 설명을 번역하는건 의미가 없겟네요...
      • (생략~)
    • 파일당 보통 하나의 smart-contract가 있는데, 경우에 따라서는 여러게할때도 있는데... 이렇게되면 모호해지겠죠.
  • Transaction definition (How to define a transaction)
    • async issue(ctx, issuer, paperNumber, issueDateTime, maturityDateTime, faceValue) {...}
    • async buy(ctx, issuer, paperNumber, currentOwner, newOwner, price, purchaseTime) {...}
    • async redeem(ctx, issuer, paperNumber, redeemingOwner, redeemDateTime) {...}
    • (생략~)
  • Transaction logic (How to implement a transaction)
    • issue(), buy(), redeem() transaction의 내부로직을 코드로 설명하고 있다.
    • (생략~)
  • Representing an object (How to represent a business object in a smart contract)
    • ('State'를 extend한) 'CommercialPapper'의 내부정의를 코드로 설명하고 있다.
    • (생략~)
  • Access the ledger (How to store and retrieve an object in the ledger)
    • ('StateList'를 extend한) 'PaperList'의 내부함수를 코드로 설명하고 있다.
    • (생략~)

-끝-

'hyperledger > fabDoc.Dev-App' 카테고리의 다른 글

7) Application design elements  (0) 2019.04.28
5) Application  (0) 2019.04.28
3) Process and Data Design  (0) 2019.04.28
2) Analysis  (0) 2019.04.28
1) The scenario  (0) 2019.04.28

+ Recent posts