To add the Org3 to the consortium and give it the authority to create a new channel it must be added to the system channel
Once Org3 is added to the channel the below steps need to be run from cli container since Orderer is in that container
CORE_PEER_LOCALMSPID="OrdererMSP" CORE_PEER_TLS_ROOTCERT_FILE=$ORDERER_CA CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp
peer channel fetch config sys_config_block.pb -o orderer.example.com:7050 -c testchainid --tls --cafile $ORDERER_CA
curl -X POST --data-binary @sys_config_block.pb "$CONFIGTXLATOR_URL/protolator/decode/common.Block" | jq . > sys_config_block.json
jq .data.data[0].payload.data.config sys_config_block.json > sys_config.json
jq -s '.[0] * {"channel_group":{"groups":{"Consortiums":{"groups": {"SampleConsortium": {"groups": {"Org3MSP":.[1]}}}}}}}' sys_config.json ./scripts/org3.json >& sys_updated_config.json
curl -X POST --data-binary @sys_config.json "$CONFIGTXLATOR_URL/protolator/encode/common.Config" > sys_config.pb
curl -X POST --data-binary @sys_updated_config.json "$CONFIGTXLATOR_URL/protolator/encode/common.Config" > sys_updated_config.pb
curl -X POST -F channel=testchainid -F "original=@sys_config.pb" -F "updated=@sys_updated_config.pb" "${CONFIGTXLATOR_URL}/configtxlator/compute/update-from-configs" > sys_config_update.pb
curl -X POST --data-binary @sys_config_update.pb "$CONFIGTXLATOR_URL/protolator/decode/common.ConfigUpdate" | jq . > sys_config_update.json
echo '{"payload":{"header":{"channel_header":{"channel_id":"testchainid", "type":2}},"data":{"config_update":'$(cat sys_config_update.json)'}}}' | jq . > sys_config_update_in_envelope.json
curl -X POST --data-binary @sys_config_update_in_envelope.json "$CONFIGTXLATOR_URL/protolator/encode/common.Envelope" > sys_config_update_in_envelope.pb
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/users/[email protected]/msp
peer channel update -f sys_config_update_in_envelope.pb -c testchainid -o orderer.example.com:7050 --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
To create a new channel the profile needs to be updated and defined as TwoOrgsChannel1 in the configtx.yaml file with only Org1 and Org3
The below steps should be done outside of cli container in a separate terminal window from org3-artifacts dir
FABRIC_CFG_PATH=$PWD
../../bin/configtxgen -profile NewOrgChannel -outputCreateChannelTx ../channel-artifacts/channel1.tx -channelID mychannel1
peer channel create -o orderer.example.com:7050 -c mychannel1 -f ./channel-artifacts/channel1.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
peer channel join -b mychannel1.block
peer chaincode install -n newcc -v 1.0 -p github.com/chaincode/chaincode_example02/go/
peer chaincode instantiate -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C mychannel1 -n newcc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.member','Org3MSP.member')"
peer channel fetch config mychannel1.pb -o orderer.example.com:7050 -c mychannel1 --tls --cafile $ORDERER_CA
peer channel join -b mychannel1.pb
peer chaincode install -n newcc -v 1.0 -p github.com/chaincode/chaincode_example02/go/
peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C mychannel1 -n newcc -c '{"Args":["invoke","a","b","10"]}'
peer chaincode query -C mychannel1 -n newcc -c '{"Args":["query","a"]}'