Design and Architecture of a Blockchain Application

Posted on Wed, Mar 20, 2019 @ 11:20 am

In this series of blog posts, I will take you through the steps involved in the design, architecture, and implementation of a fully functional Enterprise Blockchain Application. I will do that by sharing content from various stages of developing a sample application we (OFS) built for Loan Origination and Payment on Blockchain. If you follow through the end of this series, you will have a better understanding of the internal workings of a blockchain application.

We are building this application in IBM Blockchain Platform 2.0 Beta. Please check out my previous post — IBM Blockchain Platform 2.0 Beta: Run your Blockchain N/W in 10 Simple Steps for better continuity.

Objective

The objective is to develop a Decentralized Application that explores potential business benefits of using blockchain like

  • Improved process efficiency
  • Economy of scale
  • Privacy when you need it
  • Transparency and trust
  • Decentralized data with a logically centralized view
  • Recording of payments onto a blockchain

Use case and Actors

The use case we picked up to meet our objectives is a Loan Origination and Payment Application. The actual implementation of the use case doesn’t cover all intricacies and regulatory aspects of the loan origination and payments process but will be a good indicator of the design aspects to consider while building a DApp on the blockchain. The actors in the app are

  1. The Credit Reporting Agency — publishes the credit report of the citizens of demo universe to the Blockchain network. Controls access to the reports through smart contracts.
  2. The Property Title Search Organization — publishes the title report of the properties in the demo universe to the Blockchain N/W. Controls access to the reports through smart contracts.
  3. The Borrower (Applicant) — applies for a loan → receives proposals of various T&C from lenders → obtains the loan → makes the monthly payment, all on the blockchain.
  4. Lender 1 — fully utilizes all that blockchain has to offer, hence the fully automated business process behind the proposal response to the applicant.
  5. Lender 2 — still follows some traditional business process, slowly embracing blockchain.
  6. Consortium — facilitates onboarding organizations and establishes the governing principles of the business network.

Blockchain Business Network

The Blockchain business network of the application looks like this:

Use Case Flow

Animated use case flow

Technical Design and Architecture

IBM Blockchain Platform Business Network Architecture

  • Every organization in the network has a CA and a peer node.
  • A private channel is established between the consortium orchestrator and lenders to securely share proposals, terms, and conditions of the loan with the applicant.
  • The chaincode to create and process the loans will be deployed to the peers of Lender 1, Lender 2, and the consortium orchestrator. We will review the chaincode in detail in another post.


Application Architecture

The design of the Blockchain network is just one piece of the puzzle. Application design and architecture is equally important. Consider the following as you design your application:

  • Although IBM Blockchain Platform with Hyperledger Fabric at its heart scales well when compared to the public blockchain platforms, it is not a transactional database, so don’t expect throughputs like traditional centralized databases have.
  • Use the blockchain for what it has to offer — trust, transparency, and immutability. Decide what you store in your blockchain based on that.
  • Embrace asynchronous event-driven programming — the blockchain nodes are only eventually consistent. The consensus process is not instantaneous.
  • The data in the blockchain is secured by design through encryption and various governing principles of the network, but the security stops at the blockchain network level. You should still address the application security with your design.
  • Think about GDPR-like regulations before you store personally identifiable information onto the blockchain.

Design

We followed a modular microservices architecture. The complexity of interaction with the blockchain itself is abstracted out to a generic component that knows how to invoke chaincode to read/write data from/to blockchain. This helps to keep the other services lightweight and flexible.

Internal components of the architecture

As you can see we are expanding the IBP network to include a node running in AWS, showing the multi-cloud ability of IBM Blockchain Platform.

Data Flow

  • The microservices expose REST APIs for the presentation layer to consume.
  • The services delegate calls to the Hyperledger Gateway for blockchain invocations.
  • The blockchain calls are asynchronous. Once the transactions are added to the blockchain the Event Hub pushes the signal to all interested subscribers through a callback endpoint.
  • We use WebSockets for the presentation layer to react to the events from the Event hub.

Data flow diagram with synchronous (red) and asynchronous (black) calls

Service API Definitions

Borrower (Applicant) Services

Lender Services

Partner Services

Asynch Blockchain Invoker

Event Hub Services

Check out our swagger hub documentation for the APIs

I hope you’ve been able follow up until now. We will catch up on the design and development of the chaincode in my next post.

 

About the Author

 

 

 

 

 

Ganeshram Ramamurthy is ObjectFrontier’s technical director and heads technology for presales. For many years, Ganesh has been designing and developing enterprise applications across various domains. He has a keen interest in emerging technologies and is now spearheading blockchain initiatives at OFS.

Leave a Reply

Your email address will not be published. Required fields are marked *