This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return fabric_client.createUser( | |
| {username: 'user1', | |
| mspid: 'Org1MSP', | |
| cryptoContent: { privateKeyPEM: enrollment.key.toBytes(), signedCertPEM: enrollment.certificate } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return fabric_ca_client.enroll({ | |
| enrollmentID: 'admin', | |
| enrollmentSecret: 'adminpw' | |
| }).then((enrollment) => { | |
| console.log('Successfully enrolled admin user "admin"'); | |
| return fabric_client.createUser( | |
| {username: 'admin', | |
| mspid: 'Org1MSP', | |
| cryptoContent: { privateKeyPEM: enrollment.key.toBytes(), signedCertPEM: enrollment.certificate } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = { | |
| //targets: let default to the peer assigned to the client | |
| chaincodeId: 'fabcar', | |
| fcn: 'changeCarOwner', | |
| args: ['CAR0','Alex'], | |
| chainId: 'mychannel', | |
| txId: tx_id | |
| }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = { | |
| //targets: let default to the peer assigned to the client | |
| chaincodeId: ‘fabcar’, | |
| fcn: ‘createCar’, | |
| args: [‘CAR10′,’Tata’,’Nano’,’purple’,’Alex’], | |
| chainId: ‘mychannel’, | |
| txId: tx_id | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = { | |
| //targets: let default to the peer assigned to the client | |
| chaincodeId: 'fabcar', | |
| fcn: 'changeCarOwner', | |
| args: ['CAR0','Alex'], | |
| chainId: 'mychannel', | |
| txId: tx_id | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var channel = fabric_client.newChannel('mychannel'); | |
| var peer = fabric_client.newPeer('grpc://localhost:7051'); | |
| channel.addPeer(peer); | |
| var order = fabric_client.newOrderer('grpc://localhost:7050') | |
| channel.addOrderer(order); | |
| var member_user = null; | |
| var store_path = path.join(__dirname, 'hfc-key-store'); | |
| console.log('Store path:'+store_path); | |
| var tx_id = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async queryAllCars(stub, args) { | |
| let startKey = 'CAR0'; | |
| let endKey = 'CAR999'; | |
| let iterator = await stub.getStateByRange(startKey, endKey); | |
| let allResults = []; | |
| while (true) { | |
| let res = await iterator.next(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const request = { | |
| //targets : --- letting this default to the peers assigned to the channel | |
| chaincodeId: 'fabcar', | |
| fcn: 'queryAllCars', | |
| args: [''] | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var channel = fabric_client.newChannel('mychannel'); | |
| var peer = fabric_client.newPeer('grpc://localhost:7051'); | |
| channel.addPeer(peer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Fabric_Client = require('fabric-client'); | |
| var path = require('path'); | |
| var util = require('util'); | |
| var os = require('os'); |
NewerOlder