Creating a channel

To create our trade channel, we first need to instantiate a fabric-client instance and a handle to the orderer using the configuration in config.json (see the createChannel function in create-channel.js):

var client = new Client();var orderer = client.newOrderer(  ORGS.orderer.url,  {    'pem': caroots,    'ssl-target-name-override': ORGS.orderer['server-hostname']  });

We use a file-based key-value store to save the ledger world state as follows (it is left as an exercise to the reader to try out other types of store, such as CouchDB, using CouchDBKeyValueStore.js):

utils.setConfigSetting('key-value-store', 'fabric-client/lib/impl/FileKeyValueStore.js');

Next, we must enroll an administrator user for the orderer (using the mechanisms ...

Get Blockchain Development with Hyperledger now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.