Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (12.7k points)

I am configuring Hyperledger Explorer, in a Ubuntu virtual machine version 16.04, to integrate with Hyperledger Composer based in this link: https://github.com/hyperledger/blockchain-explorer/blob/master/README.md

I have followed all the steps of the configuration according to github link including the database setup and modified the config.json file to use the structure of the first-network of Hyperledger Fabric samples like this:

{

  "network-config": {

    "org1": {

      "name": "peerOrg1",

      "mspid": "Org1MSP",

      "peer1": {

        "requests": "grpcs://127.0.0.1:7051",

        "events": "grpcs://127.0.0.1:7053",

        "server-hostname": "peer0.org1.example.com",

        "tls_cacerts":

          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"

      },

      "peer2": {

        "requests": "grpcs://127.0.0.1:8051",

        "events": "grpcs://127.0.0.1:8053",

        "server-hostname": "peer1.org1.example.com",

        "tls_cacerts":

          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"

      },

      "admin": {

        "key":

          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore",

        "cert":

          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts"

      }

    },

    "org2": {

      "name": "peerOrg2",

      "mspid": "Org2MSP",

      "peer1": {

        "requests": "grpcs://127.0.0.1:9051",

        "events": "grpcs://127.0.0.1:9053",

        "server-hostname": "peer0.org2.example.com",

        "tls_cacerts":

          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"

      },

      "peer2": {

        "requests": "grpcs://127.0.0.1:10051",

        "events": "grpcs://127.0.0.1:10053",

        "server-hostname": "peer1.org2.example.com",

        "tls_cacerts":

          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"

      },

      "admin": {

        "key":

          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/keystore",

        "cert":

          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/signcerts"

      }

    }

  },

  "channel": "mychannel",

  "orderers": [

    {

      "mspid": "OrdererMSP",

      "server-hostname": "orderer.example.com",

      "requests": "grpcs://127.0.0.1:7050",

      "tls_cacerts":

        "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt"

    }

  ],

  "keyValueStore": "/tmp/fabric-client-kvs",

  "configtxgenToolPath": "/home/diogosilva/fabric-dev-servers/fabric-samples/bin",

  "SYNC_START_DATE_FORMAT": "YYYY/MM/DD",

  "syncStartDate": "2018/01/01",

  "eventWaitTime": "30000",

  "license": "Apache-2.0",

  "version": "1.1"

}

Then when building Hyperledger Explorer, when running the command:

npm test -- -u --coverage

The last test throws the following error:

RUNS  src/components/View/LandingPage.spec.js

/home/diogosilva/blockchain-explorer/client/node_modules/react-scripts/scripts/test.js:20

  throw err;

  ^ 

TypeError: getBlockActivity is not a function

    at LandingPage.componentDidMount (/home/diogosilva/blockchain-explorer/client/src/components/View/LandingPage.js:136:5)

    at <anonymous>

npm ERR! Test failed.  See above for more details. 

Does anybody know how to fix this?

1 Answer

0 votes
by (29.5k points)
edited by

You just need to put one entry in your blockchain-explorer-0.3.7.1\client\src\components\View\LandingPage.spec.js file:

getBlockActivity:jest.fn(),
This line is missing in constant setup. add this line and it would work fine.

Give yourself time to explore the Blockchain field properly. Enroll in Blockchain Online Training now.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...