Search code examples
hyperledger-fabrichyperledgerhyperledger-composer

How to generate new Id in hyperledger composer chaincode?


There is a method in a factory newResource. The third parameter of this method is id. Are there any ways or workarounds to generate id?


Solution

  • There was a similar question if you mean to auto-increment the identifier: Auto Increment field in Composer

    It is not recommended by the devs, because different peers may have calculated the IDs at the same time for different new assets/participants and disagree. Disagreements would force all records to roll back.

    Source: https://github.com/hyperledger/composer/issues/2931