Search code examples
hyperledger-fabrichyperledger-composer

Linking updated assets in Hyperledger Composer


I am trying to create a chain which holds a document. I have created the asset in the model file as

asset document identified by documentid {
  o String documentid
  o String formImageBase64 //will use IPFS Later
  o String nameOfSignator
  o String addressOfSignator
  o Integer ageOfSignator
  o Boolean isSigned
  o DateTime dateTimeOfSigning
}

And there are multiple documents containing information of different people.

If the document is updated(new asset is created), How to show a link between the old document and the updated document.

Update Changing Title from "Creating Application Form using Hyperledger Composer" To "Chaining/Connecting updated assets in Hyperledger Composer"


Solution

  • On the New Updating document, I added a new string which contains the unique "document of the previous string. Making it kind of a singly linked list.

    asset document identified by documentid {
      o String documentID
      o String previousDocumentID // optional(later) original document "0" for now
      o String formImageBase64 //will use IPFS Later
      o String nameOfSignator
      o String addressOfSignator
      o Integer ageOfSignator
      o Boolean isSigned
      o DateTime dateTimeOfSigning
    }
    

    This way I can chain documents together.