hyperledger-composer - 错误:没有来自任何对等方的有效响应。来自尝试的对等通信的响应是错误的
问题描述
每次提交交易时,我都会收到此特定错误:
错误:尝试使用事务 id bcffe477a38ba39c6bcbea6324e87903c54e609b31030df6b0b41ed2859906f2 调用业务网络时出错。错误:没有来自任何对等方的有效响应。来自尝试的对等通信的响应是一个错误:错误:事务返回失败:TypeError:无法读取未定义的属性“值”
namespace org.example.basic
asset SampleAccount identified by accountId {
o String accountId
--> SampleParticipant owner
o Double value
}
participant SampleParticipant identified by participantId {
o String participantId
o String firstName
o String lastName
}
transaction SampleTransaction {
--> SampleAccount account
o Double newValue
}
event SampleEvent {
--> SampleAccount account
o Double oldValue
o Double newValue
}
async function sampleTransaction(tx) { // eslint-disable-line no-unused-vars
// Save the old value of the asset.
let oldValue = tx.asset.value;
// Update the asset with the new value.
tx.asset.value += tx.newValue;
// Get the asset registry for the asset.
let assetRegistry = getAssetRegistry('org.example.basic.SampleAsset');
// Update the asset in the asset registry.
await assetRegistry.update(tx.asset);
// Emit an event for the modified asset.
let event = getFactory().newEvent('org.example.basic', 'SampleEvent');
event.asset = tx.asset;
event.oldValue = oldValue;
event.newValue = tx.newValue;
emit(event);
}
rule EverybodyCanReadEverything {
description: "Allow all participants read access to all resources"
participant: "org.example.basic.SampleParticipant"
operation: READ
resource: "org.example.basic.*"
action: ALLOW
}
rule EverybodyCanSubmitTransactions {
description: "Allow all participants to submit transactions"
participant: "org.example.basic.SampleParticipant"
operation: CREATE
resource: "org.example.basic.SampleTransaction"
action: ALLOW
}
rule OwnerHasFullAccessToTheirAssets {
description: "Allow all participants full access to their assets"
participant(p): "org.example.basic.SampleParticipant"
operation: ALL
resource(r): "org.example.basic.SampleAccount"
condition: (r.owner.getIdentifier() === p.getIdentifier())
action: ALLOW
}
rule SystemACL {
description: "System ACL to permit all access"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
rule NetworkAdminUser {
description: "Grant business network administrators full access to user resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "**"
action: ALLOW
}
rule NetworkAdminSystem {
description: "Grant business network administrators full access to system resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
数据输入如下:
{
"$class": "org.example.basic.SampleTransaction",
"account": "resource:org.example.basic.SampleAccount#123",
"newValue": 50
}
预期的输出是oldValue
50,但我们得到了错误。
解决方案
推荐阅读
- javascript - 用于搜索实现的多级数组过滤器
- angularjs - Angular 1.4:单击后禁用按钮
- php - 方法 Illuminate\Validation\Validator::validateFiles 不存在。Laravel 5.8 提交表单
- c - 在 C 中实现双阶乘尾递归函数
- jenkins - 如何在jenkins中为声纳设置指定具有package.json的目录路径?
- android - 如何将本地 aar 依赖项添加到 bintray 发布的库中?
- json.net - JSON.Net Schema 是否支持 OpenAPI 3 特定关键字,特别是“鉴别器”?
- c# - httpClient.GetStringAsync(url).Result 在 Godaddy 上部署时不起作用
- php - 如何在桌面上实现移动菜单
- android - 在 Android 中将文本添加到 FAB