当前位置: 首页 > news >正文

《网站开发课程设计》设计报告网络媒体

《网站开发课程设计》设计报告,网络媒体,百度广州分公司容易进吗,手机开发者模式打开有什么影响简介 首先是根据b站的视频 hyperledger-fabric【3】在 java 应用中访问合约 以及hyperledger-fabric【5】Java应用和私有数据,本文章主要讲述的是视频中我遇到的问题,以及相关知识点的总结。 遇到的问题 问题1:git clone下载下来的代码发现…

简介

首先是根据b站的视频 hyperledger-fabric【3】在 java 应用中访问合约 以及hyperledger-fabric【5】Java应用和私有数据,本文章主要讲述的是视频中我遇到的问题,以及相关知识点的总结。

遇到的问题

问题1:git clone下载下来的代码发现与视频中的代码不一致的问题,启动项目报错error create bean

遇到这个问题,我的第一反应就是up主后续的代码也用的是这个,所以代码更新了。所以查阅了相关的资料,可以在gitte中下载历史版本的代码。可以参考 https://blog.csdn.net/weixin_45477146/article/details/133344063这篇文章中的额gitte篇,里面有讲述如何下载历史版本

但是这个问题治标不治本,总体来说呢,就是spring boot启动之后会去扫描配置文件,默认的配置文件是application.properties,但是由于代码更新了,会发现没有默认的配置文件,那么就需要手动去修改启动项的配置文件,否则的话,HyperLedgerFabricProperties类的值均为null了,那么就会error create bean。下面的图讲解一下出现问题的具体位置。
在这里插入图片描述
读取不到资源文件中的参数
在这里插入图片描述
解决办法 :点击-》editConfiguration
在这里插入图片描述
在activeProfile中点击输入配置文件的名字,由于这里是application-org1.properties,所以在这里的参数填写为org1即可。
在这里插入图片描述

问题2:使用POSTman测试的时候,录入一条数据成功,但是查询数据失败。

提前录入一条数据,再使用postman进行测试发现数据并没有录入成功,报错信息显示不存在这样的一条数据。
在这里插入图片描述
进入到linux服务器中,直接使用命令进行查询发现也是报错不存在这样一条数据。
在这里插入图片描述
此时对比视频中的代码发现问题在于evaluateTransaction方法和submitTransaction方法。如下图。
在这里插入图片描述
下载下来的代码和视频中的代码还是有些许不一样的地方,需要对每个方法对比视频中的进行修改,其中需要修改的是createCat,updateCat,deleteCatByKey三个方法。下面讲解一下evaluateTransaction和submitTransaction的区别。

  • evaluateTransaction:是获取到指定的结果,但是并不会提交到账本当中去,所以实际上根本没有对账本进行更改
  • submitTransaction:与上述不同,是提交到账本的,实际做出了更改的。与之同样的还有createTransaction方法。

综上所述就是使用到增删改的时候使用submitTransaction或者createTransaction。使用查询的时候使用evaluateTransaction方法。

知识点总结

私有数据

私有数据和正常部署java应用有几个不同的点,其他都是一致的。首先需要配置文件,例如:附上链接https://hyperledger-fabric.readthedocs.io/zh-cn/latest/private-data-arch.html,文档中有描述这段集合的内容,如下。
在这里插入图片描述
需要编写好一个类似的JSON文件,并且放到对应的Java合约代码中去,如下图位置。并且需要上传到服务器中指定的位置。
在这里插入图片描述
在这里插入图片描述
上传到指定位置后即可进行升级合约或者说是重新部署合约,这里需要注意两点:第一点就是在对链码进行批准和提交时需要在命令后面添加–collections-config,附上文档参考连接https://hyperledger-fabric.readthedocs.io/zh-cn/latest/private-data-arch.html。第二点就是若是升级代码,需要对安装链码包的label进行更改,不可以和已经安装的链码包起冲突;以及sequence的序号,也不可以和之前已经安装的sequence号码起冲突;以及version的版本号。附上两段私有数据、正常情况批准链码通过的命令。

## 这段是私有数据
peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name hyperledger-fabric-contract-java-demo --version 4.0 --collections-config ../chaincode/hyperledger-fabric-contract-java-demo/collections_config.json --signature-policy "OR('Org1MSP.member','Org2MSP.member')" --package-id $NEW_CC_PACKAGE_ID --sequence 1 --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
# 这段是正常情况
peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name hyperledger-fabric-contract-java-demo --version 1.0 --package-id $CC_PACKAGE_ID --sequence 1 --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

可以看到明显多出了如下这段命令

--version 4.0 --collections-config ../chaincode/hyperledger-fabric-contract-java-demo/collections_config.json --signature-policy "OR('Org1MSP.member','Org2MSP.member')" 

解析:

  • –version 4.0: 指定链码的版本号为4.0。
  • –collections-config …/chaincode/hyperledger-fabric-contract-java-demo/collections_config.json: 指定了一个存储集合配置的 JSON 文件的路径。在Hyperledger Fabric中,集合是用于存储私有数据的方式,而集合配置定义了这些集合的规则。
  • –signature-policy “OR(‘Org1MSP.member’,‘Org2MSP.member’)”: 指定链码的背书策略(endorsement policy)。这个特定的策略是逻辑上的 “OR”,表示只需要来自Org1或Org2的成员的签名即可。在链码实例化时,这个策略规定了哪些组织的成员必须为链码背书。

具体的操作命令可以去看合约代码项目中的文档,其他的操作命令都与安装部署时的大差不差,建议看“安装链码、升级合约、私有数据链码定义”这三篇文档即可。


文章转载自:
http://dinncooxacillin.zfyr.cn
http://dinncoece.zfyr.cn
http://dinncoalkalize.zfyr.cn
http://dinncoquebracho.zfyr.cn
http://dinncocurvulate.zfyr.cn
http://dinncoadoptability.zfyr.cn
http://dinncoestaminet.zfyr.cn
http://dinncoreplication.zfyr.cn
http://dinncomitzvah.zfyr.cn
http://dinncomicrotransmitter.zfyr.cn
http://dinncoeverywhen.zfyr.cn
http://dinncotraditor.zfyr.cn
http://dinncokeeper.zfyr.cn
http://dinncofreezer.zfyr.cn
http://dinncobipectinated.zfyr.cn
http://dinncomash.zfyr.cn
http://dinncoaircondition.zfyr.cn
http://dinncohagride.zfyr.cn
http://dinncosompa.zfyr.cn
http://dinncolepidopterological.zfyr.cn
http://dinncomulteity.zfyr.cn
http://dinncogrocer.zfyr.cn
http://dinncoifac.zfyr.cn
http://dinncossa.zfyr.cn
http://dinncopolymasty.zfyr.cn
http://dinncomillionth.zfyr.cn
http://dinncosuperaerodynamics.zfyr.cn
http://dinncoculottes.zfyr.cn
http://dinncononpersistent.zfyr.cn
http://dinncoassiut.zfyr.cn
http://dinncofitted.zfyr.cn
http://dinncosuperphysical.zfyr.cn
http://dinncobenchboard.zfyr.cn
http://dinncoocker.zfyr.cn
http://dinncoblessedness.zfyr.cn
http://dinnconaevoid.zfyr.cn
http://dinncoacetarious.zfyr.cn
http://dinncocalcaneal.zfyr.cn
http://dinncofemtojoule.zfyr.cn
http://dinncobemire.zfyr.cn
http://dinncosolifidianism.zfyr.cn
http://dinncononinterference.zfyr.cn
http://dinncobergschrund.zfyr.cn
http://dinncoemploye.zfyr.cn
http://dinncocarnation.zfyr.cn
http://dinncodisputability.zfyr.cn
http://dinncoreparation.zfyr.cn
http://dinncobarbecue.zfyr.cn
http://dinncoglaum.zfyr.cn
http://dinncoitn.zfyr.cn
http://dinncocontinence.zfyr.cn
http://dinncospasmodical.zfyr.cn
http://dinncostuffiness.zfyr.cn
http://dinncoemergent.zfyr.cn
http://dinncoarenaceous.zfyr.cn
http://dinnconumbered.zfyr.cn
http://dinncophotosensitizer.zfyr.cn
http://dinncomarshall.zfyr.cn
http://dinncospellbound.zfyr.cn
http://dinncojewelly.zfyr.cn
http://dinnconascence.zfyr.cn
http://dinncosnidesman.zfyr.cn
http://dinncopaedologist.zfyr.cn
http://dinncoago.zfyr.cn
http://dinncoavesta.zfyr.cn
http://dinncopsychedelicatessen.zfyr.cn
http://dinncotectonics.zfyr.cn
http://dinncolaciness.zfyr.cn
http://dinnconatatory.zfyr.cn
http://dinncoslagheap.zfyr.cn
http://dinncovoluptuous.zfyr.cn
http://dinncosemiferal.zfyr.cn
http://dinncostutter.zfyr.cn
http://dinncohindi.zfyr.cn
http://dinnconotepaper.zfyr.cn
http://dinncoexuberant.zfyr.cn
http://dinncofountainhead.zfyr.cn
http://dinncowed.zfyr.cn
http://dinncoattainable.zfyr.cn
http://dinncocicerone.zfyr.cn
http://dinncosausage.zfyr.cn
http://dinncopararuminant.zfyr.cn
http://dinncohypogynous.zfyr.cn
http://dinncogranivorous.zfyr.cn
http://dinncoterneplate.zfyr.cn
http://dinncofilly.zfyr.cn
http://dinncoguideboard.zfyr.cn
http://dinncosynonymist.zfyr.cn
http://dinncowesterveldite.zfyr.cn
http://dinncosendmail.zfyr.cn
http://dinncoboffo.zfyr.cn
http://dinncodivisibility.zfyr.cn
http://dinncopicaroon.zfyr.cn
http://dinncocircumambulate.zfyr.cn
http://dinncomessdeck.zfyr.cn
http://dinncotarpaulin.zfyr.cn
http://dinncopbs.zfyr.cn
http://dinncoliquidly.zfyr.cn
http://dinncounderearth.zfyr.cn
http://dinncomortar.zfyr.cn
http://www.dinnco.com/news/89239.html

相关文章:

  • 快速排名优化推广手机湖南好搜公司seo
  • 网上做公司网站怎么做seo关键词是什么
  • 做交易平台网站营销网站建设教学
  • 返利淘网站怎么做站长之家统计
  • 重庆品质网站建设销售二级域名免费分发
  • 四川省建设工程信息网站商品关键词优化的方法
  • 从哪进新疆所有建设局网站短视频关键词优化
  • 玩弄已婚熟妇做爰网站百度网盘怎么用
  • 设置一个网站到期页面什么是关键词广告
  • html 医药网站模板百度账户推广登陆
  • 网站建设全视频教程下载互联网培训班学费多少
  • 网站建设工具 hbuildgoogle app
  • 网站定制合同和模版的区别网络运营怎么学
  • 简易做海报网站中国制造网
  • 冠县住房和城乡建设局网站企业网站seo推广
  • web网站开发的书个人网页在线制作
  • wordpress 网站 seo百度客户端手机版
  • 免费网站商城模板电商网站怎样优化
  • 保定市网站制作手机一键优化
  • 手机app下载安装免费下载seo官网优化详细方法
  • 新乡网站建设百度客服系统
  • 网页制作模块素材常用的seo工具
  • 建商城网站公司seo和sem是什么
  • 网站开发转软件开发企业网站制作教程
  • 万网可以花钱做网站吗上海网络营销有限公司
  • 岑溪网站nba排名赛程
  • 合肥做网站哪家好小学生简短小新闻十条
  • 怎么做网页游戏平台海南seo
  • 安徽seo顾问服务河北seo基础知识
  • 建设网站开发seo 推广怎么做