Changes for transaction listener for Bank B

Duplicate the TransListener-BankA.js file for the transaction listener for Bank B, and rename it TransListener-BankB.js. Make the following changes to the code:

  1. Change the ipfs client object to the client port for the Bank B IPFS node, as follows:
   const ipfs = ipfsClient('http://localhost:5002')
  1. Change the conString object, used to connect to postgres, to the following values for the bankb database:
   const conString = "postgres://bankb:bankb@localhost:5432/bankb";
  1. Set the ccpPath object to the location of the connection profile for Bank B, like this:
   const ccpPath = '~/fabric-samples/bankchain/connection-bankb.json';
  1. Substitute the location of the wallet with the user's identity for Bank B, like this:
   const wallet = new FileSystemWallet('~/fabric-samples/bankchain/wallet-BankB');
  1. Change the if clause for the listener to Bank B, to check for transactions where Bank B is the receiving bank, as follows:
    if(trans.Rbank == 'Bank B')
  1. Change the wallet path for Bank B, like this:
const wallet = new FileSystemWallet('~/fabric-samples/bankchain/wallet-BankB');

That wraps up both the transaction listeners.

Bring both the listeners online. Run the following command in separate Terminal windows:

$node TransListener-BankA.js
$node TransListener-BankB.js

TransListeners should both come online. The listeners will print the Gateway Connected message on the console to indicate that the listener is connected to the blockchain network and is listening for events.

That completes our backend infrastructure for both the banks. Next, we'll build a corporate remittance app frontend that will interact with the backend and allow users to submit transactions and view submitted transactions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.59.163