1

I set up Hyperledger Fabric net using devmode (https://github.com/hyperledger/fabric-samples/tree/release-1.1/chaincode-docker-devmode) and started chaincode. I need a way to communicate with the network (create/join channels, invoke chaincode).

I tried to use python-SDK (https://github.com/hyperledger/fabric-sdk-py/blob/master/docs/tutorial.md). A network.json configuration file is needed to initialize a client instance, but the file is not provided in fabric-samples, so I attempted to create my own. It doesn't work.

The code:

from hfc.fabric import Client

cli = Client(net_profile="network.json")

print(cli.organizations)  # orgs in the network
org1_admin = cli.get_user('org1.example.com', 'Admin')
response = cli.channel_create(
    'orderer',
    'myc',
    org1_admin,
    'myc.tx')

The orderer outputs:

http2Server.HandleStreams received bogus greeting from client

I tried to use different certificates and name for orederer, but it didn't help.

The network.json:

{
  "name": "sample-network",
  "description": "Sample network contains 4 peers (2 orgs), 1 orderer and 2 cas for Python SDK testing",
  "version": "0.1",
  "client": {
    "organization": "Org1",
    "credentialStore": {
      "path": "/tmp/hfc-kvs",
      "cryptoStore": {
        "path": "/tmp/hfc-cvs"
      },
      "wallet": "wallet-name"
    }
 },
  "organizations": {
    "orderer.example.com": {
      "mspid": "OrdererMSP",
      "orderers": [
        "orderer"
      ],
      "certificateAuthorities": [
      ]
    },
    "org1.example.com": {
      "mspid": "Org1MSP",
      "peers": [
        "peer0.org1.example.com"
      ],
      "certificateAuthorities": [
        "ca-org1"
      ],
      "users": {
        "Admin": {
          "cert": "msp/admincerts/admincert.pem",
          "private_key": "msp/keystore/key.pem"
        }
      }
    }
  },
  "orderers": {
    "orderer": {
      "url": "localhost:7050",
      "grpcOptions": {
        "ssl-target-name-override": "orderer",
        "grpc-max-send-message-length": 15
      },
      "tlsCACerts": {
        "path": "msp/cacerts/cacert.pem"
      }
    }
  },
  "peers": {
    "peer0.org1.example.com": {
      "url": "localhost:7051",
      "eventUrl": "localhost:7053",
      "grpcOptions": {
        "ssl-target-name-override": "peer0.org1.example.com",
        "grpc.http2.keepalive_time": 15
      },
      "tlsCACerts": {
        "path": "msp/signcerts/peer.pem"
      }
    }
  }
}
Borys Serebrov
  • 15,636
  • 2
  • 38
  • 54
PowderMind
  • 11
  • 1
  • Might be helpful to check the python SDK tests, they have a [network.json example](https://github.com/hyperledger/fabric-sdk-py/blob/master/test/fixtures/network.json) and also the [integration test to invoke the chaincode](https://github.com/hyperledger/fabric-sdk-py/blob/master/test/integration/chaincode_invoke_test.py), see also the [base test case](https://github.com/hyperledger/fabric-sdk-py/blob/master/test/integration/utils.py) for initialization code. – Borys Serebrov Apr 19 '18 at 12:46
  • @BorisSerebrov I created the network.json file looking at test network.json file example. – PowderMind Apr 19 '18 at 13:16

0 Answers0