Blockchain Development with Hyperledger
上QQ阅读APP看书,第一时间看更新

User records

For both the channel world state and the user keys and certificates for the respective organizations, we will use a file-based store, as specified in clientUtils.js:

var Constants = require('./constants.js');
var tempdir = Constants.tempdir;
module.exports.KVS = path.join(tempdir, 'hfc-test-kvs');
module.exports.storePathForOrg = function(org) {
return module.exports.KVS + '_' + org;
};

In constants.js, tempdir is initialized as follows:

var tempdir = "../network/client-certs";

Alternatively, you can also set the storage location to lie in the temporary folder designated by your operating system using the os.tmpdir() function; you will just need to create a subfolder there(say <folder-name>.) On a typical Linux, system, this storage location will default to /tmp/<folder-name>/, and folders will be created there for each organization. As we run the various operations, we will see these folders getting generated and files getting added to them.