hyperledger-bevel / bevel

An automation framework for rapidly and consistently deploying production-ready DLT platforms
https://hyperledger-bevel.readthedocs.io/en/latest/
Apache License 2.0
346 stars 719 forks source link

Update Hyperledger Fabric supplychain chaincode #488

Closed jagpreetsinghsasan closed 4 years ago

jagpreetsinghsasan commented 4 years ago

The current supplychain chaincode developed for Hyperledger Fabric runs fine with V1_1 capabilities. With inclusion of RAFT consensus, the capabilities are upgraded as Channel capabilities: V1_4_3 Orderer capabilities: V1_4_2 Application capabilities: V1_4_2 Some of the supplychain chaincode functions fail to execute with these new capabilites.

jagpreetsinghsasan commented 4 years ago

To test the current chaincode, I am installing it over byfn network with raft consensus. The steps to re-create the env are ./byfn.sh generate ./byfn up -o etcdraft docker cp examples/supplychain-app/fabric/chaincode_rest_server/chaincode CONTAINER_ID:/opt/gopath/src/github.com/chaincode login into the container cd /opt/gopath/src/github.com/chaincode mv chaincode/chaincode/* .

CORE_PEER_LOCALMSPID="Org1MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp CORE_PEER_ADDRESS=peer0.org1.example.com:7051 peer chaincode install -n supplychain -v 2.0 -p github.com/chaincode/supplychain/cmd

CORE_PEER_LOCALMSPID="Org1MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp CORE_PEER_ADDRESS=peer1.org1.example.com:8051 peer chaincode install -n supplychain -v 2.0 -p github.com/chaincode/supplychain/cmd

CORE_PEER_LOCALMSPID="Org2MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp CORE_PEER_ADDRESS=peer0.org2.example.com:9051 peer chaincode install -n supplychain -v 2.0 -p github.com/chaincode/supplychain/cmd

CORE_PEER_LOCALMSPID="Org2MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp CORE_PEER_ADDRESS=peer1.org2.example.com:10051 peer chaincode install -n supplychain -v 2.0 -p github.com/chaincode/supplychain/cmd

peer chaincode instantiate -o orderer.example.com:7050 -C mychannel --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -n supplychain -v 2.0 -c '{"Args":['\"init\",\"\"']}'

CORE_PEER_LOCALMSPID="Org1MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp CORE_PEER_ADDRESS=peer0.org1.example.com:7051 peer chaincode query -C mychannel -n supplychain -c '{"Args":["createContainer","{\"misc\":{\"name\":\"Medicine Container\"},\"trackingID\":\"613254c0-5395-4069-971b-fff77dc9c73d\",\"counterparties\":[\"CN=Admin@org2.example.com,OU=client+OU=org2,O=Org2,L=San Francisco,C=US\"]}"]}'

jagpreetsinghsasan commented 4 years ago

Screenshot (13) Screenshot (11) Screenshot (12)