transactionId when submitting a transaction

邮差的信 提交于 2019-12-08 09:00:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!