bitxhub-fabric跨链网络搭建2-跨链合约部署
Posted Minion_w
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了bitxhub-fabric跨链网络搭建2-跨链合约部署相关的知识,希望对你有一定的参考价值。
前情背景:已经有可以使用的应用链
1、获取需要合约安装包并切换分支
git clone https://github.com/meshplus/pier-client-ethereum.git && git checkout v1.6.2
2、部署broker合约(曾出现问题,应该是docker和docker-compose版本所导致)
peer chaincode install -n broker -v 1.0 -p github.com/hyperledger/fabric/peer/chaincode/src/src/github.com/pier-client-fabric/example/contracts/src/broker
3.合约实例化
peer chaincode instantiate -o orderer.cpsec.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/cpsec.com/orderers/orderer.cpsec.com/msp/tlscacerts/tlsca.cpsec.com-cert.pem -C cpsec -n broker -v 1.0 -c '"Args":["init","ccp", "broker", "ccid","broker"]'
3.部署transfer合约
peer chaincode install -n transfer -v 1.0 -p github.com/hyperledger/fabric/peer/chaincode/src/src/github.com/pier-client-fabric/example/contracts/src/transfer
4.实例化transfer合约
peer chaincode instantiate -o orderer.cpsec.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/cpsec.com/orderers/orderer.cpsec.com/msp/tlscacerts/tlsca.cpsec.com-cert.pem -C cpsec -n transfer -v 1.0 -c '"Args":["init","ccp", "transfer", "ccid","transfer"]'
5.transfer合约需要broker注册审计之后才能进行跨链操作
peer chaincode invoke -o orderer.cpsec.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/cpsec.com/orderers/orderer.cpsec.com/msp/tlscacerts/tlsca.cpsec.com-cert.pem -C cpsec -n broker --peerAddresses peer0.org1.cpsec.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.cpsec.com/peers/peer0.org1.cpsec.com/tls/ca.crt -c '"Args":["audit","cpsec","transfer","1"]'
以上是关于bitxhub-fabric跨链网络搭建2-跨链合约部署的主要内容,如果未能解决你的问题,请参考以下文章