DZhangLab / HIDe-infrastructure

2 stars 0 forks source link

Research: multiple fabric org 1 peer each vs 1 fabric org many peers #24

Open zhangpn opened 1 year ago

Wyntuition commented 1 year ago

It is possible to set up an architecture in Hyperledger Fabric where multiple companies share one organization (org), but each have their own keys so they can still have separate peers.

This can be achieved by creating a single organization in Fabric that represents all the companies, and then creating multiple MSPs within that organization. Each MSP can have its own set of cryptographic material, including private keys, so that each company can have its own set of peers.

Here's a high-level overview of the process:

Modify the crypto-config.yaml file to include the desired organizations and MSPs:

Organizations:
  - &MyOrg
    Name: MyOrg
    ID: MyOrgMSP
    MSPDir: crypto-config/peerOrganizations/myorg.example.com/msp
    Policies:
      Readers:
        Type: Signature
        Rule: "OR('MyOrgMSP.admin', 'MyOrgMSP.peer', 'MyOrgMSP.client')"
      Writers:
        Type: Signature
        Rule: "OR('MyOrgMSP.admin', 'MyOrgMSP.client')"
      Admins:
        Type: Signature
        Rule: "OR('MyOrgMSP.admin')"
    AnchorPeers:
      - Host: peer0.myorg.example.com
        Port: 7051
  - &Company1
    Name: Company1
    ID: Company1MSP
    MSPDir: crypto-config/peerOrganizations/company1.example.com/msp
    Policies:
      Readers:
        Type: Signature
        Rule: "OR('Company1MSP.admin', 'Company1MSP.peer', 'Company1MSP.client')"
      Writers:
        Type: Signature
        Rule: "OR('Company1MSP.admin', 'Company1MSP.client')"
      Admins:
        Type: Signature
        Rule: "OR('Company1MSP.admin')"
    AnchorPeers:
      - Host: peer0.company1.example.com
        Port: 7051
  - &Company2
    Name: Company2
    ID: Company2MSP
    MSPDir: crypto-config/peerOrganizations/company2.example.com/msp
    Policies:
      Readers:
        Type: Signature
        Rule: "OR('Company2MSP.admin', 'Company2MSP.peer', 'Company2MSP.client')"
      Writers:
        Type: Signature
        Rule: "OR('Company2MSP.admin', 'Company2MSP.client')"
      Admins:
        Type: Signature
        Rule: "OR('Company2MSP.admin')"
    AnchorPeers:
      - Host: peer0.company2.example.com
        Port: 7051

Generate the cryptographic material for the organizations and MSPs using the cryptogen tool:

cryptogen generate --config=crypto-config.yaml

Create the channel and join the peers for each company:

peer channel create -o orderer.example.com:7050 -c mychannel -f channel-artifacts/mychannel.tx
peer channel join -b mychannel.block

Start the peers for each company:

CORE_PEER_LOCALMSPID=Company1MSP
CORE_PEER_ADDRESS=peer0.company1.example.com:7051
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/company1.example.com/users/Admin@company1.example.com/msp
peer node start

CORE_PEER_LOCALMSPID=Company2MSP
CORE_PEER_ADDRESS=peer0.company2.example.com:7051
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyper

Here are some of the potential tradeoffs:

Complexity: The setup and management of multiple MSPs within a single organization can be more complex than setting up multiple organizations. It requires additional configuration and coordination between the different companies sharing the organization, which can make it harder to maintain and upgrade.

Security: Sharing an organization means that all the companies within that organization share the same level of access to resources and data. This can be a security concern if one of the companies within the organization is compromised, as it could potentially affect the security of all the other companies sharing the organization.

Governance: Shared organizations can be more difficult to govern as it requires coordination and agreement among multiple companies. This can be particularly challenging when it comes to decision-making and dispute resolution.

Scalability: As more companies join the shared organization, the complexity and governance challenges can increase. Additionally, the performance of the shared network may be impacted as more peers and transactions are added to the network.

Legal and regulatory compliance: Depending on the legal and regulatory requirements, there may be limitations or restrictions on how companies can share infrastructure and resources. It is important to ensure that the shared architecture meets all necessary legal and regulatory requirements.

Overall, while a shared organization architecture can offer some benefits such as cost savings and easier collaboration, it is important to carefully consider the tradeoffs and ensure that the architecture is designed to meet the needs of the participating companies.

SOURCES:

Hyperledger Fabric documentation on Multiple Organizations: https://hyperledger-fabric.readthedocs.io/en/release-2.2/identity/identity.html#multiple-organizations

Hyperledger Fabric documentation on Multiple MSPs in a single organization: https://hyperledger-fabric.readthedocs.io/en/release-2.2/msp/multi-msp.html

A blog post on the Pros and Cons of Shared Ledger Blockchain Networks: https://www.burr.com/2020/06/01/pros-and-cons-of-shared-ledger-blockchain-networks/

A blog post on Multi-tenant Architecture in Hyperledger Fabric: https://medium.com/@yathirajud/multi-tenant-architecture-in-hyperledger-fabric-c7bea2002d2c

An article on Hyperledger Fabric Security Best Practices: https://www.hyperledger.org/blog/2020/06/08/hyperledger-fabric-security-best-practices