Im going through Hyperledger Fabric web App development.Im still confused with fabcar nodejs example where chaincode is deployed on first-network( total of 4 peers). After we run startFabric.sh
we are able to query or submit transactions with query.js or invoke.js
. while doing so, we are communicating with network via Fabric node SDK. for example, if we try to change car owner, we simply modify invoke.js
with this function and run node invoke.js
then it will simply change particular car owner in the ledger. Here my question is, we have 4 peers where our chaincode is currently installed, from which peer SDK will actually submits transaction to the network?. What if we wanted to submit transaction from another peer?? How can we define connecting peer(transaction submitting peer) in invoke.js
any clarification??
Two things need to clarify..
When you submit a transaction from SDK Client, it will go to endorsing peers for endorsement purpose and it will return back to the client and with endorsement result & actual payload it will connect to the orderer
I hope you are using fabcar/javascript-low-level
You can mention which peers it need to send Tx from a client in the below targets
Note: this is just to understand about peer by the client, when you send it will go to all endorsing peers. (Initiate req by client)
Actually you shouldn't care about it Try gateway service
const proposal_request = {
targets: [peer],
chaincodeId: 'fabcar',
fcn: 'createCar',
args: ['CAR12', 'Honda', 'Accord', 'Black', 'Tom'],
chainId: 'mychannel',
txId: tx_id
};