Score
0
Watch 47 Star 115 Fork 46

XUJF / fccGoApache-2.0

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
以不动产登记业务为例,开发基于超级账本fabric的政务数据共享区块链 spread retract

  • Go 56.6%
  • Vue 28.1%
  • Shell 13.3%
  • JavaScript 1.6%
  • HTML 0.4%
Clone or download
3-1.installNetcon.sh 5.26 KB
Copy Edit Web IDE Raw Blame History
XUJF authored 2019-12-12 23:24 . Init
#!/bin/sh
CC_RUNTIME_LANGUAGE=golang
CC_SRC_PATH=github.com/chaincode/netcon
CONFIG_ROOT=/opt/gopath/src/github.com/hyperledger/fabric/peer
ORG1_MSPCONFIGPATH=${CONFIG_ROOT}/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
ORG1_TLS_ROOTCERT_FILE=${CONFIG_ROOT}/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
ORG2_MSPCONFIGPATH=${CONFIG_ROOT}/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
ORG2_TLS_ROOTCERT_FILE=${CONFIG_ROOT}/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
ORG3_MSPCONFIGPATH=${CONFIG_ROOT}/crypto/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp
ORG3_TLS_ROOTCERT_FILE=${CONFIG_ROOT}/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt
ORDERER_TLS_ROOTCERT_FILE=${CONFIG_ROOT}/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
set -x
echo y |cp chaincode/netcon/netcon.go ../chaincode/netcon/
echo "Installing smart contract on peer0.org1.example.com"
docker exec \
-e CORE_PEER_LOCALMSPID=Org1MSP \
-e CORE_PEER_ADDRESS=peer0.org1.example.com:7051 \
-e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \
-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG1_TLS_ROOTCERT_FILE} \
cli \
peer chaincode install \
-n netcon \
-v 1.0 \
-p "$CC_SRC_PATH" \
-l "$CC_RUNTIME_LANGUAGE"
echo "Installing smart contract on peer1.org1.example.com"
docker exec \
-e CORE_PEER_LOCALMSPID=Org1MSP \
-e CORE_PEER_ADDRESS=peer1.org1.example.com:8051 \
-e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \
-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG1_TLS_ROOTCERT_FILE} \
cli \
peer chaincode install \
-n netcon \
-v 1.0 \
-p "$CC_SRC_PATH" \
-l "$CC_RUNTIME_LANGUAGE"
echo "Installing smart contract on peer0.org2.example.com"
docker exec \
-e CORE_PEER_LOCALMSPID=Org2MSP \
-e CORE_PEER_ADDRESS=peer0.org2.example.com:9051 \
-e CORE_PEER_MSPCONFIGPATH=${ORG2_MSPCONFIGPATH} \
-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG2_TLS_ROOTCERT_FILE} \
cli \
peer chaincode install \
-n netcon \
-v 1.0 \
-p "$CC_SRC_PATH" \
-l "$CC_RUNTIME_LANGUAGE"
echo "Installing smart contract on peer1.org2.example.com"
docker exec \
-e CORE_PEER_LOCALMSPID=Org2MSP \
-e CORE_PEER_ADDRESS=peer1.org2.example.com:10051 \
-e CORE_PEER_MSPCONFIGPATH=${ORG2_MSPCONFIGPATH} \
-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG2_TLS_ROOTCERT_FILE} \
cli \
peer chaincode install \
-n netcon \
-v 1.0 \
-p "$CC_SRC_PATH" \
-l "$CC_RUNTIME_LANGUAGE"
echo "Installing smart contract on peer0.org3.example.com"
docker exec \
-e CORE_PEER_LOCALMSPID=Org3MSP \
-e CORE_PEER_ADDRESS=peer0.org3.example.com:11051 \
-e CORE_PEER_MSPCONFIGPATH=${ORG3_MSPCONFIGPATH} \
-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG3_TLS_ROOTCERT_FILE} \
cli \
peer chaincode install \
-n netcon \
-v 1.0 \
-p "$CC_SRC_PATH" \
-l "$CC_RUNTIME_LANGUAGE"
echo "Installing smart contract on peer1.org3.example.com"
docker exec \
-e CORE_PEER_LOCALMSPID=Org3MSP \
-e CORE_PEER_ADDRESS=peer1.org3.example.com:12051 \
-e CORE_PEER_MSPCONFIGPATH=${ORG3_MSPCONFIGPATH} \
-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG3_TLS_ROOTCERT_FILE} \
cli \
peer chaincode install \
-n netcon \
-v 1.0 \
-p "$CC_SRC_PATH" \
-l "$CC_RUNTIME_LANGUAGE"
echo "Instantiating smart contract on mychannel"
docker exec \
-e CORE_PEER_LOCALMSPID=Org1MSP \
-e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \
cli \
peer chaincode instantiate \
-o orderer.example.com:7050 \
-C mychannel \
-n netcon \
-l "$CC_RUNTIME_LANGUAGE" \
-v 1.0 \
-c '{"Args":[]}' \
-P "AND('Org1MSP.member','Org2MSP.member')" \
--tls \
--cafile ${ORDERER_TLS_ROOTCERT_FILE} \
--peerAddresses peer0.org1.example.com:7051 \
--tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE}
echo "Waiting for instantiation request to be committed ..."
sleep 10
echo "Submitting init transaction to smart contract on mychannel"
echo "The transaction is sent to all of the peers so that chaincode is built before receiving the following requests"
docker exec \
-e CORE_PEER_LOCALMSPID=Org1MSP \
-e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \
cli \
peer chaincode invoke \
-o orderer.example.com:7050 \
-C mychannel \
-n netcon \
-c '{"function":"queryAll","Args":[]}' \
--waitForEvent \
--tls \
--cafile ${ORDERER_TLS_ROOTCERT_FILE} \
# --peerAddresses peer0.org1.example.com:7051 \
# --peerAddresses peer1.org1.example.com:8051 \
# --peerAddresses peer0.org2.example.com:9051 \
# --peerAddresses peer1.org2.example.com:10051 \
# --peerAddresses peer0.org3.example.com:11051 \
# --peerAddresses peer1.org3.example.com:12051 \
# --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \
# --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \
# --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} \
# --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} \
# --tlsRootCertFiles ${ORG3_TLS_ROOTCERT_FILE} \
# --tlsRootCertFiles ${ORG3_TLS_ROOTCERT_FILE}
echo "List all instantiated chaincode in channal mychannel..."
docker exec \
-e CORE_PEER_LOCALMSPID=Org1MSP \
-e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \
cli \
peer chaincode list --instantiated -C mychannel
set +x

Comment ( 0 )

Sign in for post a comment

Go
1
https://gitee.com/xujf/fcc.git
git@gitee.com:xujf/fcc.git
xujf
fcc
fcc
master

Help Search