Lab 4 error during chaincode instantiation
Under Lab 4 on page 27 of the booklet with all the labs when I enter in this command:
peer chaincode instantiate -n ccForAll -v 1.0 -o \
orderer.example.com:7050 -C allarewelcome \
-c '{"Args":["Mach","50"]}'
I get this error:
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: API error (404): network _basic not found
I believe it is because The COMPOSE_PROJECT_NAME variable is not set and it defaults in a blank string giving us a empty space " " appended to "_basic"
When using the command:
docker network ls
I see a network named "startfiles_basic" but when I try to change the COMPOSE_PROJECT_NAME to startfiles or if I just try to change the entire** CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE** variable in the **docker-compose.yml **file to "startfiles_basic" it is still giving me the same error.
Has anyone else come across this error and if so how were you able to solve it?
Thanks.
Comments
-
Hi!
I could do for peer 0, but not for peer 1. I also looked into this problem you mentioned. I realized the environment variable was empty and is not addressed in the docker-compose.yaml. Also, we can see that the docker-compose.yaml file defines a network called just "basic". So I made everybody inside a basic network. Probably that helped with peer 0.
But now I have been facing this problem when installing the chaincode on peer 1:
Error: error getting endorser client for install: endorser client failed to connect to peer1.org1.example.com:8051: failed to create new connection: context deadline exceeded
Looks like a network problem, but also could be a problem with permission. If it is a problem with permission, we need to look into the relation between identities, roles and permissions on the genesis block. That's my guess.
Let me know if you progressed on this.
Thanks!
0 -
@PallabPaul I too had the same problem. but exporting that COMPOSE_PROJECT_NAME solved the same. For your case, did you check
docker logs peer0.org1.example.com
? Did you ensure that, chain code is installed on peer0?1 -
@hanesoliveira One thing tha caught my eyes is the port
8051
, shouldn't you be using always7051
inside the container?0 -
Hi @maniankara!
I configured the container to have port 8051 externally and 7051 internally. However, you pointed out something that reminded me that since we are shooting commands from the cli container, then we are already inside the Docker internal network meaning that I should use the internal port.
I'll try it again today and let you know. Thanks for the clarification!
0 -
If you are still encountering an error, could you please post the full content of the Docker logs for the orderer node please so I can read it and provide an answer?
0 -
Hi @kmyatt, thanks for reaching out!
I could fix it and install the codes, but I am getting an error when instantiating. I am working on that now:
2019-05-29 21:29:59.984 UTC [orderer.common.broadcast] Handle -> WARN 007 Error reading from 172.18.0.6:35118: rpc error: code = Canceled desc = context canceled
2019-05-29 21:29:59.984 UTC [comm.grpc.server] 1 -> INFO 008 streaming call completed {"grpc.start_time": "2019-05-29T21:29:59.983Z", "grpc.service": "orderer.AtomicBroadcast", "grpc.method": "Broadcast", "grpc.peer_address": "172.18.0.6:35118", "error": "rpc error: code = Canceled desc = context canceled", "grpc.code": "Canceled", "grpc.call_duration": "323.004µs"}
2019-05-29 21:30:44.584 UTC [comm.grpc.server] 1 -> INFO 009 streaming call completed {"grpc.start_time": "2019-05-29T21:30:44.582Z", "grpc.service": "orderer.AtomicBroadcast", "grpc.method": "Broadcast", "grpc.peer_address": "172.18.0.6:35124", "grpc.code": "OK", "grpc.call_duration": "1.984117ms"}0 -
Hi @Hanesoliveira, always happy to help!
I just look at the lab guide, and noticed the following line:
"Try it Yourself: Let’s do it once more on peer1. Set the environment variables for peer1.Org1 to the appropriate values."
^ It looks like a misprint, and we will be removing it tomorrow morning.
If this is where you or anyone else are getting your error, please move on. You have done nothing wrong. Just be sure that you've instantiated the chaincode successfully once on the same channe, andl then you're fine to move on.
As mentioned in the Lectures, Chaincode Instantiation is at channel level, which in simplest terms means it only needs to be instantiated once.
Hope this helps!
0 -
Hi,
I got the following error while trying to instantiate the contract with or without endorsing policy.
Any idea as to why both commands are faling?1st Command:
peer chaincode instantiate -n ccForAll -v 1.0 \ -o orderer.example.com:7050 -C allarewelcome \ -c '{"Args":["Mach","50"]}' \ --policy "AND('Org1.peer', OR ('Org1.member))"Result:
Error: error getting channel (allarewelcome) orderer endpoint: error bad proposal response 500: access denied for [GetConfigBlock][allarewelcome]: Failed to get policy manager for channel [allarewelcome]2nd Command:
peer chaincode instantiate -n ccForAll -v 1.0 -o orderer.example.com:7050 -C allarewelcome -c '{"Args":["Mach","50"]}'Result:
Error: error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [allarewelcome] creator org [Org1MSP]Any idea on how to resolve this?
0 -
Hi @PaulAmehUgw1!
Remove the "\" from your command, this is used for continuing the command in another line.
0 -
Hi @PaulAmehUgw1!
How are you setting your environment variables? Can you post here?
0 -
Environment variables when installing chaincode for Peer0.0rg1:
docker exec -it cli bash
export CORE_PEER_LOCALMSPID=Org1MSP
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/ peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.exampl e.com/mspI followed this instruction “Using the above walkthrough, try and install chaincode on peer1.org”
For Peer1.0rg1:” To install on peer1.Org1 with the following command.docker exec -it cli bash
export CORE_PEER_LOCALMSPID=Org1MSP
export CORE_PEER_ADDRESS=peer1.org1.example.com:7051
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/ peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.exampl e.com/msp0 -
@PaulAmehUgw1 It looks like your pathing for CORE_PEER_MSPCONFIGPATH is broken toward the end. Please double check it for breaks. The value should be one solid command.
Please fix that and then rerun the command
1 -
For all wondering, the above issue is most likely due to the translation from PDF to Command Line. Please be conscious of the default page breaks and other formatting that gets added in documents.
0 -
@kmyatt I successfully installed the chaincode and after that the instantiation is not going through. Both commands returns error message.
1)
peer chaincode instantiate -n ccForAll -v 1.0 -o orderer.example.com:7050 -C allarewelcome -c '{"Args":["Mach","50"]}'Output:
2019-06-18 13:51:19.934 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-06-18 13:51:19.934 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [allarewelcome] creator org [Org1MSP]2)
peer chaincode instantiate -n ccForAll -v 1.0 -o orderer.example.com:7050 -C allarewelcome -c '{"Args":["Mach","50"]}' --policy "AND('Org1.peer', OR ('Org1.member'))"Output:
Error: error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [allarewelcome] creator org [Org1MSP]Blockchain logs returns:
orderer.example.com | 2019-06-18 13:54:13.163 UTC [comm.grpc.server] 1 -> INFO 015 streaming call completed {"grpc.start_time": "2019-06-18T13:54:13.163Z", "grpc.service": "orderer.AtomicBroadcast", "grpc.method": "Broadcast", "grpc.peer_address": "172.18.0.4:41454", "grpc.code": "OK", "grpc.call_duration": "242.251µs"}
3)
peer chaincode list --instantiated -C allarewelcomeOutput:
peer0.org1.example.com | 2019-06-18 14:00:13.899 UTC [comm.grpc.server] 1 -> INFO 032 unary call completed {"grpc.start_time": "2019-06-18T14:00:13.899Z", "grpc.service": "protos.Endorser", "grpc.method": "ProcessProposal", "grpc.peer_address": "172.18.0.4:58666", "error": "access denied: channel [allarewelcome] creator org [Org1MSP]", "grpc.code": "Unknown", "grpc.call_duration": "296.481µs"}Based on the above output the instantiation failed. Any idea on how I can fix these error?
0 -
Hi @PaulAmehUgw1!
Can you see if you're still enrolled in the channel?
0 -
@hanesoliveira I checked:
peer channel fetch oldest allarewelcome.block -c allarewelcome --orderer orderer.example.com:7050
Response from both peers:
2019-06-18 16:08:36.387 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-06-18 16:08:36.388 UTC [cli.common] readBlock -> INFO 002 Received block: 00 -
@PaulAmehUgw1 what shows up when you execute the command "peer channel list"?
0 -
0
-
Ok @PaulAmehUgw1. That shows that you are not in the channel and you need to join the channel:
peer channel join -b allarewelcome.block
0 -
Thanks @hanesoliveira I was to join back the channels.The reason both peers keeps getting off the channel is due to restarting the containers. However, I get this error when instantiating the smart contract. It hangs then pops this.
2019-06-18 16:56:02.319 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-06-18 16:56:02.319 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: API error (404): network startFiles_basic not found1 -
Hi @PaulAmehUgw1, try to see if this network is available issuing:
docker network list
Sometimes I got problems after containers stopped or got restarted. Check also if your containers have the right config of networking on docker-composer.yaml.
1 -
@hanesoliveira Thanks!
I just edited the name "CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE = startFiles_basics" to startfiles_basic, it worked. Typo problem.
1 -
Great @PaulAmehUgw1!
0 -
*Revised comment for explanation to everyone
Hey everyone just to be clear., if you receive the error:
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: API error (404): network startFiles_basic not found
Head into your docker-compose file and replace the line:
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic
wtih this line.
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=startfiles_basic
Explanation: The old method used to work, but as of 1.4 the error occurs much more often. We will be removing this with the next update
Alternatively You do have the option to override the value inside of the container, which may work as well.
4 -
@kmyatt said:
*Revised comment for explanation to everyoneHey everyone just to be clear., if you receive the error:
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: API error (404): network startFiles_basic not found
Head into your docker-compose file and replace the line:
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic
wtih this line.
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=startfiles_basic
Explanation: The old method used to work, but as of 1.4 the error occurs much more often. We will be removing this with the next update
Alternatively You do have the option to override the value inside of the container, which may work as well.
Hi @kmyatt ,
I did change the docker-compose file, but the container still reports same error (startFiles_basic not found). Do one have to restart the whole network when changing the docker-compose file? If so, do you always have to type inn all commands manually again? Like for instance creating the genesis block and joining channels and installing chaincode?0 -
Its not "startFiles_basic ", change the caps F to small f "startfiles_basic ".
2 -
@indirajith said:
Its not "startFiles_basic ", change the caps F to small f "startfiles_basic ".Hi @indirajith yes I changed it to startfiles_basic, but the error message "startFiles_basic not found" still show up, thats why I wondered if I need to restart the network after editing the docker-compose file?
0 -
`docker network prune -f' this deletes all the docker networks. Try this. And make sure for both peers the network name is correct.
1 -
Yes, @Niklaskkkk you can also simply run the ./teardown.sh script from the startFiles folder directly. This will cover the container teardown as well as the network removal.
1 -
Hello all. I have finally made it this far and have the same error: Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: API error (404): network startFiles_basic not found
I have changed the startfiles but still get this error. the last two comments in this thread state: 'docker network prune-f" and run ./teardown.sh script. however, what do i do after i run either of these two commands and will it work to instantiated?
Thank you in advance for your response.
1
Categories
- All Categories
- 217 LFX Mentorship
- 217 LFX Mentorship: Linux Kernel
- 788 Linux Foundation IT Professional Programs
- 352 Cloud Engineer IT Professional Program
- 177 Advanced Cloud Engineer IT Professional Program
- 82 DevOps Engineer IT Professional Program
- 146 Cloud Native Developer IT Professional Program
- 137 Express Training Courses
- 137 Express Courses - Discussion Forum
- 6.1K Training Courses
- 46 LFC110 Class Forum - Discontinued
- 70 LFC131 Class Forum
- 42 LFD102 Class Forum
- 226 LFD103 Class Forum
- 18 LFD110 Class Forum
- 36 LFD121 Class Forum
- 18 LFD133 Class Forum
- 7 LFD134 Class Forum
- 18 LFD137 Class Forum
- 71 LFD201 Class Forum
- 4 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 2 LFD233 Class Forum
- 4 LFD237 Class Forum
- 24 LFD254 Class Forum
- 693 LFD259 Class Forum
- 111 LFD272 Class Forum
- 4 LFD272-JP クラス フォーラム
- 12 LFD273 Class Forum
- 144 LFS101 Class Forum
- 1 LFS111 Class Forum
- 3 LFS112 Class Forum
- 2 LFS116 Class Forum
- 4 LFS118 Class Forum
- 4 LFS142 Class Forum
- 5 LFS144 Class Forum
- 4 LFS145 Class Forum
- 2 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 2 LFS157 Class Forum
- 25 LFS158 Class Forum
- 7 LFS162 Class Forum
- 2 LFS166 Class Forum
- 4 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 3 LFS178 Class Forum
- 3 LFS180 Class Forum
- 2 LFS182 Class Forum
- 5 LFS183 Class Forum
- 31 LFS200 Class Forum
- 737 LFS201 Class Forum - Discontinued
- 3 LFS201-JP クラス フォーラム
- 18 LFS203 Class Forum
- 130 LFS207 Class Forum
- 2 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 302 LFS211 Class Forum
- 56 LFS216 Class Forum
- 52 LFS241 Class Forum
- 48 LFS242 Class Forum
- 38 LFS243 Class Forum
- 15 LFS244 Class Forum
- 2 LFS245 Class Forum
- LFS246 Class Forum
- 48 LFS250 Class Forum
- 2 LFS250-JP クラス フォーラム
- 1 LFS251 Class Forum
- 150 LFS253 Class Forum
- 1 LFS254 Class Forum
- 1 LFS255 Class Forum
- 7 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.2K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 118 LFS260 Class Forum
- 159 LFS261 Class Forum
- 42 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 24 LFS267 Class Forum
- 22 LFS268 Class Forum
- 30 LFS269 Class Forum
- LFS270 Class Forum
- 202 LFS272 Class Forum
- 2 LFS272-JP クラス フォーラム
- 1 LFS274 Class Forum
- 4 LFS281 Class Forum
- 9 LFW111 Class Forum
- 259 LFW211 Class Forum
- 181 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 795 Hardware
- 199 Drivers
- 68 I/O Devices
- 37 Monitors
- 102 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 85 Storage
- 758 Linux Distributions
- 82 Debian
- 67 Fedora
- 17 Linux Mint
- 13 Mageia
- 23 openSUSE
- 148 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 353 Ubuntu
- 468 Linux System Administration
- 39 Cloud Computing
- 71 Command Line/Scripting
- Github systems admin projects
- 93 Linux Security
- 78 Network Management
- 102 System Management
- 47 Web Management
- 63 Mobile Computing
- 18 Android
- 33 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 370 Off Topic
- 114 Introductions
- 173 Small Talk
- 22 Study Material
- 805 Programming and Development
- 303 Kernel Development
- 484 Software Development
- 1.8K Software
- 261 Applications
- 183 Command Line
- 3 Compiling/Installing
- 987 Games
- 317 Installation
- 96 All In Program
- 96 All In Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)