华为云区块链的跨云联通能力构建(一)(3)

  peer chaincode list -C silk-road-chain --installed

  Get installed chaincodes on peer:

  Name: sacc, Version: 0, Path: sacc, Id: b60426d87dcfbf436628f6b23371d9385e3d3a4f1fd1724031ca3e182d8e045f

  •查询已实例化的链码

  peer chaincode list -C silk-road-chain --instantiated

  Get instantiated chaincodes on channel silk-road-chain:

  Name: fabbank, Version: 1.0, Escc: escc, Vscc: vscc

  Name: fabbank2, Version: 1.0, Escc: escc, Vscc: vscc

  Name: mycc3, Version: 1.0, Escc: escc, Vscc: vscc

  5、实例化链码及invoke时遇到的坑

  •问题

  Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg failed to execute transaction 0a25ad459d622e1a8f35c6fa192c027dd5f74738acf76373c35f30d1e061e2d7: error starting container: error starting container: Post http://unix.sock/containers/create?name=dev-peer0.org1.huawei.backbonetestnet.baas.dev.icn.engineering-sacc-0: dial unix /var/run/docker.sock: connect: no such file or directory

  在fabric-tools(cli)里配了docker run -v /var/run:/host/var/run -e CORE_VM_ENDPOINT还是不行,后来才想起来是要给peer配置的

  •问题

  Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg failed to execute transaction a85d6d5c144677750ef70c8d0acc3d8b4e3bbb7220141d3526ebb33df3490077: error starting container: error starting container: API error (404): oci runtime error: container_linux.go:247: starting container process caused "exec: \"chaincode\": executable file not found in $PATH"

  •问题

  Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg plugin with name escc could not be used: plugin with name escc wasn't found

  由于是1.2的镜像,但是core.yaml用的是1.1的

  •问题

  Error: endorsement failure during invoke. chaincode result: status:500 message:

  大多数invoke都没有报错,但查询发现没有生效,像未写入账本,原因是实例化的时候背书策略不能用MSP.peer,改成MSP.member则OK

  6. 更新anchor peer及discovery

  需要A云侧提供供cli使用的anchor peer的配置文件(huaweimsp_silk-road-chain_anchors_cli.tx) 将配置文件复制到cli容器里然后进行更新

  docker cp huaweimsp_silk-road-chain_anchors_cli.tx xx:/home

  docker exec -it xxx bash

  export FABRIC_CFG_PATH=/home

  root@c362aa2f5c93:/# CORE_PEER_ADDRESS=peer0.org1.huawei.backbonetestnet.baas.dev.icn.engineering:7051

  root@c362aa2f5c93:/# peer channel update -o orderer0.icn.backbonetestnet.baas.dev.icn.engineering:7050 --tls true --cafile /home/tlsca.icn.backbonetestnet.baas.dev.icn.engineering-cert.pem -c silk-road-chain -f /home/huaweimsp_silk-road-chain_anchors_cli.tx

  7. 更新anchor peer遇到的问题

  •问题

  Error: Invalid channel create transaction : bad payload

  tx配置文件有问题,少了外层的payload结构

  8.用新生成的证书,华为1.1镜像,模拟新peer1加入通道silk-road-chain

  •生成peer1节点证书 peer1节点证书,通过cryptogen工具生成 先创建crypto-config.yaml证书生成配置文件,内容如下

  PeerOrgs:

  - Name: org1

  Domain: org1.huawei.backbonetestnet.baas.dev.icn.engineering

  EnableNodeOUs: true

  Template:

  Count: 2

  Users:

  Count: 1

  生成命令

  cryptogen generate --config=./crypto-config.yaml

  在华为云上创建一个联盟链的服务,创建一个peer组织,节点个数为1。将其中的peer组织进行改造

  docker run -it -v /var/run:/host/var/run -e CORE_VM_ENDPOINT="unix:///host/var/run/docker.sock" docker.io/hyperledger/fabric-tools:1.2.0 bash

  echo "35.158.219.246 orderer0.icn.backbonetestnet.baas.dev.icn.engineering" >> /etc/hosts

  echo "49.4.93.157 peer1.org1.huawei.backbonetestnet.baas.dev.icn.engineering" >> /etc/hosts

  export FABRIC_CFG_PATH=/home

  export CORE_PEER_ID=peer1.org1.huawei.backbonetestnet.baas.dev.icn.engineering

  export CORE_PEER_ADDRESS=peer1.org1.huawei.backbonetestnet.baas.dev.icn.engineering:30605

  export CORE_PEER_LOCALMSPID=huaweiMSP

  export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/peer/msp

  export PAAS_CRYPTO_PATH=/var/paas/srv/kubernetes

  export CORE_PEER_TLS_ENABLED=true

  加入命令

  peer channel join -b /home/silk-road-chain.genesis.block --orderer orderer0.icn.backbonetestnet.baas.dev.icn.engineering:7050 --cafile /home/tlsca.icn.backbonetestnet.baas.dev.icn.engineering-cert.pem --tls true

  最终验证出华为云fabric1.1版本无法和A云侧1.2版本打通,待升级到1.2版本再继续验证(华为云技术)

      想了解更多内容请关注财经365股票频道。

标签:区块链 华为云 跨云联通
N本文来源:财经365自媒体综合