Hyperledger Composer部署位置、通道及背书策略等技术问题咨询
Hey there! Let's break down your questions step by step since you've successfully deployed your BNA but need clarity on those key details.
First: Confirming BNA ↔ Chaincode Relationship
You’re absolutely right! In Hyperledger Composer v0.19.0 and later, a Business Network Archive (BNA) is indeed packaged into a Fabric chaincode when deployed. This was a major shift to align Composer more closely with the underlying Fabric architecture, so your understanding is spot-on.
Finding Deployment Location & Associated Channel
1. Using Composer Commands (Easiest Way)
Run this command to get full details about your deployed network:
composer network list -n <your-bna-name> -c <your-connection-profile-name>
This will output:
- The channel name your BNA is deployed to (if you didn’t specify a channel during deployment, the default is
composerchannel) - The chaincode name (derived from your BNA name and version)
- Peer nodes hosting the chaincode
2. Checking Fabric Peer Node Directly
If you want to see the physical deployment location (inside the peer container):
- First, exec into your peer container:
docker exec -it <peer-container-name> bash - Navigate to the chaincode storage directory:
cd /var/hyperledger/production/chaincodes/
You’ll see a .tar.gz file named like <your-bna-name>-<version>.tar.gz — that’s your packaged BNA/chaincode.
Setting Up Endorsement Policies
Endorsement policies define which peers must sign a transaction before it’s committed to the ledger. You can set this either during deployment or update an existing deployment:
1. Set Policy During Deployment
Use the -E flag with composer network deploy to specify your policy. For example, to require endorsement from either Org1 or Org2 members:
composer network deploy -a your-network.bna -c PeerAdmin@hlfv1 -E "OR('Org1MSP.member','Org2MSP.member')"
The policy syntax follows standard Fabric chaincode endorsement rules — you can use AND, OR, and nested conditions to match your network’s needs.
2. Update Policy for an Existing Deployment
If you need to change the endorsement policy after deployment:
- First, create or update your connection profile (
.json) to include the new policy under thechaincodeEndorsementPolicyfield for your channel/chaincode. - Then run the update command:
Note: You’ll need to use the same BNA package or a newer version if you’re making other changes alongside the policy update.composer network update -a your-network.bna -c PeerAdmin@hlfv1 -E "NEW_POLICY_HERE"
Pro Tip
Always test your endorsement policies in a development environment first to ensure they align with your network’s governance rules — misconfigurations can lead to transaction failures.
内容的提问来源于stack exchange,提问作者sun

