Skip to content

Endorsement Policy Issue While Committing Chaincode (AWS Managed Hyperledger Fabric)

1

I am trying to setup hyperledger fabric network for which as of now in development i am using 1 org and 1 peer. When i try to commit the chaincode i get Error: transaction invalidated with status (ENDORSEMENT_POLICY_FAILURE). As for the configuration part of configtx.yaml in the Application i have tried both ANY Endorsement and MAJORITY Endorsement (Same for lifecycle).

This is the configtx for reference

Organizations:
  - &Org1
    Name: m-1
    ID: m-1
    MSPDir: /opt/home/msp/admin
    Policies:
      Readers:
        Type: Signature
        Rule: "OR('m1.admin', 'm-1.peer', 'm-1.client')"
      Writers:
        Type: Signature
        Rule: "OR('m-1.admin', 'm-1.client')"
      Admins:
        Type: Signature
        Rule: "OR('m-1.admin')"
      Endorsement:
        Type: Signature
        Rule: "OR('m-1.peer')"
    AnchorPeers:
      - Host: nd-awmey56tbvefxo4o7rx2ja2iw4.m-1.n-a.managedblockchain.us-east-1.amazonaws.com
        Port: 30003

Capabilities:
  Channel: &ChannelCapabilities
    V2_0: true
  Orderer: &OrdererCapabilities
    V2_0: true
  Application: &ApplicationCapabilities
    V2_0: true

Channel: &ChannelDefaults
  Policies:
    Readers:
      Type: ImplicitMeta
      Rule: "ANY Readers"
    Writers:
      Type: ImplicitMeta
      Rule: "ANY Writers"
    Admins:
      Type: ImplicitMeta
      Rule: "MAJORITY Admins" # Change back to MAJORITY when having multiple orgs
    LifecycleEndorsement:
      Type: ImplicitMeta
      Rule: "MAJORITY Endorsement" # Change back to MAJORITY when having multiple orgs
    Endorsement:
      Type: ImplicitMeta
      Rule: "MAJORITY Endorsement" # Change back to MAJORITY when having multiple orgs
  Capabilities:
    <<: *ChannelCapabilities

Application: &ApplicationDefaults
  Organizations:
  Policies:
    Readers:
      Type: ImplicitMeta
      Rule: "ANY Readers"
    Writers:
      Type: ImplicitMeta
      Rule: "ANY Writers"
    Admins:
      Type: ImplicitMeta
      Rule: "MAJORITY Admins" # Change back to MAJORITY when having multiple orgs
    LifecycleEndorsement:
      Type: ImplicitMeta
      Rule: "MAJORITY Endorsement" # Change back to MAJORITY when having multiple orgs
    Endorsement:
      Type: ImplicitMeta
      Rule: "MAJORITY Endorsement" # Change back to MAJORITY when having multiple orgs
  Capabilities:
    <<: *ApplicationCapabilities

Profiles:
  FabricProfile:
    Consortium: AWSSystemConsortium
    <<: *ChannelDefaults
    Application:
      <<: *ApplicationDefaults
      Organizations:
        - *Org1
      Capabilities: *ApplicationCapabilities

I am able to install the chaincode, approve it without passing any explicit policy. But when committing i get the Endorsement Issue. Even though if i check the approval it seems to be true for my org (cause its the only one in the channel). Also NOTE (I am using the same identity MSP certs that created the channel to submit the chaincode which is the root admin that i enrolled using the fabric-ca-client node js sdk)

Is there something i need to know like if i am getting how things work wrong?

asked a year ago177 views

1 Answer
0

When working with Amazon Managed Blockchain (AMB) Hyperledger Fabric with a single organization and peer, you're encountering an endorsement policy failure during chaincode commitment despite successful installation and approval.

The issue likely stems from your endorsement policy configuration. In your configtx.yaml, you've set both the LifecycleEndorsement and Endorsement policies to "MAJORITY Endorsement" which works well in multi-organization networks but can cause issues in a single-org setup.

For a single organization network, try changing these policies to "ANY Endorsement" instead of "MAJORITY Endorsement" in both the Channel and Application sections. This change allows any valid endorser to satisfy the policy rather than requiring a majority, which makes more sense for your current single-org setup.

Additionally, when committing chaincode, you might need to explicitly specify the endorsement policy that matches your network configuration. Since you're using a single organization, you could try committing with an explicit endorsement policy parameter that specifies your organization as the only endorser.

Another thing to check is that your peer node has the proper permissions and that the identity you're using for these operations has the required authorization to perform chaincode operations. The error could also indicate issues with the certificates or identity configuration.

Remember that peer nodes in Amazon Managed Blockchain have specific security requirements, including no direct internet access, which means all dependencies must be properly bundled with your chaincode when deploying.
Sources
Troubleshooting Amazon Managed Blockchain (AMB) Hyperledger Fabric identity and access - Amazon Managed Blockchain (AMB)
How to bundle and commit Node.js chaincode on Amazon Managed Blockchain Hyperledger Fabric | AWS re:Post

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.