Giter VIP home page Giter VIP logo

Comments (6)

rcaballeron avatar rcaballeron commented on July 3, 2024 1

many thanks for the clear explanation. I spent some time perusing the chapter 9 and got a much better understanding.

from trade-network.

VRamakrishna avatar VRamakrishna commented on July 3, 2024

Did you create the channels and join the peers to the channels? The startAndJoinChannels.sh does that, as is specified in the instructions.

from trade-network.

rcaballeron avatar rcaballeron commented on July 3, 2024

No, I didn't. I was following the instructions on the book and somehow I realized that it wasn't described how to show the channels on vscode. I'll try that script and let you know.

from trade-network.

VRamakrishna avatar VRamakrishna commented on July 3, 2024

The book talks about channel creation in Chapter 9, and you'll find the instruction I linked to there. I assume you are still in Chapter 4? The purpose of that chapter was just to get a network of nodes (peers, orderers, and CAs) up and running. Then you move on to developing chaincode locally in Chapter 5, understand at depth what business networks are comprised of in the next 3 chapters through samples, before resuming the trade network operation in Chapter 9. You can jump from 4 to 9 if you wish; i.e., if you understand chaincode development and business network artifacts (wallets, gateways) already.

from trade-network.

rcaballeron avatar rcaballeron commented on July 3, 2024

Many thanks for your feedback. Indeed I stopped on Chapter 8.

I was able now to see the channels on vscode
image

I've also gained more understanding about the provided scripts startAndJoinChannels.sh and trade.sh. Regarding the former, when the step ./trade.sh joinchannel -c tradechannel -o 3 is executed, the following function in the trade.sh is invoked:

function joinPeersToChannel () {
  checkPrereqs

  # Create folder for docker network logs
  LOG_DIR=$(dirname $LOG_FILE_CLI)
  if [ ! -d $LOG_DIR ]
  then
    mkdir -p $LOG_DIR
  fi

  # Check if the cli container is already running
  checkAndStartCliContainer

  # Join peers to the channel
  docker exec -e CHANNEL_NAME=$CHANNEL_NAME -e NUM_ORGS_IN_CHANNEL=$NUM_ORGS_IN_CHANNEL $CONTAINER_CLI scripts/channel.sh join >>$LOG_FILE_CLI 2>&1
  if [ $? -ne 0 ]; then
    echo "ERROR !!!! Unable to join channel"
    echo "ERROR !!!! See "$LOG_FILE_CLI" for details"
    exit 1
  fi
  echo "Joined peers to channel "$CHANNEL_NAME
}

It caught my attention the checkAndStartCliContainer line. If I was able to follow the execution chain properly, it's the cli-container the responsible for generating/configuring the peers channel connections. These configurations are stored on the local volumes mounted by this container which are the same that the peers mount as well. In such a way, using shared volumes, the channel configuration is made available for the rest of the network, am I right?

Many thanks

from trade-network.

VRamakrishna avatar VRamakrishna commented on July 3, 2024

What's mounted in the CLI container using volumes are the crypto artifacts (the certificates and keys of the peers, orderers, and CAs) in the crypto-config folder and the channel artifacts (genesis block, initial channel transaction, and anchor peer configurations) in the channel-artifacts folder. Also are copied the scripts that are run within the CLI container and code corresponding to the four contracts to be deployed in this network. Here are the lines that indicate this: https://github.com/HyperledgerHandsOn/trade-network/blob/master/bash/docker-compose-cli.yaml#L37...L40.

All the scripts in the CLI are doing, as triggered by higher-level scripts like trade.sh and startAndJoinChannels.sh and sampleChaincodeOperations.sh, are sending commands to peers and orderers (mainly using the peer command with different options) to perform basic operations like creating channels, joining peers to channels, installing chaincode on peers, etc. So it's these commands (which are core Fabric tools) that are doing the heavy work of initializing ledger states, starting containers that will run contract code, create blocks, disseminate blocks, etc. It's not the sharing of configuration through volumes; that's simply to provide the payloads for these commands as triggered by scripts in the CLI container.

Hope this is clear? (The explanation in the book was quite detailed as I recall, walking you through each file, each command, and the effects of each command.) If so, and if you see no error you wish to report, please close this issue.

from trade-network.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.