Search code examples
hyperledger-fabricassets

Effects on changing asset definition and chaincode on HL Fabric


I wanted to know in which cases an update of the chaincode and the assets in Fabric (NOT COMPOSER) would be possible or not, and here is what I have concluded from my observations playing with the marbles sample .

Are these statements correct?

  • Adding a property to an asset: Feasible

  • Changing the type of an asset: Not feasible (if an asset already has this property set) ||| Feasible (if no asset has this property set)

  • Deleting the property: Feasible

  • Changing chaincode (business logic): Feasible

(Again, not talking about composer here. Talking about plain Fabric and golang/nodejs)


Solution

  • Any of the changes mentioned in the question are feasible, as long as the new chaincode version is written to tolerate the prior chaincode version's data structure. For example upon querying a state, the new chaincode version can have logic to 'clean up' the state data to the new data model before returning it to a client or before resaving it to state.