Chaincode gets instantiated but not able to invoke or list it #fabric #fabric-chaincode


Mrudav Shukla
 

I have a 3 Organisation (2 Normal Organization and 1 Orderer Organization) architecture on aws-eks. Each of the organizations has their own ca and tlsca. I have been able to generate the genesis block, the msp anchor transactions and the peers are able to join and create the channel as well as install the chaincode.

I am, however, facing issues when I instantiate the chaincode. The chaincode gets instantiated as seen from the docker-in-docker container. However, when I try to list the instantiated chaincode it does not come up.

I have gone through the following issues:
  1. https://stackoverflow.com/questions/56735065/chaincode-is-instantiated-but-doesnt-appear-in-the-list-of-instantiated-codes
  2. https://stackoverflow.com/questions/46045970/why-peer-chaincode-instantiate-execuate-many-times-successfully/46048140#46048140
  3. https://stackoverflow.com/questions/46035198/why-chaincode-instantiate-success-but-query-failed
These issues hint at errors in ordering service endpoints. I am using raft with 3 nodes and these nodes are able to connect with each other. Apart from this, when I submit peer chaincode fetch command from the peer or the cli container for fetching the block from the orderering service (node 1, 2 or 3), I am able to retrieve the blocks.

However, when I try to list the chaincode it shows nothing.

Following are the logs that I'm getting on peer:

2020-01-23 17:30:42.834 UTC [ConnProducer] NewConnection -> DEBU be6c Creating a new connection
2020-01-23 17:30:42.837 UTC [grpc] infof -> DEBU be6d transport: loopyWriter.run returning. connection error: desc = "transport is closing"
2020-01-23 17:30:42.837 UTC [grpc] DialContext -> DEBU be6e parsed scheme: ""
2020-01-23 17:30:42.838 UTC [grpc] DialContext -> DEBU be6f scheme "" not registered, fallback to default scheme
2020-01-23 17:30:42.838 UTC [grpc] watcher -> DEBU be70 ccResolverWrapper: sending new addresses to cc: [{raft2orderer.<domain>.in:7050 0  <nil>}]
2020-01-23 17:30:42.838 UTC [grpc] switchBalancer -> DEBU be71 ClientConn switching balancer to "pick_first"
2020-01-23 17:30:42.839 UTC [grpc] HandleSubConnStateChange -> DEBU be72 pickfirstBalancer: HandleSubConnStateChange: 0xc000368a60, CONNECTING
2020-01-23 17:30:42.850 UTC [grpc] HandleSubConnStateChange -> DEBU be73 pickfirstBalancer: HandleSubConnStateChange: 0xc000368a60, READY
2020-01-23 17:30:42.850 UTC [ConnProducer] NewConnection -> DEBU be74 Connected to {raft2orderer.<domain>.in:7050 [OrdererMSP]}
2020-01-23 17:30:42.850 UTC [deliveryClient] connect -> DEBU be75 Connected to raft2orderer.<domain>.in:7050
2020-01-23 17:30:42.850 UTC [deliveryClient] connect -> DEBU be76 Establishing gRPC stream with raft2orderer.<domain>.in:7050 ...
2020-01-23 17:30:42.851 UTC [deliveryClient] afterConnect -> DEBU be77 Entering
2020-01-23 17:30:42.851 UTC [deliveryClient] RequestBlocks -> INFO be78 Starting deliver with block [1] for channel <channel_name>
2020-01-23 17:30:42.851 UTC [msp] GetDefaultSigningIdentity -> DEBU be79 Obtaining default signing identity
2020-01-23 17:30:42.851 UTC [msp] GetDefaultSigningIdentity -> DEBU be7a Obtaining default signing identity
2020-01-23 17:30:42.851 UTC [msp.identity] Sign -> DEBU be7b Sign: plaintext: 0AC1090A3B08051A0608C2B0A7F10522...01120D1A0B08FFFFFFFFFFFFFFFFFF01 
2020-01-23 17:30:42.851 UTC [msp.identity] Sign -> DEBU be7c Sign: digest: D8737137258DF932B21B3D16CC73C7A34FC652912476A90C14AAC8E3094E24D2 
2020-01-23 17:30:42.852 UTC [deliveryClient] afterConnect -> DEBU be7d Exiting
2020-01-23 17:30:42.853 UTC [blocksProvider] DeliverBlocks -> ERRO be7e [channel_name] Got error &{FORBIDDEN}
2020-01-23 17:30:43.884 UTC [gossip.comm] func1 -> DEBU be7f Got message: GossipMessage: tag:EMPTY hello:<nonce:9881102125581302162 msg_type:IDENTITY_MSG > , Envelope: 17 bytes, Signature: 0 bytes
Following are the logs that I'm getting on orderer:

2020-01-23 15:20:26.159 UTC [comm.grpc.server] 1 -> INFO 640 streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Deliver grpc.peer_address=10.1.128.81:24518 grpc.peer_subject="CN=peer1OrgA.<domain>.in,OU=peer,O=Organization,L=Bengaluru,ST=Karnataka,C=IN" grpc.code=OK grpc.call_duration=997.532µs
2020-01-23 15:20:26.914 UTC [common.deliver] deliverBlocks -> WARN 641 [channel: <channel_name>] Client authorization revoked for deliver request from 10.1.128.81:50256: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Readers' sub-policies to be satisfied: permission denied
The following are the snippets from my configtx.yaml file:

Channel Policies:

Channel: &ChannelDefaults

    Policies:

        Readers:

            Type: ImplicitMeta

            Rule: "ANY Readers"

        Writers:

            Type: ImplicitMeta

            Rule: "ANY Writers"

        Admins:

            Type: ImplicitMeta

            Rule: "MAJORITY Admins"

    Capabilities:

        <<: *ChannelCapabilities

Application Policies:

Application: &ApplicationDefaults

    Organizations:

    Policies:

        Readers:

            Type: ImplicitMeta

            Rule: "ANY Readers"

        Writers:

            Type: ImplicitMeta

            Rule: "ANY Writers"

        Admins:

            Type: ImplicitMeta

            Rule: "MAJORITY Admins"

    Capabilities:

        <<: *ApplicationCapabilities

Organizations:

Organizations:

    - &Orderer

        Name: Orderer

        ID: OrdererMSP

        MSPDir: ordererOrganizations/msp

        Policies:

            Readers:

                Type: Signature

                Rule: "OR('OrdererMSP.member')"

            Writers:

                Type: Signature

                Rule: "OR('OrdererMSP.member')"

            Admins:

                Type: Signature

                Rule: "OR('OrdererMSP.admin')"

    - &Orga

        Name: Orga

        ID: OrgaMSP

        MSPDir: peerOrganizations/orga.<domain>.in/msp

        Policies:

            Readers:

                Type: Signature

                Rule: "OR(‘OrgaMSP.admin', ‘OrgaMSP.peer', ‘OrgaMSP.client')"

            Writers:

                Type: Signature

                Rule: "OR(‘OrgaMSP.admin', ‘OrgaMSP.client')"

            Admins:

                Type: Signature

                Rule: "OR(‘OrgaMSP.admin')"

        AnchorPeers:

            - Host: peer0orga.<domain>.in

              Port: 7051

Capabilities:

Capabilities:

    Channel: &ChannelCapabilities

        V1_4_3: true

        V1_3: false

        V1_1: false

    Orderer: &OrdererCapabilities

        V1_4_2: true

        V1_1: false

    Application: &ApplicationCapabilities

        V1_4_2: true

        V1_3: false

        V1_2: false

        V1_1: false


I have also enabled the NodeOUs and set the config.yaml at appropriate MSPs except for the Orderer. From the logs it looks like peer is trying to fetch blocks from the orderer but the orderer gives back 403 error to the peer. The Channel/Readers policy states allow "ANY Readers" and the requesting identity peer/admin does have appropriate rights for this. 

Any ideas where I am getting this wrong?


stefan.riembauer@...
 

Hey mrudav, 

Did you make any progress on this? I am trying the same and it also fails at initializing the chaincode. On the worker node I can see that the chaincode container is started with a log message like "successfully started, sending signal to peer node". Also almost the exact configuration worked about a week ago with eks. Meanwhile I think that this could be a problem on the ami/docker/kubernetes-version which is used on eks... I purged my whole setup today and retried but still the same problem..

br
Stefan