accordproject / hlf-cicero-contract

Accord Project Cicero contracts on Hyperledger Fabric v2
Apache License 2.0
14 stars 7 forks source link

[Question] After modification in install.sh and initialize.sh to my username is still looking for FABRIC_CFG_PATH does not exist? #3

Open scheung38 opened 4 years ago

scheung38 commented 4 years ago

initialize.sh

# set these three values based on your HLF install location
export HLF_INSTALL_DIR=$HOME/Desktop/fabric-samples
export HLF_TEST_NETWORK=${HLF_INSTALL_DIR}/test-network
# end set

install.sh

# set these three values based on your HLF install location
export HLF_INSTALL_DIR=/Users/mincheung/Desktop/fabric-samples
export HLF_TEST_NETWORK=${HLF_INSTALL_DIR}/test-network
# end set
-> hlf-cicero-contract git:(master) ✗ ./install.sh && ./initialize.sh

Approved for org1
{
        "approvals": {
                "Org1MSP": true,
                "Org2MSP": true
        }
}
checkcommitreadiness
2020-09-02 23:27:28.772 BST [chaincodeCmd] ClientWait -> INFO 001 txid [e2ab45169434d98d67f8e3ffdec4938890bb2c177a47614be21e67142e04ef64] committed with status (VALID) at localhost:7051
2020-09-02 23:27:28.801 BST [chaincodeCmd] ClientWait -> INFO 002 txid [e2ab45169434d98d67f8e3ffdec4938890bb2c177a47614be21e67142e04ef64] committed with status (VALID) at localhost:9051
chaincode committed
2020-09-02 23:27:35.206 BST [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 payload:"Initialized 1 clauses." 

So the above of install and initialise were ok.

But trigger.sh is still looking for FABRIC_CFG_PATH, which was previously defined in my ~/.zshrc

export PATH=$HOME/Desktop/fabric-samples/bin:$PATH
export FABRIC_CFG_PATH=$HOME/Desktop/fabric-samples/config

export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
export CORE_PEER_ADDRESS=localhost:7051

# Environment variables for Org2

export CORE_PEER_TLS_ENABLED=true
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_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
export CORE_PEER_ADDRESS=localhost:9051

So when executing .trigger.sh:

➜  hlf-cicero-contract git:(master) ✗ ./trigger.sh                           
2020-09-02 23:28:13.640 BST [main] InitCmd -> ERRO 001 Fatal error when initializing core config : FABRIC_CFG_PATH /Users/dselman/dev/fabric-samples/config/ does not exit

EDIT:

Forgot to also change trigger.sh:

export HLF_INSTALL_DIR=$HOME/Desktop/fabric-samples

JohnGr001 commented 4 years ago

Which version of hlf are you using?

I have a script for hlf v2.2 that is built on the "new" basic network and extends out the chaincode to allow multiple instances. I will post it tomorrow

I have a different one for v1.4.6 as well as a word tutorial for both.

I do intend to push them to the hlf repo but hadn't got to tidy the document

scheung38 commented 4 years ago

I think the installation is working now:

hlf-cicero-contract git:(master) ✗ ./trigger.sh
2020-09-02 23:41:44.065 BST [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 payload:“{\“$class\“:\“org.accordproject.helloworldstate.MyResponse\“,\“output\“:\“Hello Dan Selman Hello(1.0)\“,\“transactionId\“:\“4d128d9d10ff4e29e6037266cadce3c24043e0aba88259aaab41aaa9b11d2ce9\“,\“timestamp\“:{\“seconds\“:{\“low\“:1599086503,\“high\“:0,\“unsigned\“:false},\“nanos\“:984377000}}”

But not sure how to customize it with the generated output from https://studio.accordproject.org:

contract.txt replaces -> ???

rental-deposit.cta -> ???

request.json -> ???

Or how to import it back into studio to validate?