spydra-tech / fabric-debugger

Extension for Visual Studio Code that makes it easy for developers to build and debug Chaincode right from within the IDE.
Apache License 2.0
14 stars 3 forks source link

[FEATURE]: Update readme on how to use debug fabric network from an application #5

Closed ballad89 closed 8 months ago

ballad89 commented 1 year ago

Describe the problem that you are trying to solve.

When I try to use the fabric network setup by the debugger from an application, I get the error

no combination of peers can be derived which satisfy the endorsement policy: required chaincodes are not installed on sufficient peers

The values I used were CA: https://localhost:5054 Peer: localhost:5051

Describe the solution you'd like I was hoping you could update the readme with instructions on how to use the debug fabric network from an application which submits transactions.

Additional context When I run os.Hostname() from within the chaincode, it prints the hostname of my macbook, not the hostname of the peer docker container I did this because shim.GetMSPID() which checks for the env var CORE_PEER_LOCALMSPID was returning nil, instead of Org1MSP which is clearly set on the peer container. This makes it feel like the debug chaincode is installed on my local and not the peer container, which would explain the error above. Hence why I suspect that I am not using the setup correct. Tests from test.fabric files do not have the same error

ashwath-spdr commented 1 year ago

Hi @ballad89, thanks for trying out the extension. The conclusions that you drew are correct. The Chaincode is actually running on your host machine (launched by VS Code). The peer (running as a container) simply connects to the Chaincode running on the host to execute the transactions. I'll definitely put this in the backlog to document how to connect to the local fabric environment from your own application, but meanwhile, some additional context on what you are doing will help:

ashwath-spdr commented 8 months ago

Closing this issue as the steps for connecting from different application has been documented here.