Understanding the blockchain corporate remittance application and network layout

In this chapter, we'll be building a blockchain network using Hyperledger Fabric that we'll be using to carry out corporate remittances. We'll call this network Bankchain. The bankchain network will contain a private ledger called bkchannel. This channel will consist of two participants, Bank A and Bank B. Both Bank A and Bank B will have two nodes on the channel, labeled peer0 and peer1. Hence, in total, the channel has four nodes. All transaction requests will be posted to these nodes. Additionally, the banks will monitor these nodes for any incoming transactions.

Apart from the Hyperledger Fabric network, both banks will also each host an IPFS node. IPFS is a distributed file-sharing system. It consists of a distributed network and nodes. Documents published by any IPFS node can be retrieved from any other node connected to the network. In our project, we'll be running a private IPFS network with two nodes. Each bank will own a node on the network. IPFS allows the banks to securely share compliance and AML documents for the remittance transactions.

The following screenshot shows a high-level architecture diagram of our project:

The postgresql database will consist of a customer table that stores customer details, and a transaction table that stores transaction details.

The bank portal has the following three components:

  • A React frontend
  • A Node.js backend server
  • A Node.js transaction listener

The React frontend accepts remittance requests from the customers. In our project, Acme Inc is a customer with Bank A, and Apex Corp is a customer with Bank B. The React frontend also displays the details and documents of all the incoming and outgoing remittance transactions for the customer.

The Node.js backend is essentially a bridge between the frontend, the postgresql database, the blockchain network, and the IPFS network. It retrieves the customer information from the database for populating the frontend, accepts payment requests from the frontend, posts transactions to the Hyperledger Fabric network, and publishes the compliance and AML documents to the IPFS network. It also updates the customer's balance, after a transaction goes through successfully.

Lastly, we have a Node.js transaction listener. The transaction listener listens for all transactions posted to the channel. It does so by listening to an event that is broadcasted by our remittance smart contract whenever a new transaction is added. If the transaction pertains to the node participant, it fetches the details of the transaction from the blockchain. Thus, if the transaction listener for Node B detects a transaction where the receiving bank is Bank B, it will fetch the details of the transaction from the blockchain, for further processing. 

After fetching the details of the incoming transaction, the transaction listener updates the balance of the customer receiving the transaction, adds the transaction to the transactions table in our postgresql database, and fetches the AML and compliance documents relevant to the transaction from the IPFS network to the local storage. The transaction, its relevant details, and attached compliance documents can now be viewed from the frontend by the customer. 

We'll be carrying out the following steps in our project:

  1. Setting up the Hyperledger Fabric network Bankchain with the bkchannel private channel and the node participants Bank A and Bank B.
  2. Writing a corporate remittance chaincode (smart contract) that will allow us to submit remittance transactions and retrieve transaction details from the blockchain.
  1. Setting up a postgresql database for each bank. The database will have a customer database that has the customer details and a transaction database that has details of all the transactions initiated and received by the bank. 
  2. Setting up a private IPFS network with two nodes between Bank A and Bank B, to privately and securely share remittance documents between Bank A and Bank B.
  3. Setting up a node backend server that interacts with the blockchain network, the IPFS network, the postgresql database, and the React frontend. It fetches customer details to populate the frontend, fetches transaction details from the database, submits payment requests to the blockchain network, publishes compliance documents to IPFS, and updates the customer's balance after the transaction goes through successfully.
  4. Setting up a Node.js transaction listener that will listen for incoming transactions to a customer of the bank, fetch transaction details and update these to the transactions database, update the customer's balance, and fetch the compliance documents pertaining to an incoming remittance request from the IPFS network.
  5. Creating a React frontend that allows customers to submit remittance requests and view transactions on their accounts.

Let's start creating our project. We'll start by setting up the Hyperledger Fabric Bankchain network in the next section.

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

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