在 localhost:3000 上执行 hyperledger fabric 代码时出错(通过 REST)- transactionId

error executing hyperledger fabric code on localhost:3000 (through REST) - transactionId

我在参考这个的同时尝试执行两个账户之间转账的示例案例: https://medium.freecodecamp.org/ultimate-end-to-end-tutorial-to-create-an-application-on-blockchain-using-hyperledger-3a83a80cbc71

我已经执行了所有步骤,从创建 .bna 和 .card 到安装它们、启动网络等。 在创建 RESTful API 时,我能够在 localhost:3000/explore 上看到区块链。 我还可以添加客户及其关联的帐户详细信息。

但是,在执行汇款时,默认生成两个字段:transactionId 和 timestamp。

screenshot showing 2 additional fields - timestamp and transactionId

是 transactionId 造成了麻烦。 它不允许我将其留空,或填充任意值,或完全删除该字段。

error when transactionId field is left blank

更新

即使写入 "transactionId" : true"transactionId" : false,问题仍然存在。

另一位用户遇到了类似的问题。他们通过使他们的 npm 和 node.js 成为非 root 来修复它。就我而言,它已经是非 root 用户了。 it is non-root 有没有可能是npm和node.js没有安装好?我在安装过程中收到了一些错误 npm errors during installation

即使删除了 transactionIdtimestamp 字段,它也不起作用

TransactionID(在示例中)理想情况下不应出现在 Swagger 示例中用于 POST 操作。该示例由 LoopBack 到 Swagger 转换生成,由 LoopBack 代码(而非 Composer)完成。您需要在 JSON.

中删除它(理想情况下还有时间戳,因为 Composer 会更新自己的时间戳)

Why can I submit a transactionID with a transaction in hyperledger composer REST? for an answer. This loopback/swagger issue was created against loopback - last issue created was https://github.com/strongloop/loopback/issues/3510

我也遇到了类似的问题,经过研究并花了很多时间。我发现这不是 npm 的问题并且 node.js,如果我们以非 root 身份安装它们。这是 Loopback 的问题,因此您必须发出 API JSON 请求而不 "transactionId""timestamp" 表示将它们都删除。它会正常工作,因为 loopback swagger 会自动更新它。 我希望它对所有面临同样问题的人都有用。