问题
I am trying to submit a transaction using "composer transaction submit...". I get an error stating that transactionId value is missing... the transaction is accepted only if I add a random transactionId, but in Playground the JSON used to submit a transaction does not include transactionId and is executed OK (although I know it is the javascript Fabric emulator embedded in Playground).
So, in order to submit transactions using CLI or REST API, how should I generate/know the transaction Id if the transaction has not been executed yet? Thanks. When using the REST API it works same way?
This is the error I get:
Error: Invalid or missing identifier for Type OwnerCreationTransaction in namespace com.namespace.model
at Factory.newResource (/usr/local/lib/node_modules/composer-cli/node_modules/composer-common/lib/factory.js:89:19)
at Serializer.fromJSON (/usr/local/lib/node_modules/composer-cli/node_modules/composer-common/lib/serializer.js:141:37)
at then.then.e (/usr/local/lib/node_modules/composer-cli/lib/cmds/transaction/lib/submit.js:83:39)
Command failed.
OwnerCreationTransaction has the following definition:
transaction OwnerCreationTransaction identified by transactionId {
o String transactionId
o String id
o String lastName
o String firstName
o String address
o String city
o String state
o String phone
o String email
}
回答1:
The transaction id is a value that the submitter supplies and although it probably doesn't need to be unique, it is highly recommended that you use a unique identifier for each transaction you submit. In the case of playground it provides a uuid automatically for you as an identifier. What you do rightly highlight however is an inconsistency between playground, the cli and the rest api and it should be consistent see https://github.com/fabric-composer/fabric-composer/issues/538 for more information.
来源:https://stackoverflow.com/questions/42894071/transactionid-when-submitting-a-transaction