You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

排查Hyperledger Fabric部署脚本中“Using organization 1”日志的输出来源

Why does "Using organization 1/2" appear in the Fabric test network logs?

Hey there! Let's break down where that "Using organization X" message comes from when you run ./network.sh deployCC in the Hyperledger Fabric test network.

The Root Cause: The setGlobals Function in network.sh

The message is printed by a custom bash function called setGlobals inside the test-network/network.sh script. This function's job is to switch the terminal context to target a specific organization's peer node (like Org1 or Org2) by setting critical environment variables (such as CORE_PEER_ADDRESS, CORE_PEER_LOCALMSPID, and TLS/MSP paths).

Here's a simplified snippet of what that function looks like:

function setGlobals() {
    local org=$1
    if [ $org -eq 1 ]; then
        # Set Org1-specific environment variables
        CORE_PEER_LOCALMSPID="Org1MSP"
        CORE_PEER_ADDRESS=localhost:7051
        CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
        CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
        echo "Using organization 1"  # This line outputs the message you see
    elif [ $org -eq 2 ]; then
        # Set Org2-specific environment variables
        CORE_PEER_LOCALMSPID="Org2MSP"
        CORE_PEER_ADDRESS=localhost:9051
        CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
        CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
        echo "Using organization 2"  # This line outputs the Org2 message
    fi
}

When Does This Get Triggered?

In the deployCC workflow:

  1. Before installing the chaincode on peer0.org1, the script calls setGlobals 1 to configure the terminal to talk to Org1's peer. This triggers the echo "Using organization 1" line.
  2. Next, when installing on peer0.org2, the script calls setGlobals 2, which triggers the echo "Using organization 2" line.

This message is just a helpful indicator to let you know the script has switched its context to target a different organization's peer node for the upcoming chaincode operation.

内容的提问来源于stack exchange,提问作者hyper1003

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 16:57:56