提交交易时的transactionId [英] transactionId when submitting a transaction

查看:113
本文介绍了提交交易时的transactionId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用提交者交易提交..."来提交交易.我收到一条错误消息,指出缺少transactionId值...仅当我添加一个随机transactionId时,该事务才被接受,但是在Playground中,用于提交事务的JSON不包含transactionId并被执行了(虽然我知道这是javascript嵌入在Playground中的Fabric模拟器).

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).

因此,为了使用CLI或REST API提交事务,如果尚未执行事务,该如何生成/知道事务ID?谢谢.使用REST API时,其工作方式相同吗?

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?

这是我得到的错误:

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具有以下定义:

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
}

推荐答案

事务ID是提交者提供的值,尽管可能不需要唯一,但强烈建议您使用唯一标识符您提交的每笔交易.对于游乐场,它会自动为您提供一个uuid作为标识符. 但是,您正确强调的是游乐场,CLI和其余api之间的不一致,应该保持一致. https://github.com/fabric-composer/fabric-composer/issues/538 有关更多信息.

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.

这篇关于提交交易时的transactionId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆