Search code examples
hyperledger-fabrichyperledgerhyperledger-composer

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


I have a simple transaction logic, where the info should just be registered on blockchain.

Adding participants and assets works just fine, but when submitting the transaction I get following error

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

Project repo w/ files -

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

I guess this is something with issuing the ID to an existing participant using composer identity issue, but I'm not quite sure how to do it. Thanks!


Solution

  • I think there is an issue in your Transaction logic

    You are passing 'person' to your function

    'person' is basically the transaction object (RegisterBannedPerson) containing

    --> Airline airlineThatBanned
      o String description
    

    thats what this line means

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

    So your

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

    should be

    newPost.description = person.description

    newPost.airlineThatBanned = airline;

    should be

    newPost.airlineThatBanned = person.airlineThatBanned