---
title: The Trade Finance Use Case using IBM HyperLedger
type: article
date: 2018-12-17
source: website
original_url: "https://navveenbalani.dev/index.php/articles/blockchain/the-trade-finance-use-case-using-ibm-hyperledger/"
topics: ["blockchain"]
legacy_categories: ["blockchain"]
summary: "In this section, we will explore and implement the trade finance use case. Let’s consider an international trade process. To carry out an international trade, several parties or organizations need to coordinate with each other. They typically include, but not limited to: buyer…"
draft: false
---

In this section, we will explore and implement the trade finance use
case. Let’s consider an international trade process. To carry out an
international trade, several parties or organizations need to coordinate with
each other. They typically include, but not limited to: buyer (importer), seller
(exporter), banks, shipping and logistics firms, port and customs authorities.
The international trade process of today is often time-consuming and
ineffective due to several regulations and documentation at each stage of the
process. This not only makes the trade process ineffective but also adds a huge
burden of cost.

Secondly, there is lack of visibility around the entire process, and
each party to the trade maintains their own truth of information. There is no
shared consensus and often arise lack of trust especially if they have not
conducted business with each other before.

As creating the entire trading process may not be pragmatic within the
scope of the book, we will implement a very simple trade finance use case that
will involve exporting goods from seller to buyer and cover the process of
creating and authorizing LOC and shipment using Hyperledger Fabric blockchain
technology.

---

*“Trade finance refers to financing a trade. In
simple terms, a trade is an exchange of goods and services between buyers and
sellers or importer and exporter. Trade can be a domestic or international
trade. Banks or financial institutions provide a different form of financing
avenues to support a trade. Financing does not only involve lending money but
also making sure appropriate documentation is carried out so that the trade
process is efficient and parties to trade can do business with confidence and
trust.”*

---

We will introduce a fictitious company named Free Trade Enterprise
(FTE) - providing a trade finance application to conduct free and fair trade,
transparent to all the parties. The application will be implemented using
Hyperledger Fabric blockchain platform. The application will enable parties to
the business execute a trade in a secured fashion by means of consensus and
provenance, so as to provide transparency and accountability thereby reducing
the time of financial trade from days to hours.

The FTE provides a marketplace model where trading can happen through
shared consensus by the parties involved in the business. The marketplace uses
many technologies apart from blockchain to make trading smooth and transparent.
The technologies could include artificial Intelligence to match prospective
sellers with buyers based on buyer's requirements, rating, and past trades. For
new buyers, recommendation systems could pick up best-rated and safe sellers
and trusted associated parties and provide optimization of trade based on
similar requirements.

Internet of Thing (IoT) technology can be used to automatically track
goods and shipments at various intervals. For instance, goods that require to
be transported over some optimum temperature, sensors can be employed that
update contracts automatically if the temperature is dropped to a certain
level. GPS coordinates can be tracked at various intervals to ensure real-time
event tracking of trades.

As you see the possibilities are endless and one can leverage a
combination of these technologies, backed by consensus through blockchain for
next generation trade platform.

The users of our trade finance application are categorized into four
distinct entities:

- Buyer (registered with FTE)
- Supplier (registered with FTE)
- Importer and exporter bank (part of larger
  Banking Consortium)
- Shipper (Shipment and Logistics firm)

### The Trade scenario

A buyer (importer) registered with FTE wishes to buy 5 cartons of rich
baked almonds with each carton containing 500 packs. FTE provides a Fabric
blockchain platform where parties to the trade can create relevant
documentation using smart contract. The buyer initiates the process by making a
purchase inquiry to the seller. The seller views the purchase order and
registers a sales order against it with certain terms and conditions about the
sale. Once the sale contract is established, the importer bank will issue a
letter of credit (LOC) to the exporter bank. This is one way of providing
credit to the buyer on presentation of relevant documents, like bill of lading,
by the seller. Once the exporter bank receives and validates the terms in the
letter of credit, the seller approves the same, which initiates the shipment
process. The shipping company will scan the goods and prepare the bill of
lading (BOL) document, signifying the initiation of shipment process. Once the
buyer receives the goods, it endorses the bill of lading document thereby
indicating the completion of the trade.

In the above
process, we are not dealing with any physical documents like purchase order,
LOC or BOL but creating a smart contract and updating the status as the trade
progresses. As we move towards a digital world, we envision a future where
digital contracts would replace physical documentation as legitimate and legal
artifacts.

We will implement the above flow using
Hyperledger Fabric and start from the LOC creation process. We will assume that
buyer and the seller have entered into an agreement to perform a trade
involving the purchase of rich almonds. So, our smart contract is ready with
purchase and sale order details.

## Application Design and Implementation strategy

We aim to provide a universal design and implementation roadmap for a permissioned-based
enterprise blockchain. The stated approach is generic in nature and will
provide you with a fair idea on how to kick-start your blockchain
implementation in the enterprise. We will start with identifying business
entities and designing the network topology and end up showing implementation
and deployment. In the end, we will demonstrate the end-to-end test cases that
will fulfill our smart contract as it executes transactions and query through
the same to depict the final trade completion state.

The approach will have the following stages that can be used to design
and implement a permissioned enterprise blockchain application:

- Defining Business Network
- Designing Network Topology
- Defining Smart Contract
- Application Deployment
- ●     
  End-to-end Test Execution

### Defining Business Network

Defining business network involves identifying parties to the
business, their roles, and stake in the business. It involves creating users,
their roles and affiliations or departments. For our trade finance application,
we will use three different groups of business entities that will form the
business network to carry out the trade business. All these entities will
interact with the trade finance application and perform its respective function
to fulfill a smart contract to take it to its logical end. In short, it will
signify the completion of the trade in a free, transparent and trusted manner.
The following are the three entities or organizations we will configure:

1. Free Trade Enterprise (FTE)
2. Banking Consortium (BNK)
3. Shipping and Logistics firm (SHP)

### Free Trade Enterprise (FTE)

FTE will consist of registered buyers and sellers that make use of the
platform to discover each other and carry out trades. Their goal will be to
fulfill their purchase and sale orders respectively. They will interact with
the application to typically initiate the quotations or proposal and approve
them as smart contracts. The following table depicts the user organization of
FTE:

|  |  |  |
| --- | --- | --- |
| **User Id** | **Role** | **Organization MSP Id** |
| User1 | Buyer | Org1FTE |
| User2 | Seller | Org1FTE |

As shown in the above table, we have two users
defined with the roles of buyer and seller respectively and an MSP id of the
organization to which the user belongs. (Note: MSP Id can be any arbitrary
value; it just identifies your organization). In Hyperledger Fabric, the users
can be created using Fabric CA client component. But one can also plug in their
own CA server implementation to create users or generate crypto credentials.
For our trade finance application, we have used the cryptogen tool provided by
Fabric runtime, to generate users and certificates. This is discussed in the
later section.

### Banking Consortium (BNK)

The banking consortium can be viewed as a consortium of various banks.
For our trade finance application, we will have an importer and an exporter
bank as a member of this consortium. Importer bank will be involved in the
process of LOC creation, which will be eventually approved by the exporter
bank. This will be all done using trade finance application provided by FTE
through the use of smart contracts. Just like FTE, the banking consortium will
also represent an MSP. The below table depicts its user organization:

|  |  |  |
| --- | --- | --- |
| **User Id** | **Role** | **Organization MSP Id** |
| User1 | Importer Bank | Org2BNK |
| User2 | Exporter Bank | Org2BNK |

We will have users with the role of importer and
exporter bank respectively. The MSP id of the consortium will be Org2BNK

### Shipping and Logistics firm (SHP)

Our design will have a separate entity that will handle shipping and
logistics aspect of the trade. Once the seller verifies the LOC approval, the
shipper will initiate the shipping by creating the BOL document. This again
will be done using the smart contract. The below table depicts the user
organization of the shipper:

|  |  |  |
| --- | --- | --- |
| **User Id** | **Role** | **Organization MSP Id** |
| User1 | Shipper | Org3SHP |

There will be only one user with the role name as a shipper and the
MSP id as Org3SHP

In the next stage of our design and
implementation approach, we will talk about designing a network topology.

### Designing Network Topology

Designing a network topology is a very significant step when it comes to implementing blockchain in the enterprise. For our trade finance application, the network topology or the deployment model will look like the following:

The above network topology defines a blueprint with many nodes or
deployment units that communicate with each other to execute or fulfill a
blockchain transaction. Our network design will comprise of six peer nodes
representing three different organizations viz. FTE, BNK and SHP and an Orderer
node. The model also depicts a channel that will be used by peers to validate
and execute transactions.

The Orderer node will be responsible for guaranteeing transaction
order and delivery. The orderer service is also used to create a channel that
provides a common communication infrastructure for peer and client nodes. Our
orderer node will be part of FTE organization (orderer.fte.com) hosted on port
7050. The orderer service is bootstrapped with genesis block also known as the
first block of the blockchain network that contains configuration details like
which organization will manage the orderer node and number of peers and users
managed by each organization.

Channel is another core component that provides a common
infrastructure for all the peers (part of that channel) to communicate. We will
have one channel termed as 'tradechannel' where our MSP instances like orderer
(orderer.fte.com) and peers from all the three organizations will participate
in the transaction. Each peer will have its own copy of ledger associated with
'tradechannel' channel. In short, all the peers will have visibility of every
trade finance transactions that will be carried out on this channel.

Every organization will host peer nodes. We will have two peers per
each organization - peer0.app.fte.com and peer1.app.fte.com as part of FTE,
peer0.bnk.com, and peer1.bnk.com as part of BNK and peer0.shp.com and
peer1.shp.com as part of organization SHP. One of the responsibilities of peer
is to execute the transactions and validate them against the endorsement
policy. The transactions itself will be part of chaincode that represents our
smart contract. And therefore, our chaincode named 'tradefinancecc' will be
installed on each peer. Peers itself can also become an endorser of
transactions. All the peers will form a part of channel ‘tradechannel’.

In the [next article](/articles/smart-contract-for-trade-finance-application), we will talk a bit about our trade finance smart contract, termed as 'tradefinancecc'. We will explore through the business methods and workflow that will represent the trade finance application.