0
votes

I have a question about how to update the data model of the assets already stored in the blockchain.

1 - Is it possible to change the data model of an asset? For example by adding new fields or changing the existing ones.

2 - Is it possible to add a new asset to the ledger? By creating a new one which doesn't exist.

3 - These logics could be applied both to HL Composer both to HL Fabric (chaincode written in nodeJS/goLang)?

Thanks.

1

1 Answers

1
votes
  1. Adding New fields to a Composer Model:

If you add a new field to an Asset (or participant), you can no longer see the data of existing Asset instances, but if you then remove the field from the model model - you can see the data again! If you add the new field but with 'optional' after the field in the model, you will see the original data.

If you don't want the new field to be optional, you need to start with it as optional, then run code to add a value to the new field for existing Asset instances, then you can remove the optional keyword.

  1. Add a new asset type to the Composer model

You can add a new Asset type to the model file, and then upgrade the model on the Fabric.