How to use the fabric-client/lib/utils.js.getNonce function in fabric-client

To help you get started, we’ve selected a few fabric-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric / test / tools / PTE / pte-execRequest.js View on Github external
function getMoveRequest() {
    if ( ccType == 'ccchecker') {
        arg0 ++;
        testInvokeArgs[1] = 'key_'+channelName+'_'+org+'_'+Nid+'_'+pid+'_'+arg0;
        // random payload
        var r = Math.floor(Math.random() * (payLoadMax - payLoadMin)) + payLoadMin;

        var buf = crypto.randomBytes(r);
        testInvokeArgs[2] = buf.toString('hex');
    }
    //console.log('d:id:chan:org=%d:%d:%s:%s getMoveRequest] testInvokeArgs[1]', Nid, pid, channelName, org, testInvokeArgs[1]);

    nonce = utils.getNonce();
    tx_id = hfc.buildTransactionID(nonce, the_user);
    utils.setConfigSetting('E2E_TX_ID', tx_id);
    logger.info('setConfigSetting("E2E_TX_ID") = %s', tx_id);

    request_invoke = {
        chaincodeId : chaincode_id,
        chaincodeVersion : chaincode_ver,
        chainId: channelName,
        fcn: uiContent.invoke.move.fcn,
        args: testInvokeArgs,
        txId: tx_id,
        nonce: nonce
    };


    if ( inv_m == nRequest ) {
github hyperledger / fabric-sdk-node / test / integration / endorser-tests.js View on Github external
function(admin) {
				if (!!admin)
					t.pass('Successfully enrolled user \'admin\'');
				else {
					t.fail('Failed to obtain enrolled user \'admin\'');
					t.end();
				}

				chain.addPeer(new Peer('grpc://localhost:7051'));
				chain.addPeer(new Peer('grpc://localhost:7056'));

				the_user = admin;
				nonce = utils.getNonce();
				tx_id = chain.buildTransactionID(nonce, the_user);

				// send proposal to endorser
				var request = {
					chaincodePath: testUtil.CHAINCODE_PATH,
					chaincodeId: chaincode_id,
					chaincodeVersion: chaincode_version,
					txId: tx_id,
					nonce: nonce
				};

				return chain.sendInstallProposal(request);

			},
			(err) => {
github IBM / todo-list-fabricV1 / todo-list-fabric-server / utils / fc_wrangler / invoke_cc.js View on Github external
invoke_cc.invoke_chaincode = function (obj, options, cb) {
		logger.debug('[fcw] Invoking Chaincode: ' + options.cc_function + '()');
		var eventhub;
		var chain = obj.chain;
		var nonce = utils.getNonce();
		var cbCalled = false;
		console.log("obj.submitter");
		//console.log(obj.submitter);
		console.log(nonce);
		// send proposal to endorser
		var request = {
			chainId: options.channel_id,
			chaincodeId: options.chaincode_id,
			chaincodeVersion: options.chaincode_version,
			fcn: options.cc_function,
			args: options.cc_args,
			txId: chain.buildTransactionID(nonce, obj.submitter),
			nonce: nonce,
		};
		logger.debug('[fcw] Sending invoke req', request);
github y12studio / dltdojo / dockerfiles / triple-chain / v1 / deploy.js View on Github external
function (admin) {
  logger.info('Successfully obtained enrolled user to deploy the chaincode')

  logger.info('Executing Deploy')
  tx_id = helper.getTxId()
  var nonce = utils.getNonce()
  var args = helper.getArgs(config.deployRequest.args)
		// send proposal to endorser
  var request = {
    chaincodePath: config.chaincodePath,
    chaincodeId: config.chaincodeID,
    fcn: config.deployRequest.functionName,
    args: args,
    chainId: config.channelID,
    txId: tx_id,
    nonce: nonce,
    'dockerfile-contents': config.dockerfile_contents
  }
  return chain.sendDeploymentProposal(request)
}
).then(
github y12studio / dltdojo / dockerfiles / triple-chain / v1 / query.js View on Github external
function (admin) {
  logger.info('Successfully obtained enrolled user to perform query')

  logger.info('Executing Query')
  var targets = []
  for (var i = 0; i < config.peers.length; i++) {
    targets.push(config.peers[i])
  }
  var args = helper.getArgs(config.queryRequest.args)
		// chaincode query request
  var request = {
    targets: targets,
    chaincodeId: config.chaincodeID,
    chainId: config.channelID,
    txId: utils.buildTransactionID(),
    nonce: utils.getNonce(),
    fcn: config.queryRequest.functionName,
    args: args
  }
		// Query chaincode
  return chain.queryByChaincode(request)
}
).then(
github hyperledger / fabric-sdk-node / examples / balance-transfer / deploy.js View on Github external
function(admin) {
		logger.info('Successfully obtained enrolled user to deploy the chaincode');

		logger.info('Executing Deploy');
		tx_id = helper.getTxId();
		var nonce = utils.getNonce();
		var args = helper.getArgs(config.deployRequest.args);
		// send proposal to endorser
		var request = {
			chaincodePath: config.chaincodePath,
			chaincodeId: config.chaincodeID,
			fcn: config.deployRequest.functionName,
			args: args,
			chainId: config.channelID,
			txId: tx_id,
			nonce: nonce,
		};
		return chain.sendInstantiateProposal(request);
	}
).then(
github hyperledger / fabric / test / tools / PTE / pte-execRequest.js View on Github external
function getQueryRequest() {
    if ( ccType == 'ccchecker') {
        arg0 ++;
        testQueryArgs[1] = 'key_'+channelName+'_'+org+'_'+Nid+'_'+pid+'_'+arg0;
    }
    //console.log('d:id:chan:org=%d:%d:%s:%s getQueryRequest] testQueryArgs[1]', Nid, pid, channelName, org, testQueryArgs[1]);

    nonce = utils.getNonce();
    tx_id = hfc.buildTransactionID(nonce, the_user);
    request_query = {
        chaincodeId : chaincode_id,
        chaincodeVersion : chaincode_ver,
        chainId: channelName,
        txId: tx_id,
        nonce: nonce,
        fcn: uiContent.invoke.query.fcn,
        args: testQueryArgs
    };

    //console.log('request_query: ', request_query);
}
github hyperledger / composer-tools / packages / fabric-dev-servers / fabric-scripts / hlfv1-node / hlfv1 / join-channel.js View on Github external
.then((admin) => {
            console.log('Successfully enrolled user \'admin\'');
            the_user = admin;

            nonce = utils.getNonce();
            tx_id = chain.buildTransactionID(nonce, the_user);
            let request = {
                targets: targets,
                txId: tx_id,
                nonce: nonce
            };
            return chain.joinChannel(request);
        }, (err) => {
            console.log('Failed to enroll user \'admin\' due to error: ' + err.stack ? err.stack : err);