Changing Chaincode Policy


Antoni Massó Mola <antonimassomola@...>
 

Hello,

I'm trying to change a chaincode policy using lifecyles.

I'm using the following commands:

CHANNELID=o-test2
CHAINCODENAME=o-test24
CHAINCODEVERSION=1
CHAINCODESEQUENCE=4
PACKAGEID=o-test24:7444dd525eb4bf0e20b055de52ed722b056905984a902d5f7a321870bcf4e8f0
POLICY="OR ('org1.member')"
 
export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peerOrganizations/org1/users/Admin@org1/msp
export CORE_PEER_ADDRESS=peer0-org1-service:7051
export CORE_PEER_LOCALMSPID=org1
export CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peerOrganizations/org1/peers/org1-peer0.default.svc.cluster.local/tls/ca.crt
peer lifecycle chaincode approveformyorg -o orderer0-service:7050 --tls --cafile /etc/hyperledger/orderers/msp/tlscacerts/ca-root-7054.pem --channelID $CHANNELID --name $CHAINCODENAME --version $CHAINCODEVERSION --sequence $CHAINCODESEQUENCE --waitForEvent --signature-policy $POLICY --package-id $PACKAGEID
export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peerOrganizations/org2/users/Admin@org2/msp
export CORE_PEER_ADDRESS=peer0-org2-service:9051
export CORE_PEER_LOCALMSPID=org2
export CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peerOrganizations/org2/peers/org2-peer0.default.svc.cluster.local/tls/ca.crt
peer lifecycle chaincode approveformyorg -o orderer0-service:7050 --tls --cafile /etc/hyperledger/orderers/msp/tlscacerts/ca-root-7054.pem --channelID $CHANNELID --name $CHAINCODENAME --version $CHAINCODEVERSION --sequence $CHAINCODESEQUENCE --waitForEvent --signature-policy $POLICY --package-id $PACKAGEID
 
peer lifecycle chaincode checkcommitreadiness --channelID $CHANNELID --name $CHAINCODENAME --version $CHAINCODEVERSION --sequence $CHAINCODESEQUENCE --signature-policy $POLICY --output json
 
peer lifecycle chaincode commit -o orderer0-service:7050 --tls --cafile /etc/hyperledger/orderers/msp/tlscacerts/ca-root-7054.pem --channelID $CHANNELID --name $CHAINCODENAME --version $CHAINCODEVERSION --sequence $CHAINCODESEQUENCE --signature-policy $POLICY

The transaction is successfully executed but the policy seems to be not implemented. For example I try to set the policy to OR('org1.member') but I am able to to invoke the chaincode with a user from org2 using mspID of org2.

Is there a command to view the currently policy set for a chaincode?

Thanks 

Join fabric@lists.hyperledger.org to automatically receive all group messages.