Hyperledger Composer 0.19:如何用composer network install重新部署BNA增量变更
composer network update) Got it, since composer network update was removed in Hyperledger Composer 0.19, you'll use a combination of composer network install and composer network upgrade to push incremental changes from your updated BNA file to the running network. Here's the detailed workflow:
Step 1: Prepare the Updated BNA
First, make sure your modified BNA file has an incremented version number (this is mandatory—Composer uses versioning to distinguish updates). For example, if your original BNA was my-network@1.0.0.bna, update the version in your package.json to 1.0.1 (or 1.1.0, depending on your change scope) and repackage the BNA.
Step 2: Install the Updated BNA on Peer Nodes
Use the composer network install command to push the new BNA to the peer nodes in your network. This makes the updated network definition available to the peers:
composer network install --card <your-admin-card> --archiveFile <path-to-updated-bna>
- Replace
<your-admin-card>with your network admin card name (e.g.,admin@my-network). - Replace
<path-to-updated-bna>with the file path of your new BNA (e.g.,./dist/my-network@1.0.1.bna).
Step 3: Upgrade the Running Network
Once the new BNA is installed, use composer network upgrade to switch the running network to the new version. This activates the updated business logic and model:
composer network upgrade --card <your-admin-card> --networkName <network-name> --networkVersion <new-version>
<network-name>is the name of your business network (matches thenamefield in yourpackage.json).<new-version>is the incremented version number of your updated BNA (e.g.,1.0.1).
Step 4: Verify the Update
Confirm the network is running the new version by pinging it:
composer network ping --card <your-admin-card>
Check the output for the Network Version field—it should match the version of your updated BNA.
Key Notes
- Versioning is non-negotiable: You can't install a BNA with the same version as an existing one; always increment the version for changes.
- Admin permissions: Ensure your admin card has the necessary network admin privileges to perform install and upgrade operations.
- Data compatibility: If your update includes changes to asset/participant structures or transaction logic, test for data compatibility first to avoid breaking existing network data.
内容的提问来源于stack exchange,提问作者Uma Santharam

