Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hyperledger Fabric CLI docker container

I have couple a questions regarding HF CLI docker container and some of CLI commands.

First of all, can someone explain the purpose of this container in context of docker container which is started alongside other docker containers required for HF ecosystem. How can I for example query my business network organisations, different peers, and chain-code status on those peers?

Second of all, when I install a chain code issuing peer chaincode install CLI command, to which peer is that code installed (if i have 5 peers attached to org1.example.com organisation, on which peer aforementioned command will install the targeted chain code)?

And third of all, if I have just one organization in my business network specification which handles multiple peers and channels, when I try to instantiate the installed code issuing peer chaincode instantiate command, how to specify the endorsement policy (http://hyperledger-fabric.readthedocs.io/en/latest/endorsement-policies.html) which has just one organisation in endorsement expression after the -P parameter?

Thank you for your help!

EDIT 1: Just one update regarding 3rd answer. In you have one organisation maintaining peers and channels when instantiating chaincode, you can omit the endorsing policy parameter (-p). In that case transaction will be endorsed if any peer endorses it

like image 452
branko terzic Avatar asked Oct 13 '17 14:10

branko terzic


People also ask

What is the CLI container in Hyperledger?

The role of the CLI container is to make all the operations regarding the channel and network. The cli container contains the tools necessary for it, like the fabric ca client, the configtxgen and JQ. Yes its possible to run the network without it.

What is Docker in Hyperledger fabric?

Simpler setup for Hyperledger Fabric on Kubernetes using Docker-in-Docker. Hyperledger Fabric is a distributed blockchain network that allows users to define the behavior of their ledgers using conventional general-purpose programming languages. This user-defined blockchain code is called chaincode.


1 Answers

Lots of great questions.

  1. the "cli" container's purpose is to run a peer process as a CLI . It is a bit confusing that the same process is both a client and a server, we may change that. Basically, when you run the peer chaincode commands, you are running the CLI. The peer node commands are the server commands. The cli container in our samples runs a script (scripts/script.sh) which in turn executes a series of CLI commands against the peer nodes.

  2. If you examine scripts/script.sh, you will find a setGlobals function that sets a few environment variables, including CORE_PEER_ADDRESS. This is the peer (server) to which the peer (CLI) will communicate when installing the chaincode.

  3. Actually, after further research, this is not possible, unfortunately. The gate syntax isn't yet implemented. You would need to simulate multiple orgs for this.

like image 97
christo4ferris Avatar answered Oct 23 '22 11:10

christo4ferris