30. (README.md の編集内容サンプル)
# My HelloWorld Network
## Overview
はぢめての Hyperledger Composer Playground
## Licencing
This code is licensed under MIT.
## Copyright
2017 K.Kimura @ IBM Japan all rights reserved.
33. (Model ファイルの編集内容サンプル (1) )
/**
* New model file
*/
/* 名前空間 */
namespace com.ibm.japan.model
/* Participants */
participant User identified by id{
o String id
o String name
o String[] email optional
}
id をキーとする User という名前の Participant
User の構造体の定義
- 通常のプロパティは o を付けて定義
- 利用可能な型は String, Double, Long, Integer, Boolean, DateTime
- 配列の指定も可能(後ろに [])
- オプションプロパティは optional と指定
34. (Model ファイルの編集内容サンプル (2) )
/* Assets */
asset Item identified by id{
o String id
o String name
o Integer price optional
--> User owner
}
/* Transaction */
transaction ChangeOwnerTx{
--> Item item
--> User user
}
id をキーとする Item という名前の Asset
Item の構造体の定義
- Asset とほぼ同様
- 他の Asset や User との関連を示すプロパティは --> を接頭辞とする
ChangeOwnerTx という名前の Transaction
インターフェースの定義のみ
- Item 型の item と、User 型の user をパラメータとする
実装は後述の Script 内