Hyperledger Composer REST - 500 交易错误 + 为参与者发布新身份

Hyperledger Composer REST - 500 transaction error + issue new identity for participant

我有一个简单的交易逻辑,其中的信息应该只在区块链上注册。

添加参与者和资产工作正常,但在提交交易时出现以下错误

Error 500: Instance org.example.mynetwork.BannedPerson#B1566901081004 has property airlineThatBanned with type org.hyperledger.composer.system.NetworkAdmin that is not derived from org.example.mynetwork.Airline

带文件的项目回购 -

model.cto: https://github.com/shm-tar/Hyperledger-BanList/blob/master/models/org.example.mynetwork.cto

logic.js: https://github.com/shm-tar/Hyperledger-BanList/blob/master/lib/logic.js

我想这与使用 composer identity issue 向现有参与者颁发 ID 相关,但我不太确定该怎么做。谢谢!

我认为你的交易逻辑有问题

您正在将 'person' 传递给您的函数

'person' 基本上是包含

的交易对象 (RegisterBannedPerson)
--> Airline airlineThatBanned
  o String description

这就是这行的意思

@param {org.example.mynetwork.RegisterBannedPerson} person

所以你的

newPost.description = person.bannedPersonId + ", " + person.ban + ", " + person.banDuration;

应该是

newPost.description = person.description

newPost.airlineThatBanned = airline;

应该是

newPost.airlineThatBanned = person.airlineThatBanned