Reputation: 46
I am using a set of Hyperledger 1.0.2 docker images with composer 0.11.3 The practice network I use is basic-sample-network which comes with a SampleParticipant and a SampleAsset. I am able to deploy the participant from the command line using composer participant add along with the JSON snippet. I have not found an equivalent command line approach to insert the SampleAsset into the asset registry. When I use the composer-rest-server to POST the JSON snippet defining the SampleAsset, it returned the following error
Error: Peer has rejected transaction '4d2...91f' with cdoe MVCC_READ_CONFLICT
I then re-submitted after reading a comment on BatchTimeout and locking which I didn't modify as I am a single user on a baby chain. The second time, the REST server returned
Error: Failed to add object with ID 'assetId:1' as the object already exists)
I could verify the asset registry was updated with composer network list:
name: basic-sample-network
models:
- org.hyperledger.composer.system
- org.acme.sample
scripts:
- lib/sample.js
registries:
org.acme.sample.SampleAsset:
id: org.acme.sample.SampleAsset
name: Asset registry for org.acme.sample.SampleAsset
registryType: Asset
assets:
assetId:1:
$class: org.acme.sample.SampleAsset
assetId: assetId:1
owner: resource:org.acme.sample.SampleParticipant#Toby
value: new value
org.acme.sample.SampleParticipant:
id: org.acme.sample.SampleParticipant
name: Participant registry for org.acme.sample.SampleParticipant
registryType: Participant
assets:
Toby:
$class: org.acme.sample.SampleParticipant
participantId: Toby
firstName: Tobias
lastName: Hunter
Why this odd behaviour from the REST server which complained with MVCC_READ_CONFLICT but yet inserted the record and is there a way I missed of inserting the SampleAsset from the command line?
Upvotes: 1
Views: 640
Reputation: 6740
hmmm.. not sure why you got an MVCC error (as you say, can't have been to do with the asset that was indeed added, as you've shown).
composer transaction submit
is the method to submit a transaction to (say) add an asset from the command line - examples in the docs ('Example command') and another below:
https://hyperledger.github.io/composer/reference/composer.transaction.submit.html
Upvotes: 1