2017-11-02 10:19:05 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-11-15 14:46:12 +08:00
|
|
|
# This script will run some lscc queries for testing.
|
2017-11-02 10:19:05 +08:00
|
|
|
|
2017-11-15 14:46:12 +08:00
|
|
|
# Importing useful functions for cc testing
|
|
|
|
if [ -f ./func.sh ]; then
|
|
|
|
source ./func.sh
|
|
|
|
elif [ -f scripts/func.sh ]; then
|
|
|
|
source scripts/func.sh
|
|
|
|
fi
|
2017-11-02 10:19:05 +08:00
|
|
|
|
|
|
|
echo_b "LSCC testing"
|
|
|
|
|
2017-11-24 14:45:16 +08:00
|
|
|
org=1
|
|
|
|
peer=0
|
|
|
|
|
2017-11-02 10:19:05 +08:00
|
|
|
# invoke required following params
|
|
|
|
#-o orderer.example.com:7050 \
|
|
|
|
#--tls "true" \
|
2017-11-15 14:46:12 +08:00
|
|
|
#--cafile ${ORDERER_TLS_CA} \
|
|
|
|
|
2018-01-23 17:53:52 +08:00
|
|
|
CC_NAME=${CC_02_NAME}
|
|
|
|
|
2017-11-23 17:17:29 +08:00
|
|
|
echo_b "LSCC Get id"
|
2018-01-23 17:53:52 +08:00
|
|
|
chaincodeQuery "${APP_CHANNEL}" $org $peer lscc '{"Args":["getid","'${APP_CHANNEL}'", "'${CC_NAME}'"]}'
|
2017-11-02 10:19:05 +08:00
|
|
|
|
2017-11-23 17:17:29 +08:00
|
|
|
echo_b "LSCC Get cc ChaincodeDeploymentSpec"
|
2018-01-23 17:53:52 +08:00
|
|
|
chaincodeQuery "${APP_CHANNEL}" $org $peer lscc '{"Args":["getdepspec","'${APP_CHANNEL}'", "'${CC_NAME}'"]}'
|
2017-11-02 10:19:05 +08:00
|
|
|
|
2017-11-23 17:17:29 +08:00
|
|
|
echo_b "LSCC Get cc bytes"
|
2018-01-23 17:53:52 +08:00
|
|
|
chaincodeQuery "${APP_CHANNEL}" $org $peer lscc '{"Args":["getccdata","'${APP_CHANNEL}'", "'${CC_NAME}'"]}'
|
2017-11-02 10:19:05 +08:00
|
|
|
|
2018-01-23 17:53:52 +08:00
|
|
|
echo_b "LSCC Get all chaincodes installed on the peer"
|
2017-12-06 16:24:33 +08:00
|
|
|
chaincodeQuery "${APP_CHANNEL}" $org $peer lscc '{"Args":["getinstalledchaincodes"]}'
|
2017-11-02 10:19:05 +08:00
|
|
|
|
2017-11-23 17:17:29 +08:00
|
|
|
echo_b "LSCC Get all chaincodes instantiated on the channel"
|
2017-12-06 16:24:33 +08:00
|
|
|
chaincodeQuery "${APP_CHANNEL}" $org $peer lscc '{"Args":["getchaincodes"]}'
|
2017-11-23 22:22:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
#peer chaincode query \
|
2017-12-06 16:24:33 +08:00
|
|
|
# -C "${APP_CHANNEL}" \
|
2017-11-23 22:22:20 +08:00
|
|
|
# -n lscc \
|
2017-12-06 16:24:33 +08:00
|
|
|
# -c '{"Args":["getid","'${APP_CHANNEL}'", "'$CC_NAME'"]}'
|
2017-11-23 22:22:20 +08:00
|
|
|
|
|
|
|
#peer chaincode query \
|
2017-12-06 16:24:33 +08:00
|
|
|
# -C "${APP_CHANNEL}" \
|
2017-11-23 22:22:20 +08:00
|
|
|
# -n lscc \
|
2017-12-06 16:24:33 +08:00
|
|
|
# -c '{"Args":["getdepspec","'${APP_CHANNEL}'", "'$CC_NAME'"]}'
|
2017-11-23 22:22:20 +08:00
|
|
|
|
|
|
|
#peer chaincode query \
|
2017-12-06 16:24:33 +08:00
|
|
|
# -C "${APP_CHANNEL}" \
|
2017-11-23 22:22:20 +08:00
|
|
|
# -n lscc \
|
2017-12-06 16:24:33 +08:00
|
|
|
# -c '{"Args":["getccdata","'${APP_CHANNEL}'", "'$CC_NAME'"]}'
|
2017-11-23 22:22:20 +08:00
|
|
|
|
|
|
|
#peer chaincode query \
|
2017-12-06 16:24:33 +08:00
|
|
|
# -C "${APP_CHANNEL}" \
|
2017-11-23 22:22:20 +08:00
|
|
|
# -n lscc \
|
|
|
|
# -c '{"Args":["getinstalledchaincodes"]}'
|
|
|
|
|
|
|
|
#peer chaincode query \
|
2017-12-06 16:24:33 +08:00
|
|
|
# -C "${APP_CHANNEL}" \
|
2017-11-23 22:22:20 +08:00
|
|
|
# -n lscc \
|
|
|
|
# -c '{"Args":["getchaincodes"]}'
|
2017-11-02 10:19:05 +08:00
|
|
|
|
2018-01-23 17:53:52 +08:00
|
|
|
echo_g "LSCC testing done!"
|
|
|
|
|
|
|
|
echo
|