mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
For the asset transfer example (https://hyperledger-fabric.readthedocs.io/en/release-2.5/private_data_tutorial.html#pd-use-case) the are three private data collections, one per org and one shared between the orgs. The shared collection didn't have an endorsement policy so inheritted the chaincodes; this was specifically set away from the default to be OR(Org1MSP,Org2MSP). The documentation says this is to ensure that either organization can create and asset. However this isn't really necassary, the endorsement policy should be lowest level; so this PR moves the endorsement policy to the collection. The documentation does I believe lead to a false understanding Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
47 lines
1.2 KiB
Bash
Executable file
47 lines
1.2 KiB
Bash
Executable file
set -euo pipefail
|
|
|
|
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go}
|
|
CHAINCODE_NAME=${CHAINCODE_NAME:-private}
|
|
CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-private-data}
|
|
|
|
function print() {
|
|
GREEN='\033[0;32m'
|
|
NC='\033[0m'
|
|
echo
|
|
echo -e "${GREEN}${1}${NC}"
|
|
}
|
|
|
|
function createNetwork() {
|
|
print "Creating network"
|
|
./network.sh up createChannel -ca -s couchdb
|
|
print "Deploying ${CHAINCODE_NAME} chaincode"
|
|
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccp "${CHAINCODE_PATH}/chaincode-${CHAINCODE_LANGUAGE}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}" -cccg ../asset-transfer-private-data/chaincode-go/collections_config.json
|
|
}
|
|
|
|
function stopNetwork() {
|
|
print "Stopping network"
|
|
./network.sh down
|
|
}
|
|
|
|
# Run Javascript application
|
|
createNetwork
|
|
print "Initializing Javascript application"
|
|
pushd ../asset-transfer-private-data/application-javascript
|
|
npm install
|
|
print "Executing app.js"
|
|
node app.js
|
|
popd
|
|
stopNetwork
|
|
|
|
|
|
# Run typescript gateway application
|
|
createNetwork
|
|
print "Initializing typescript application"
|
|
pushd ../asset-transfer-private-data/application-gateway-typescript
|
|
npm install
|
|
print "Build typescript app"
|
|
npm run build
|
|
print "Executing app.js"
|
|
npm start
|
|
popd
|
|
stopNetwork
|