mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Fabric 1.1 supports javascript chaincode. This changeset addresses porting of the golang chaincode to node.js chiancode and the corresponding README files Change-Id: Iae24e713f16ab3508fe0cc18ee062ffa412b8ba6 Signed-off-by: ratnakar <asara.ratnakar@gmail.com>
36 lines
1.8 KiB
Bash
Executable file
36 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Copyright IBM Corp All Rights Reserved
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Exit on first error
|
|
set -e
|
|
|
|
# don't rewrite paths for Windows Git Bash users
|
|
export MSYS_NO_PATHCONV=1
|
|
starttime=$(date +%s)
|
|
LANGUAGE=${1:-"golang"}
|
|
CC_SRC_PATH=github.com/fabcar/go
|
|
if [ "$LANGUAGE" = "node" -o "$LANGUAGE" = "NODE" ]; then
|
|
CC_SRC_PATH=/opt/gopath/src/github.com/fabcar/node
|
|
fi
|
|
|
|
if [ ! -d ~/.hfc-key-store/ ]; then
|
|
mkdir ~/.hfc-key-store/
|
|
fi
|
|
cp $PWD/creds/* ~/.hfc-key-store/
|
|
# launch network; create channel and join peer to channel
|
|
cd ../basic-network
|
|
./start.sh
|
|
|
|
# Now launch the CLI container in order to install, instantiate chaincode
|
|
# and prime the ledger with our 10 cars
|
|
docker-compose -f ./docker-compose.yml up -d cli
|
|
|
|
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode install -n fabcar -v 1.0 -p "$CC_SRC_PATH" -l "$LANGUAGE"
|
|
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n fabcar -l "$LANGUAGE" -v 1.0 -c '{"Args":[""]}' -P "OR ('Org1MSP.member','Org2MSP.member')"
|
|
sleep 10
|
|
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode invoke -o orderer.example.com:7050 -C mychannel -n fabcar -c '{"function":"initLedger","Args":[""]}'
|
|
|
|
printf "\nTotal execution time : $(($(date +%s) - starttime)) secs ...\n\n"
|