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

单个Peer节点能否运行两个不同的Chaincode?

Can a single Peer node run two different Chaincodes?

Absolutely! A single Hyperledger Fabric Peer node can absolutely run multiple distinct chaincodes—this is a fully supported and common scenario in Fabric deployments. Here’s a breakdown of how this works and key considerations:

Key Details & Considerations

  • Native Support in Fabric: Peer nodes are designed to host multiple chaincode instances, each running in its own isolated container (typically Docker). These containers are managed by the Peer’s chaincode lifecycle system, ensuring full isolation between different chaincodes—so issues in one won’t impact another.
  • Unique Identification Required: Each chaincode you deploy must have a unique combination of name and version to avoid conflicts during installation, approval, and commitment. For example, you can’t have two chaincodes both labeled my-chaincode_1.0 on the same Peer.
  • Deployment Workflow: The process for deploying multiple chaincodes is nearly identical to deploying one—you just repeat the full lifecycle steps (package → install → approve → commit) for each chaincode individually. Each chaincode will get its own container and runtime context on the Peer.
  • Resource Planning: While supported, running multiple chaincodes increases the Peer’s resource usage (CPU, memory, storage). For production environments with high transaction volumes, make sure your Peer has enough resources allocated, or consider scaling out to additional Peer nodes if needed.

Quick Example Workflow

Suppose you want to deploy two chaincodes (asset-transfer and supply-chain) to the same Peer:

  1. Package each chaincode separately:
    peer lifecycle chaincode package asset-transfer.tar.gz --path ./asset-transfer --lang golang --label asset-transfer_1.0
    peer lifecycle chaincode package supply-chain.tar.gz --path ./supply-chain --lang golang --label supply-chain_1.0
    
  2. Install both packages to the Peer:
    peer lifecycle chaincode install asset-transfer.tar.gz
    peer lifecycle chaincode install supply-chain.tar.gz
    
  3. Complete the approval and commit steps for each chaincode following your network’s policies. Once committed, both chaincodes will be active and runnable on the same Peer.

内容的提问来源于stack exchange,提问作者S.M

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 02:29:04