通过交易 hyperledger composer 和另一个问题的新资产

A new asset through a transaction hyperledger composer & an other question

我正在设计业务网络,我正在 hyperledger composer bluemix 上为网络实施 logic.js,我想通过 logic.js 文件中的交易创建资产如何做到这一点请?我还有另一个问题是如何检查随机数不等于交易注册表中的旧资产属性或活动资产属性,我正在创建凭证消费交易并且 model.cto

asset Voucher identified by serial {
 o String serial
 o String Code //new code generated for every new consumption transaction
 o DateTime creationDate
 o Double amount
 o Typev type
 o Integer activated
}

enum Typev {
 o paperVoucher
 o giftVoucher
}

logic.js部分代码:

do{
 var min=1;
 var max=999999;
 var random = Math.floor(Math.random() * (+max - +min)) + +min;
}while (random!=//old serials or active serials); //missing random test with the old serials

关于问题的第一部分,请参阅 Asset Creation through Transaction in Hyperledger Composer

第二部分请查看 Historian https://hyperledger.github.io/composer/latest/business-network/historian