- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试在 composer-playground 中执行事务时,出现错误“getAssetRegistry 正在返回 null,并且错误消息显示 assetRegistry 未定义”
/*这是我的.cto文件:*/
namespace org.acme.payrent
participant Authority identified by authorityId {
o String authorityId
}
participant Tenant identified by tenantEmailId {
o String tenantEmailId regex =/^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/
o String tFirstName
o Address Address
o TBankDetails tBank
o Integer accountNo
}
participant Owner identified by ownerEmailId {
o String ownerEmailId regex =/^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/
o String name
o String number regex=/^[0-9]*$/
o Integer bankaccountno
o Address propAddress
--> Tenant tnt
}
participant Bank identified by bankID {
o String bankID
o TBankDetails tBank
}
asset Property identified by propAddress {
o String propAddress
o Address propActAddress
o String tenantName
o Double rentAmount
}
concept Address {
o String houseNumber
o String street
o String city
o String country
}
concept TBankDetails {
o String bankName
o String ifscCode
o String branchName
}
concept Contact {
o String email regex =/^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/
o String mobileNumber regex=/^[0-9]*$/
o String firstName
o String lastName
}
event E1{
o String email
o String mobileNumber regex=/^[0-9]*$/
o String tntName
o TBankDetails tntBankDetails
o Address propertyAddress
}
transaction Agreement{
--> Property property
o String owrName
o String tntName
o String email
o String propAddress
o String mobileNumber
o String bankName
o String ifscCode
o String branchName
}`
/* 链码/logic.js 文件: */ `/** * 订购车辆 * @param {org.acme.payrent.Agreement} 创建协议(protocol)交易 * @交易 */
function Agreement(tntObj)
{
debugger
var factory = getFactory(tntObj);
var Namespace = "org.acme.payrent";
var property = tntObj.propAddress;
var addTntEvent = factory.newEvent(Namespace, 'E1');
addTntEvent.email = tntObj.email;
addTntEvent.mobileNumber = tntObj.mobileNumber ;
addTntEvent.tntName = tntObj.tntName;
addTntEvent.tntBankName = tntObj.bankName;
addTntEvent.ifscCode = tntObj.ifscCode;
addTntEvent.branchName = tntObj.branchName;
var a = getAssetRegistry('org.acme.payrent.Property');
return getAssetRegistry('org.acme.payrent.Property')
.then(function(propertyRegistry){
return assetRegistry.update(property); });
}`
Access control file:permission.acl
`/**
* New access control file
*/
rule Default {
description: "Allow all participants access to all resources"
participant: "ANY"
operation: ALL
resource: "org.acme.payrent.*"
action: ALLOW
}
rule SystemACL {
description: "System ACL to permit all access"
participant: "ANY"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
rule Owner {
description: "Owner can add a Tenant"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
rule Bank {
description: "Bank can verify tenant's bank account"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
rule Govenment {
description: "To verify property belongs to owner"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}`
最佳答案
你的代码有很多问题
property
时使用了错误的对象,因此您的 assetRegistry 更新将不起作用Property
Assets 已更新,因为它应该由交易 Agreement
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//** * Sample transaction processor function. * @param {org.acme.payrent.Agreement} tntObj The sample transaction instance. * @transaction */function Agreement(tntObj){ var factory = getFactory(); var Namespace = "org.acme.payrent"; var property = tntObj.property; // please note console.log('property is ' + property); var addTntEvent = factory.newEvent(Namespace, 'E1'); addTntEvent.email = tntObj.email; addTntEvent.mobileNumber = tntObj.mobileNumber ; addTntEvent.tntName = tntObj.tntName; var tntBankDetails = factory.newConcept(Namespace, 'TBankDetails'); tntBankDetails.bankName = tntObj.bankName; tntBankDetails.ifscCode = tntObj.ifscCode; tntBankDetails.branchName = tntObj.branchName; addTntEvent.tntBankDetails = tntBankDetails; var conceptAddress = factory.newConcept(Namespace, 'Address'); conceptAddress.houseNumber = '10'; conceptAddress.street = '20'; conceptAddress.city = 'Mainz'; conceptAddress.country = 'DE'; addTntEvent.propertyAddress = conceptAddress; emit(addTntEvent); //remove this! var a = getAssetRegistry('org.acme.payrent.Property'); property.rentAmount =44.22 ; /// so you can see the value change on the asset in playground etc return getAssetRegistry('org.acme.payrent.Property') .then(function(propertyRegistry) { return propertyRegistry.update(property); });}
关于javascript - 错误 : Expected a Resource or Concept,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48724746/
想象一个灯箱,里面有一张漂亮的图片,附近有一个按钮可以导航到下一张图片... 当用户点击下一步按钮时,JS 是这样的: var Image = new Image(); Image.onload =
我正在考虑用 C 语言制作一个 tcp 客户端。但在开始之前,我想听听您的一些建议。 客户端用于控制灯光和其他设备。 使用此客户端,我需要发送命令,但我也可以在有人关灯时接收事件。 仅使用套接字发送命
在大多数或所有面向对象的游戏中,每个类不仅依赖于自己的类,还依赖于父类。这个类连接在C++中是如何实现的呢?你只是为你需要的父类添加一个指针还是有更好的方法? 例如一场足球比赛,当 person 类点
判断对错: Any problem that can be solved using dynamic programming has a polynomial time worst case time
自从几年前我发现了 CRTP 以来,我在很多地方都使用它来为非常密集的面向计算的代码实现编译时多态性。当一个人关心运行时的通用性和最大性能时,以通用方式将成员函数“注入(inject)”到类中是很棒的
对不起,这不是一个具体的问题。因为我是 Jsprit 的新手,所以我需要一些关于如何开始解决问题的概念性帮助。 我的例子: 我开始时只有一辆车带有开始和结束位置。有多个优先取货位置,只有一个仓库位置用
我想知道在创建分支时,SVN只是从主干上复制一个完整的副本还是利用某种机制来实现? 谢谢。 最佳答案 AFAIK,它所做的是对您要从中分支的修订版本的引用,然后记录您 checkin 的任何内容的增量
这个问题已经有答案了: Abstract class in Java (15 个回答) 已关闭 9 年前。 抽象类背后的整个概念到底是什么(在我的例子中我指的是java)。我知道它太笼统而无法自行实现
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 7 年前。 Improve this ques
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 10 年前。 Improve thi
我正在尝试使用一个概念作为对子类的约束(由 gcc 使用 gnu2a 和 fconcepts 编译)来制作一个简单的模板继承示例。我希望下面的示例可以正常编译,但我无法让它工作: template c
我正在尝试使用 Apple 通知中心服务在蓝牙外围设备和 iOS 设备之间进行交互。在documentation Apple 提到了 2 个通知操作:EventFlagPositiveAction 和
我看了 Bjarne Strustrup 在 Going Native 2013 的演讲他为即将推出的 C++ 精简概念功能提供了以下示例。 void sort(Container& c); // t
'Concepts lite' 已经被接受为 TS 并且(示例实现)合并到 GCC 主分支中,所以后续问题是任何概念都会预定义(比如Sortable 或 Random_access_range)? 我
请帮我理清这个概念。假设我们有一个使用线程实现的套接字端口服务器。套接字服务器监听套接字端口,并在消息到达时创建一个线程来为请求提供服务。 客户端代码向服务器发送给定数量的消息。此客户端代码也可以由多
我查看了 Flyway 示例和文档,并试图了解它在我的环境中是否有用。 我不清楚以下概念细节:Flyway 如何管理数据库版本之间的更改?它显然不比较数据库生命实例(请参阅此处的答案:Can Flyw
当我尝试在 composer-playground 中执行事务时,出现错误“getAssetRegistry 正在返回 null,并且错误消息显示 assetRegistry 未定义” /*这是我的.
我在客户端提供的 block 中有以下代码: $user = $_POST['user']; $sql = "SELECT * FROM users WHERE user = '" . $user .
感谢您迄今为止提供的所有帮助! 今天我正在为一个数据记录程序开发一个数据库。我的逻辑有点卡住了,我以为我已经弄清楚了,但我遇到了一些死胡同。 我有 Scheme 输入,所以基本上是一个带有名称和列表名
这是我的草图: 这是一个jsfiddle致力于: 目标是将这个圆分成可变数量的切片。 例如,如果我想要 10 片……我可以将某些内容更改为“10”它会给我看这个被分成 10 block 的戒指。
我是一名优秀的程序员,十分优秀!