Nov 11/2022 Update

This commit is contained in:
Fernando Garzon 2022-11-11 11:00:38 -08:00
parent ed74286f4d
commit 5e3e50fd37
2 changed files with 99 additions and 71 deletions

View file

@ -7,10 +7,9 @@ import (
"github.com/hyperledger/fabric-contract-api-go/contractapi" "github.com/hyperledger/fabric-contract-api-go/contractapi"
"github.com/xeipuuv/gojsonschema" "github.com/xeipuuv/gojsonschema"
"log"
"crypto/sha256" "crypto/sha256"
"encoding/hex" "encoding/hex"
"reflect" "log"
) )
// SmartContract provides functions for managing an Asset // SmartContract provides functions for managing an Asset
@ -53,7 +52,7 @@ type Data struct {
ContributorId string `json:"ContributorId"` ContributorId string `json:"ContributorId"`
ContentHash string `json:"ContentHash"` ContentHash string `json:"ContentHash"`
Id string `json:"Id"` Id string `json:"Id"`
Owners []string `json:"Owners"` Owner string `json:"Owners"`
JsonFileContent map[string]interface{} JsonFileContent map[string]interface{}
} }
@ -90,7 +89,7 @@ func (s *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface,
ContributorId: "ABC123", ContributorId: "ABC123",
ContentHash: firstJsonFileHash, ContentHash: firstJsonFileHash,
Id: "00000", Id: "00000",
Owners: []string{"CIA", "DEA", "FBI"}, Owner: "CIA",
JsonFileContent: firstJsonFileContent, JsonFileContent: firstJsonFileContent,
} }
@ -102,6 +101,8 @@ func (s *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface,
err = ctx.GetStub().PutState(data.ContentHash, assetJSON) err = ctx.GetStub().PutState(data.ContentHash, assetJSON)
if err != nil { if err != nil {
return fmt.Errorf("failed to put to world state. %v", err) return fmt.Errorf("failed to put to world state. %v", err)
} else {
fmt.Print("A new Data Struct has been created with the hash %v", firstJsonFileHash)
} }
//This is the definition of the Schema that we should use for validate all the JSON files from now on. //This is the definition of the Schema that we should use for validate all the JSON files from now on.
@ -120,13 +121,15 @@ func (s *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface,
err = ctx.GetStub().PutState(initSchema.Hash, assetJSON) err = ctx.GetStub().PutState(initSchema.Hash, assetJSON)
if err != nil { if err != nil {
return fmt.Errorf("failed to put to world state. %v", err) return fmt.Errorf("failed to put to world state. %v", err)
} else {
fmt.Print("A new Schema has been created with the hash %v", schemaJsonFileHash)
} }
} }
} }
return nil return nil
} }
func (s *SmartContract) LastSchemaHash(ctx contractapi.TransactionContextInterface) (string) { func (s *SmartContract) LastSchemaHash(ctx contractapi.TransactionContextInterface) string {
return lastSchemaHash return lastSchemaHash
} }
@ -147,7 +150,6 @@ func (s *SmartContract) Hash(ctx contractapi.TransactionContextInterface, doc st
} }
} }
func (s *SmartContract) JsonReader(ctx contractapi.TransactionContextInterface, content string) (map[string]interface{}, error) { func (s *SmartContract) JsonReader(ctx contractapi.TransactionContextInterface, content string) (map[string]interface{}, error) {
var payload map[string]interface{} var payload map[string]interface{}
@ -161,7 +163,7 @@ func (s *SmartContract) JsonReader(ctx contractapi.TransactionContextInterface,
} }
// GetAllAssets returns all assets found in world state // GetAllAssets returns all assets found in world state
func (s *SmartContract) GetAllAssets(ctx contractapi.TransactionContextInterface) ([]*Data, error) { /*func (s *SmartContract) GetAllAssets(ctx contractapi.TransactionContextInterface) ([]*Data, error) {
// range query with empty string for startKey and endKey does an // range query with empty string for startKey and endKey does an
// open-ended query of all assets in the chaincode namespace. // open-ended query of all assets in the chaincode namespace.
resultsIterator, err := ctx.GetStub().GetStateByRange("", "") resultsIterator, err := ctx.GetStub().GetStateByRange("", "")
@ -197,6 +199,7 @@ func (s *SmartContract) GetAllAssets(ctx contractapi.TransactionContextInterface
return dataSamples, nil return dataSamples, nil
} }
*/
func (s *SmartContract) SchemaExists(ctx contractapi.TransactionContextInterface, Hash string) (bool, error) { func (s *SmartContract) SchemaExists(ctx contractapi.TransactionContextInterface, Hash string) (bool, error) {
assetJSON, err := ctx.GetStub().GetState(Hash) assetJSON, err := ctx.GetStub().GetState(Hash)
@ -251,7 +254,6 @@ func (s *SmartContract) CreateNewSchema(ctx contractapi.TransactionContextInterf
} }
} }
// GetAllSchemas returns all schemas found in world state // GetAllSchemas returns all schemas found in world state
//func (s *SmartContract) GetAllSchemas(ctx contractapi.TransactionContextInterface) ([]Schema, error) { //func (s *SmartContract) GetAllSchemas(ctx contractapi.TransactionContextInterface) ([]Schema, error) {
@ -330,7 +332,7 @@ func (s *SmartContract) ValidJson(ctx contractapi.TransactionContextInterface, J
// CreateDataSample issues a new Data Sample to the world state with given details. // CreateDataSample issues a new Data Sample to the world state with given details.
func (s *SmartContract) CreateDataSample(ctx contractapi.TransactionContextInterface, func (s *SmartContract) CreateDataSample(ctx contractapi.TransactionContextInterface,
Contributor string, ContributorId string, Id string, JsonFileContent string) error { Contributor string, ContributorId string, Id string, Owner string, JsonFileContent string) error {
ContentHash, err := s.Hash(ctx, JsonFileContent) ContentHash, err := s.Hash(ctx, JsonFileContent)
exists, err := s.AssetExists(ctx, ContentHash) exists, err := s.AssetExists(ctx, ContentHash)
@ -338,7 +340,7 @@ func (s *SmartContract) CreateDataSample(ctx contractapi.TransactionContextInter
return err return err
} }
if exists { if exists {
return fmt.Errorf("the asset %s already exists", Id) return fmt.Errorf("the asset %s already exists", ContentHash)
} }
valid, err := s.ValidJson(ctx, JsonFileContent) valid, err := s.ValidJson(ctx, JsonFileContent)
@ -357,7 +359,7 @@ func (s *SmartContract) CreateDataSample(ctx contractapi.TransactionContextInter
ContributorId: ContributorId, ContributorId: ContributorId,
ContentHash: ContentHash, ContentHash: ContentHash,
Id: Id, Id: Id,
Owners: []string{"DOE", "DOS", "DOJ"}, Owner: Owner,
JsonFileContent: jsonFileContent, JsonFileContent: jsonFileContent,
} }
@ -371,6 +373,7 @@ func (s *SmartContract) CreateDataSample(ctx contractapi.TransactionContextInter
} }
} }
// UpdateAsset updates an existing asset in the world state with provided parameters. // UpdateAsset updates an existing asset in the world state with provided parameters.
func (s *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface, func (s *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface,
Contributor string, ContributorId string, ContentHash string, Id string) error { Contributor string, ContributorId string, ContentHash string, Id string) error {

View file

@ -48,7 +48,6 @@ echo "========= Approving ChainCode ORG2 ==========="
peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name basic --version 1.0 --package-id $CC_PACKAGE_ID --sequence 1 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name basic --version 1.0 --package-id $CC_PACKAGE_ID --sequence 1 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
echo "========= Approving ChainCode ORG1 ===========" echo "========= Approving ChainCode ORG1 ==========="
export CORE_PEER_LOCALMSPID="Org1MSP" export CORE_PEER_LOCALMSPID="Org1MSP"
@ -68,21 +67,47 @@ peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride o
peer lifecycle chaincode querycommitted --channelID mychannel --name basic --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" peer lifecycle chaincode querycommitted --channelID mychannel --name basic --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
echo "========= CC Test of jsonRead Function ==========="
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"JsonReader","Args":["/home/chaincode/schema.json"]}'
echo "========= CC Invoke: Inizialitation ===========" echo "========= CC Invoke: Inizialitation ==========="
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"InitLedger","Args":[]}' #peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"InitLedger","Args":[]}'
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"InitLedger","Args":["/home/chaincode/schema.json", "/home/chaincode/firstJson.json"]}'
echo "========= CC Query: Get all DataSamples ===========" echo "========= CC Query: Get all DataSamples ==========="
peer chaincode query -C mychannel -n basic -c '{"Args":["GetAllAssets"]}' peer chaincode query -C mychannel -n basic -c '{"Args":["GetAllAssets"]}'
echo "========= CC Query: Get all Schemas ==========="
peer chaincode query -C mychannel -n basic -c '{"Args":["GetAllSchemas"]}'
echo "========= Check if sample with id = '00000' Exists ===========" echo "========= Check if sample with id = '00000' Exists ==========="
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"AssetExists","Args":["00000"]}' peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"AssetExists","Args":["00000"]}'
echo "========= Check creation of a new sample wit id = '00001' ===========" echo "========= Check creation of a new sample wit id = '00001' ==========="
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"CreateDataSample","Args":["docTypeTest2","00001","TestTitle2","Desc2","Neuroscience","TestDOI","www.ncis.edu","TestManifest","TestFootPrint", "Neuroscience, brain", "None", "None", "None","None","None","None","None", "None"]}' # peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"CreateDataSample","Args":["docTypeTest2","00001","TestTitle2","Desc2","Neuroscience","TestDOI","www.ncis.edu","TestManifest","TestFootPrint", "Neuroscience, brain", "None", "None", "None","None","None","None","None", "None"]}'
#peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"CreateDataSample","Args":["UCSD-SDSC", "Contributor123", "PhonyHash!@#$$%#@", "00001", ["DOE FER"]]}'
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"CreateDataSample","Args":["UCSD-SDSC", "Contributor123", "PhonyHash!@#$$%#@", "00001", "/home/chaincode/testFileNewSample.json"]}'
#peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile \
echo "========= Check creation of a new Schema ==========="
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"CreateNewSchema","Args":["UCSD-SDSC", "Contributor123", "PhonyHash!@#$$%#@", "00001", "/home/chaincode/NewSchema.json"]}'
echo "========= Check creation of a new sample wit id = '00002' based on New Schema ==========="
# peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"CreateDataSample","Args":["docTypeTest2","00001","TestTitle2","Desc2","Neuroscience","TestDOI","www.ncis.edu","TestManifest","TestFootPrint", "Neuroscience, brain", "None", "None", "None","None","None","None","None", "None"]}'
#peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"CreateDataSample","Args":["UCSD-SDSC", "Contributor123", "PhonyHash!@#$$%#@", "00001", ["DOE FER"]]}'
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"CreateDataSample","Args":["UCSD-SDSC", "Contributor123", "PhonyHash!@#$$%#@", "00002", "/home/chaincode/testFileNewSample.json"]}'
echo "========= The code below will upgrade an existing ChainCode ===========" echo "========= The code below will upgrade an existing ChainCode ==========="
@ -108,7 +133,7 @@ var2=$(echo $var | tail -n 1 | cut -f 3 -d ' ')
export NEW_CC_PACKAGE_ID=$(echo $var2 | sed 's/.$//') export NEW_CC_PACKAGE_ID=$(echo $var2 | sed 's/.$//')
echo $NEW_CC_PACKAGE_ID echo $NEW_CC_PACKAGE_ID
peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name basic --version 3.0 --package-id $NEW_CC_PACKAGE_ID --sequence 3 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name basic --version 3.0 --package-id $NEW_CC_PACKAGE_ID --sequence 2 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
export CORE_PEER_LOCALMSPID="Org2MSP" export CORE_PEER_LOCALMSPID="Org2MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
@ -117,11 +142,11 @@ export CORE_PEER_ADDRESS=localhost:9051
peer lifecycle chaincode install basic_3.tar.gz peer lifecycle chaincode install basic_3.tar.gz
peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name basic --version 3.0 --package-id $NEW_CC_PACKAGE_ID --sequence 3 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name basic --version 3.0 --package-id $NEW_CC_PACKAGE_ID --sequence 2 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name basic --version 3.0 --sequence 3 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" --output json peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name basic --version 3.0 --sequence 2 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" --output json
peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name basic --version 3.0 --sequence 3 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name basic --version 3.0 --sequence 2 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
echo "========= Update of Sample 00001 ===========" echo "========= Update of Sample 00001 ==========="