Nguyen Tien Huy
Nguyen Tien Huy

Reputation: 96

hyperledger 2.2 fabcar transaction issue

I followed Writing Your First Application and I face to an issue:

$./runfabcar.sh
ENV_DAL:
DISCOVERY_AS_LOCALHOST=true
run fabcar...
 [fabsdk/core] 2020/07/16 03:56:03 UTC - cryptosuite.GetDefault -> INFO No default cryptosuite found, using default SW implementation
[{"Key":"CAR0","Record":{"make":"Toyota","model":"Prius","colour":"blue","owner":"Tomoko"}},{"Key":"CAR1","Record":{"make":"Ford","model":"Mustang","colour":"red","owner":"Brad"}},{"Key":"CAR2","Record":{"make":"Hyundai","model":"Tucson","colour":"green","owner":"Jin Soo"}},{"Key":"CAR3","Record":{"make":"Volkswagen","model":"Passat","colour":"yellow","owner":"Max"}},{"Key":"CAR4","Record":{"make":"Tesla","model":"S","colour":"black","owner":"Adriana"}},{"Key":"CAR5","Record":{"make":"Peugeot","model":"205","colour":"purple","owner":"Michel"}},{"Key":"CAR6","Record":{"make":"Chery","model":"S22L","colour":"white","owner":"Aarav"}},{"Key":"CAR7","Record":{"make":"Fiat","model":"Punto","colour":"violet","owner":"Pari"}},{"Key":"CAR8","Record":{"make":"Tata","model":"Nano","colour":"indigo","owner":"Valeria"}},{"Key":"CAR9","Record":{"make":"Holden","model":"Barina","colour":"brown","owner":"Shotaro"}}]
Failed to submit transaction: Failed to submit: CreateAndSendTransaction failed: SendTransaction failed: orderers is nil

Here is result of command startFabric.sh

$ docker ps -a
CONTAINER ID        IMAGE                                  COMMAND                    CREATED             STATUS              PORTS                                        NAMES
46e0ea1d9f95        dev-peer0.org1.example.com-…6         "chaincode -peer.add…"   21 hours ago        Up 21 hours                                                      dev-peer0.org1.example.com-…6
7afc6c392399        dev-peer0.org2.example.com-…0         "chaincode -peer.add…"   21 hours ago        Up 21 hours                                                      dev-peer0.org2.example.com-…6
869161c47b22        hyperledger/fabric-peer:latest        "peer node start"        21 hours ago        Up 21 hours         0.0.0.0:7051->7051/tcp                       peer0.org1.example.com
e2b676d4e1e2        hyperledger/fabric-peer:latest        "peer node start"        21 hours ago        Up 21 hours         7051/tcp, 0.0.0.0:9051->9051/tcp             peer0.org2.example.com
5050762f0bf9        hyperledger/fabric-orderer:latest     "orderer"                21 hours ago        Up 21 hours         0.0.0.0:7050->7050/tcp                       orderer.example.com
339d881b7df2        couchdb:3.1                           "tini -- /docker-ent…"   21 hours ago        Up 21 hours         4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp   couchdb0
eb2bcc75aaa3        couchdb:3.1                           "tini -- /docker-ent…"   21 hours ago        Up 21 hours         4369/tcp, 9100/tcp, 0.0.0.0:7984->5984/tcp   couchdb1
6d920be81d67        hyperledger/fabric-ca:latest          "sh -c 'fabric-ca-se…"   21 hours ago        Up 21 hours         7054/tcp, 0.0.0.0:8054->8054/tcp             ca_org2
4005a51e70b4        hyperledger/fabric-ca:latest          "sh -c 'fabric-ca-se…"   21 hours ago        Up 21 hours         0.0.0.0:7054->7054/tcp                       ca_org1
0ff244f6a45e        hyperledger/fabric-ca:latest          "sh -c 'fabric-ca-se…"   21 hours ago        Up 21 hours         7054/tcp, 0.0.0.0:9054->9054/tcp             ca_orderer

How to resolve this issue?

channels:
  mychannel:
    orderers:
      - orderer.example.com
    peers:
      peer0.org1.example.com:
      endorsingPeer: true
      chaincodeQuery: true
      ledgerQuery: true
      eventSource: true

Thanks

Upvotes: 1

Views: 869

Answers (2)

Ray Wang
Ray Wang

Reputation: 21

I had the same problem. According to your explanation, I solved it. Thank you, Nguyen!

Yes, the connection-org1.yaml file has some problems for the Go version fabcar program, but the Java version it’s ok. unknown reasons.

In my case, in addition to the above configuration, the following configuration needs to be added to work。

channels:
  mychannel:
    orderers:
      - orderer.example.com
    peers:
      peer0.org1.example.com:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true

orderers:
  orderer.example.com:
    url: grpcs://localhost:7050
    tlsCACerts:
      pem: |
          -----BEGIN CERTIFICATE-----
          MIICCjCCAbGgAwIBAgIUFQmU8j1hCSJmdSoLEa/6BtfzrOAwCgYIKoZIzj0EAwIw
          YjELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE5ldyBZb3JrMREwDwYDVQQHEwhOZXcg
          WW9yazEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1wbGUu
          Y29tMB4XDTIwMDgwNTAzMDcwMFoXDTM1MDgwMjAzMDcwMFowYjELMAkGA1UEBhMC
          VVMxETAPBgNVBAgTCE5ldyBZb3JrMREwDwYDVQQHEwhOZXcgWW9yazEUMBIGA1UE
          ChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1wbGUuY29tMFkwEwYHKoZI
          zj0CAQYIKoZIzj0DAQcDQgAETFPVGXkshRigcy4ghTLuooUZ3XsOz2S6DBS56Zm6
          VtBczejebMmkFN1+w2LMdIXjSmADgUHujmgZIQSwcLM6U6NFMEMwDgYDVR0PAQH/
          BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYEFMOa2JjrXTCBHAE8
          BRUZ8PSeqEjIMAoGCCqGSM49BAMCA0cAMEQCIFNo8kBg664OZHXP8KctX/oLwWPq
          9H+yTvryIAlLXN+KAiBGa+lWjXfA924x0CEyWLjnxe8IZnNG+gKV3kpQF/A9KQ==
          -----END CERTIFICATE-----

    grpcOptions:
      ssl-target-name-override: orderer.example.com
      hostnameOverride: orderer.example.com

Upvotes: 2

Rob Murgai
Rob Murgai

Reputation: 279

Nguyen, were you able to get the test network going successfully? If not, I would recommend starting here first and getting that going. Then move to fabcar application. You might get better logs to get things sorted better that way as well.

Upvotes: 0

Related Questions