建项目
首先建项目,将model写好(model设计参考数据库设计)。
cielo@cielo-ThinkPad-E550:~/cprogrames$ yo hyperledger-composer
_-----_
| | ╭──────────────────────────────────────────╮
|--(o)--| │ Update available: 2.0.6 (current: 2.0.5) │
`---------´ │ Run npm install -g yo to update. │
( _´U`_ ) ╰──────────────────────────────────────────╯
/___A___\ /
| ~ |
__'.___.'__
´ ` |° ´ Y `
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: cmusic
? Description: music first
? Author name: cielo
? Author email: cielo0@qq.com
? License: Apache-2.0
? Namespace: org.cm.music
? Do you want to generate an empty template network? Yes: generate an empty template network
create package.json
create README.md
create models/org.cm.music.cto
create permissions.acl
create .eslintrc.yml
cielo@cielo-ThinkPad-E550:~/cprogrames$ cd cmusic
cielo@cielo-ThinkPad-E550:~/cprogrames/cmusic$ mkdir dist
按照数据库的设计写model
然后写model。
音乐版权交易。
这边写了model之后去playground测试一下能够找到很多问题的。
步骤一:生成bna文件
cielo@cielo-ThinkPad-E550:~$ cd cprogrames
cielo@cielo-ThinkPad-E550:~/cprogrames$ cd cmusic
cielo@cielo-ThinkPad-E550:~/cprogrames/cmusic$ cd distcielo@cielo-ThinkPad-E550:~/cprogrames/cmusic/dist$ composer archive create --sourceType dir --sourceName ../
Creating Business Network Archive
Looking for package.json of Business Network Definition
Input directory: ../
Found:
Description: music first
Name: cmusic
Identifier: cmusic@0.0.1
Written Business Network Definition Archive file to
Output file: cmusic@0.0.1.bna
Command succeeded
步骤二:在playground中导入
这上面一行是需要card的。有card才能链接。下面那行不用。就是web测试的。
就是这里,点生成一个。其他的之前有讲过,随便取个名字然后上传bna文件。
刚进去的时候是admin,它什么权限都有,在admin下面测试一下每个asset生成的时候的参数是可以的,但是如果要测试participant的access control,需要生成一个新的participant后点击右上角,给这个participant issue一下。然后切换到这个新的participant看看他的访问控制做的对不对。还可以测试一下正则表达式什么的。
我通过这种方法发现了不对的地方。然后应该可以写后面的代码了吧。