前情背景:已经有可以使用的应用链
1、获取需要合约安装包并切换分支
git clone https://github.com/meshplus/pier-client-fabric.git && git checkout v1.6.2
一定要解决example下面的contract压缩包,用压缩包里面的链码进行部署,外面那个不行!是假的!会出错误!
2、部署broker合约(曾出现问题,是链码部署错误导致)
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"]}'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)