Im trying to install & instantiate a javascript chaincode app. Im using the fabcar demo app.
Install works fine:
peer chaincode install -l node -n fabcar -v 1.1.1 -p hyperledger-config/chaincode/src/fabcar/ -o orderer0-service:7050 --tls --cafile=/etc/hyperledger/orderers/msp/tlscacerts/ca-root-7054.pem
2020-03-09 20:11:20.003 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-03-09 20:11:20.003 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-03-09 20:11:20.032 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
Chaincode instantiation is where it fails with an error Im not able to find information about
peer chaincode instantiate -C mainchannel -n fabcar -l node -v 1.1.1 -c '{"Args":[]}' -o orderer0-service:7050 --tls --cafile=/etc/hyperledger/orderers/msp/tlscacerts/ca-root-7054.pem -P "AND('org1.admin', 'org2.admin')"
2020-03-09 20:11:50.142 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-03-09 20:11:50.142 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 127 "/bin/sh: npm: not found
"
Any help would be appreciated. Thanks.
Have you installed node package manager(NPM)? If yes what's the version of NPM? The error clearly specifies that the script file can't find npm. Don't forget to add it to the path. Find the installation guide here.
Upgraded peers to 2.0 and now instantiation works as well.
Related
I am executing a command like below and getting error
root#86f7544dc3ec:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.example.com:7050 --tls true --cafile $ORDERER_CA -C mychannel -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR
('Org1MSP.member','Org2MSP.member')"
2022-03-02 09:21:12.941 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-03-02 09:21:12.941 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: cannot connect to Docker endpoint
This is my error log in the container(
peer0.org1.example.com)
2022-03-02 09:21:12.942 UTC [endorser] callChaincode -> INFO 06d [mychannel][4b047f4d] Entry chaincode: name:"lscc"
2022-03-02 09:21:12.943 UTC [dockercontroller] Start -> ERRO 06e create container failed: cannot connect to Docker endpoint imageName=dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9 containerName=dev-peer0.org1.example.com-mycc-1.0
2022-03-02 09:21:12.943 UTC [endorser] callChaincode -> INFO 06f [mychannel][4b047f4d] Exit chaincode: name:"lscc" (2ms)
2022-03-02 09:21:12.943 UTC [endorser] SimulateProposal -> ERRO 070 [mychannel][4b047f4d] failed to invoke chaincode name:"lscc" , error: cannot connect to Docker endpoint
error starting container
error starting container
I am getting this error on windows 10 and the command I am using is
"./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-javascript/ -ccl javascript"
and the error I am getting is :
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image inspection failed: cannot connect to Docker endpoint
Chaincode installation on peer0.org1 has failed
Deploying chaincode failed
Docker version 20.10.7, build f0df350
docker-compose version 1.29.2, build 5becea4c
The command and the response of above :
/c/fabric-samples/test-network (main)
$ ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-javascript/ -ccl javascript
deploying chaincode on channel 'mychannel'
executing with the following
CHANNEL_NAME: mychannel
CC_NAME: basic
CC_SRC_PATH: ../asset-transfer-basic/chaincode-javascript/
CC_SRC_LANGUAGE: javascript
CC_VERSION: 1.0
CC_SEQUENCE: 1
CC_END_POLICY: NA
CC_COLL_CONFIG: NA
CC_INIT_FCN: NA
DELAY: 3
MAX_RETRY: 5
VERBOSE: false
peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-javascript/ --lang node --label basic_1.0
res=0
Chaincode is packaged
Installing chaincode on peer0.org1...
Using organization 1
peer lifecycle chaincode install basic.tar.gz
res=1
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image inspection failed: cannot connect to Docker endpoint
Chaincode installation on peer0.org1 has failed
Deploying chaincode failed
Ok, I am not 100% sure but to package nodejs chaincode on windows you need some necessary Visual Studio C++ Build Tools which seems to be missing /cause of error.
npm install --global windows-build-tools
Checkout Windows extra under - Prerequisites Hyperledger-fabric docs
I have installed Hyperledger Fabric (2.0.0-alpha) in Docker (2.2.0.5) running on Windows (Linux containers) and am trying to start the first-network example. When running the command ./byfn.sh -m up I am getting the following error:
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused
"no such file or directory": unknown ERROR !!!! Test failed
From the Docker Dashboard, cli and peers have started, instead of orderer. When checking the logs of the orderer I see the following error:
2020-05-04 20:29:04.492 UTC [orderer.common.cluster] loadVerifier -> ERRO 003 Channel byfn-sys-channel has no blocks, skipping it
2020-05-04 20:29:04.500 UTC [orderer.common.cluster] loadVerifier -> INFO 004 Loaded verifier for channel testchainid from config block at index 0
2020-05-04 20:29:04.520 UTC [orderer.common.server] initializeServerConfig -> INFO 005 Starting orderer with TLS enabled
2020-05-04 20:29:04.521 UTC [orderer.common.server] initializeMultichannelRegistrar -> INFO 006 Not bootstrapping because of existing chains
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe06ad9]
goroutine 1 [running]:
github.com/hyperledger/fabric/protoutil.GetMetadataFromBlock(0x0, 0x1, 0x0, 0x194, 0x1dad440)
/go/src/github.com/hyperledger/fabric/protoutil/blockutils.go:110 +0x39
github.com/hyperledger/fabric/protoutil.GetLastConfigIndexFromBlock(0x0, 0xc0002f22a0, 0xffffffffffffffff, 0x0)
/go/src/github.com/hyperledger/fabric/protoutil/blockutils.go:130 +0x37
github.com/hyperledger/fabric/orderer/common/multichannel.ConfigBlock(0x7f12cf76eda8, 0xc0002f22a0, 0x7f12cf76eda8)
/go/src/github.com/hyperledger/fabric/orderer/common/multichannel/registrar.go:111 +0x68
github.com/hyperledger/fabric/orderer/common/multichannel.configTx(0x7f12cf76eda8, 0xc0002f22a0, 0xc0002f22a0)
/go/src/github.com/hyperledger/fabric/orderer/common/multichannel/registrar.go:124 +0x35
I've checked for solutions online but no results till now.
Similar question 1 - he does not explain if he installed a new Docker version or did anything else differently.
Similar question 2 - in docker-compose.yml my working_dir for orderer.example.com is /opt/gopath/src/github.com/hyperledger/fabric/orderer and for cli /opt/gopath/src/github.com/hyperledger/fabric/peer
Also, my GO version is go1.8.7
I solved the issue following a few steps:
My scripts were not working well. so I opened file script.sh and utils.sh with notepad++ and set the EOL Conversion to Linux. After this I got the following error:
Error: failed to create deliver client for orderer: orderer client
failed to connect to orderer.example.com:7050: failed to create new
connection: connection error: desc = "transport: error while dialing:
dial tcp: lookup orderer.example.com on 127.0.0.11:53: no such host"
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
I also cleared all unused images with the following docker rm -f $(docker ps -aq)
Bringing down the network ./byfn.sh down and then start it again solved the issue.
I'm trying to setup simple blockchain network with Hyperledger fabric v1.0 on 2 instances.
My scenario
Instance A: Orderer and Peer0
Instance B: Peer1
I basically followed the "Use the native binaries" section of "Getting Started" page.
What I tried is I started 1 orderer and 1 peer on instanceA.
I installed, instantiated, invoked and made a query the example chaincode.
Then I started 1 peer on instanceB.
I could let peer1 on instanceB join my channel from instanceA. I could install the chaincode on peer1 from instanceA.
But I could not execute query peer1 from instanceA.
I can see at least chaincode installed on instanceB.
Error message is:
Error: Error endorsing query: rpc error: code = 2 desc = failed to obtain cds for mycc - transaction not found mycc/mychannel1
Below are commands I tried...
[InstanceA terminal1] 1. generate orderer.block
$ configtxgen -profile SampleSingleMSPSolo -outputBlock orderer.block
[InstanceA terminal2] 2. start orderer
$ CORE_PEER_LOCALMSPID=DEFAULT CORE_LOGGING_LEVEL=DEBUG ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 ORDERER_GENERAL_GENESISMETHOD=file ORDERER_GENERAL_GENESISFILE=./orderer.block
2017-04-08 23:38:41.562 UTC [orderer/multichain] NewManagerImpl -> INFO 001 Starting with system channel testchainid and orderer type solo
2017-04-08 23:38:41.562 UTC [orderer/main] NewServer -> INFO 002 Starting orderer
2017-04-08 23:38:41.562 UTC [orderer/main] main -> INFO 003 Beginning to serve requests
2017-04-08 23:39:39.881 UTC [orderer/multichain] newChain -> INFO 004 Created and starting new chain mychannel1
[InstanceA terminal1] 3. generate channel.tx
$ configtxgen -profile SampleSingleMSPSolo -outputCreateChannelTx channel.tx -channelID mychannel1
[InstanceA terminal3] 4. start peer0
$ CORE_PEER_GOSSIP_EXTERNALENDPOINT=127.0.0.1:7051 CORE_LOGGING_LEVEL=DEBUG CORE_PEER_LOCALMSPID=DEFAULT peer node start --peer-defaultchain=false
[InstanceA terminal1] 5. Create Channel
$ CORE_PEER_LOCALMSPID=DEFAULT peer channel create -o 127.0.0.1:7050 -c mychannel1 -f channel.tx
[InstanceA terminal1] 6. Join peer0 to mychannel1
$ CORE_PEER_LOCALMSPID=DEFAULT peer channel join -b mychannel1.block
Peer joined the channel!
2017-04-08 23:39:54.463 UTC [main] main -> INFO 001 Exiting.....
[InstanceA terminal1] 7. Install a chaincode
$ CORE_PEER_LOCALMSPID=DEFAULT peer chaincode install -o 127.0.0.1:7050 -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
ncode/go/chaincode_example02
2017-04-08 23:40:05.744 UTC [golang-platform] writeGopathSrc -> INFO 001 rootDirectory = /home/kouohhashi/work/src
2017-04-08 23:40:05.744 UTC [container] WriteFolderToTarPackage -> INFO 002 rootDirectory = /home/kouohhashi/work/src
2017-04-08 23:40:36.242 UTC [main] main -> INFO 003 Exiting.....
[InstanceA terminal1] 7. Instantiate the chaincode
$ CORE_PEER_ADDRESS=127.0.0.1:7051 CORE_PEER_LOCALMSPID=DEFAULT peer chaincode instantiate -o 127.0.0.1:7050 -C mychannel1 -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}'
1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}'
2017-04-08 23:40:39.892 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2017-04-08 23:40:39.893 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2017-04-08 23:40:42.194 UTC [main] main -> INFO 003 Exiting.....
[InstanceA terminal1] 8. Invoke and query a command
$ CORE_PEER_ADDRESS=127.0.0.1:7051 peer chaincode invoke -o 127.0.0.1:7050 -C mychannel1 -n mycc -c '{"Args":["invoke","a","b","10"]}'
$ CORE_PEER_ADDRESS=127.0.0.1:7051 peer chaincode query -o 127.0.0.1:7050 -C mychannel1 -n mycc -c '{"Args":["query","a"]}'
Query Result: 90
2017-04-08 23:40:51.664 UTC [main] main -> INFO 001 Exiting.....
[InstanceB terminal1] 9. Create peer1 on instanceB
$ CORE_PEER_MSPCONFIGPATH=/home/kouohhashi/work/src/github.com/hyperledger/fabric/msp/sampleconfig CORE_PEER_GOSSIP_EXTERNALENDPOINT=instanceB:7051 CORE_LOGGING_LEVEL=DEBUG CORE_PEER_LOCALMSPID=DEFAULT peer node start --peer-defaultchain=false
[InstanceA terminal1] 10. Join peer1 on instance B to mychannel1 from instanceA
$ CORE_PEER_LOCALMSPID=DEFAULT CORE_PEER_ADDRESS=instanceB:7051 peer channel join -b mychannel1.block
Peer joined the channel!
2017-04-08 23:42:14.799 UTC [main] main -> INFO 001 Exiting.....
[InstanceA terminal1] 11. Install chaincode on peer1 on instanceB from instance A
$ CORE_PEER_LOCALMSPID=DEFAULT CORE_PEER_ADDRESS=instanceB:7051 peer chaincode install -o 127.0.0.1:7050 -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
2017-04-08 23:42:23.166 UTC [golang-platform] writeGopathSrc -> INFO 001 rootDirectory = /home/kouohhashi/work/src
2017-04-08 23:42:23.166 UTC [container] WriteFolderToTarPackage -> INFO 002 rootDirectory = /home/kouohhashi/work/src
2017-04-08 23:42:39.191 UTC [main] main -> INFO 003 Exiting.....
[InstanceA terminal1] 12. Query peer1 from instanceA
$ CORE_PEER_ADDRESS=instanceB:7051 peer chaincode query -o 127.0.0.1:7050 -C mychannel1 -n mycc -c '{"Args":["query","a"]}'
I got errors like below. But I can see at least mycc chaincode on
instnceB and peer join command was completed successfully.
Error: Error endorsing query: rpc error: code = 2 desc = failed to obtain cds for mycc - transaction not found mycc/mychannel1
I'm using 2 ubuntu16.04 instances and not using docker or vagrant at all. I compiled binaries by make native.
Peer1 on instanceB may not connect orderer on instanceA because I saw the error log on peer1.
2017-04-08 23:42:14.903 UTC [deliveryClient] NewDeliverService -> ERRO 286 Cannot dial to 0.0.0.0:7050, because of grpc: timed out when dialing
Looks like peer1 tried to connect 0.0.0.0 instead of instanceA.
By the way I changed the Name of Organizations to DEFAULT from SampleOrg because I got errors like below otherwise.
2017-04-08 05:17:57.919 UTC [gossip/service] configUpdated -> ERRO 25e Tried joining channel mychannel1 but our org( DEFAULT ), isn't among the orgs of the channel: [SampleOrg] , aborting.
I think this may be because peer1 on instanceB was not linked to orderder on instanceA or transaction made by peer0 was not completed and reflected on instanceB. But I have no idea how to dig in...
Please give me help.
Thanks.
I finally solved my problem.
I turned out to be simple.
The solution was changing addresses of the orderer from 127.0.0.1:7050 to (IP Address of InstanceA):7050
common/configtx/tool/configtx.yaml
Orderer: &OrdererDefaults
# Orderer Type: The orderer implementation to start.
# Available types are "solo" and "kafka".
OrdererType: solo
Addresses:
# - 127.0.0.1:7050
- <IP Address of InstanceA>:7050
By doing this, Peer1 on instanceB start connecting orderer on instanceA.
It looks like "CORE_PEER_COMMITTER_LEDGER_ORDERER environmental parameter" and "-o option" were not used anymore or overwritten by configtx.yaml.
My demo project is running OK already, but it is only one peer in network. I want to add more peers into network.
I followed this guide ==> https://github.com/hyperledger-archives/fabric/blob/540c4db5f64dba4bd1b18e896c96a8d17d7ec552/docs/dev-setup/devnet-setup.md.
Please kindly help to check the log below,
the directory was wrong? or what is the right way to run this start up of peer?
vagrant#hyperledger-devenv:v-:/opt/gopath/src/github.com/hyperledger/fabric$ docker run --rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:2375 -e CORE_PEER_ID=vp0 -e CORE_PEER_ADDRESSAUTODETECT=true hyperledger-peer peer node start
Unable to find image 'hyperledger-peer:latest' locally
Pulling repository docker.io/library/hyperledger-peer
docker: Error: image library/hyperledger-peer not found.
See 'docker run --help'.
Is it possible that first node in network was started not in Docker container? (For example it could be started as a process using peer node start)
We can verify which docker images are available in vagrant machine. Just run docker images command:
vagrant#hyperledger-devenv:v0.0.9-b4acc4b:$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hyperledger/fabric-baseimage latest c1d6f4800a55 27 hours ago 1.297 GB
hyperledger/fabric-baseimage x86_64-0.0.9 70328eed56aa 2 weeks ago 990.1 MB
busybox latest 47bcc53f74dc 9 weeks ago 1.113 MB
With such configuration, when “hyperledger-peer” image is not available, the Validation Peer will not be started because of “Unable to find image” error:
vagrant#hyperledger-devenv:v0.0.9-b4acc4b:/opt/gopath/src/github.com/hyperledger/fabric/peer$ docker run --rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:2375 -e CORE_PEER_ID=vp0 -e CORE_PEER_ADDRESSAUTODETECT=true hyperledger-peer peer node start
Unable to find image 'hyperledger-peer:latest' locally
Pulling repository docker.io/library/hyperledger-peer
docker: Error: image library/hyperledger-peer not found.
"hyperledger-peer:latest" image can be created using:
cd $GOPATH/src/github.com/hyperledger/fabric/core/container
go test -run BuildImage_Peer
Now docker images should show one more available image:
REPOSITORY TAG IMAGE ID CREATED SIZE
hyperledger-peer latest 438b65f18f21 8 seconds ago 1.418 GB
at this point Validation Peer should be started successfully:
vagrant#hyperledger-devenv:v0.0.9-b4acc4b:~$ docker run —rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:2375 -e CORE_PEER_ID=vp0 -e CORE_PEER_ADDRESSAUTODETECT=true hyperledger-peer peer node start
21:55:51.969 [crypto] main -> INFO 001 Log level recognized 'info', set to INFO
21:55:51.970 [peer] func1 -> INFO 002 Auto detected peer address: 172.17.0.2:30303
21:55:51.971 [peer] func1 -> INFO 003 Auto detected peer address: 172.17.0.2:30303
21:55:51.972 [peer] func1 -> INFO 004 Auto detected peer address: 172.17.0.2:30303
21:55:51.974 [main] serve -> INFO 005 Security enabled status: false
21:55:51.974 [main] serve -> INFO 006 Privacy enabled status: false
…