Skip to content
Branch: master
Find file Copy path
Find file Copy path
4 contributors

Users who have contributed to this file

@raheelzubairy @taijihagino @kant @johncswanson
204 lines (132 sloc) 8.45 KB

Read this in other languages: 日本語

Global financing with blockchain

The Global Finance application using blockchain technology tracks actions on an order by the various members of a network -- buyer, seller, provider, shipper, and finance company. These actions include:

  • Buyer creates the order
  • Seller contacts a provider for the items
  • Shipper delivers the items
  • Finance company processes payments to the seller

This use case addresses dispute resolution and can be applied across industry verticals to resolve disputes. This use case is inspired by the RedBook tutorial by Bob Dill and uses the same application interface. This use case employs a Node.js smart contract and a Node.js web application.

The code pattern demonstrates how a Node.js smart contract can be packaged using the IBM Blockchain Platform Extension for VS Code. Then, using the extension, you can set up a local instance of the Hyperledger Fabric network, on which you can install and instantiate the contract. The Node.js web application can interact with the network using the 'fabric-network' sdk.

When you have completed this code pattern, you will understand how to:

  • Develop a Node.js smart contract
  • Package and deploy the smart contract to a local instance of Hyperledger Fabric using IBM Blockchain Platform Extension for VS Code
  • Develop a Node.js blockchain web application to interact with the deployed Fabric network

Architecture flow

The developer uses the IBM Blockchain Platform Extension for VS Code to:

  1. Package a smart contract.
  2. Launch a local Hyperledger Fabric Network.
  3. Install chaincode on the peer node.
  4. Instantiate the chaincode on the peer node.
  5. Use a Global Finance application to interact with the Hyperledger Fabric network through API calls using the fabric-network npm library. Admins can also use the application to create new participants.

Included components

  • IBM Blockchain Platform Extension for VS Code is designed to assist users in developing, testing, and deploying smart contracts -- including connecting to Hyperledger Fabric environments.
  • Hyperledger Fabric v1.4 is a platform for distributed ledger solutions, underpinned by a modular architecture that delivers high degrees of confidentiality, resiliency, flexibility, and scalability.
  • Visual Studio Code is a code editor that's redefined and optimized for building and debugging modern web and cloud applications.

Featured technologies

  • Node.js is an open source, cross-platform JavaScript run-time environment that executes server-side JavaScript code.
  • Bootstrap is an open source toolkit for developing with HTML, CSS, and JavaScript.

Running the application

Follow these steps to set up and run this code pattern. The steps are described in detail below.


You will need to follow the requirements for the IBM Blockchain Platform Extension for VS Code:


  1. Clone the repo
  2. Use the VS Code extension to set up a smart contract on a basic Fabric network
  3. Run the application

1. Clone the repo

Clone this repository in a folder your choice:

git clone

2. Use the VS Code extension to set up a smart contract on a basic Fabric network

Open Visual Studio code and open the contract folder.

Package the smart contract

Press the F1 key to see the different VS code options. Choose IBM Blockchain Platform: Package a Smart Contract Project.

Click the IBM Blockchain Platform extension button on the left. This will show the packaged contracts on top and the blockchain connections on the bottom.

Setup fabric locally

Click on the menu for LOCAL FABRIC OPS, and choose Start Fabric Runtime to start a network. This will download the Docker images required for a local Fabric setup, and start the network. You should see the output window as the network sets up.

You should now see under LOCAL FABRIC OPS, options to install and instantiate smart contract, your Channels information, your peer under Nodes and the organization msp under Organizations You are now ready to install the smart contract.

Install and instantiate the smart contract

Click on +Install under Installed dropdown in the LOCAL FABRIC OPS console.

Choose the peer:

Choose the globalfinancing@0.0.1 contract:

You should see a notification for successful install of the smart contract, and the smart contract listed under Installed in your LOCAL FABRIC OPS console.

You are now ready to instantiate the smart contract. Click on +Instantiate under Instantiated dropdown in the LOCAL FABRIC OPS console.

Choose the channel: my channel.

Choose the globalfinancing@0.0.1 contract:

Type in instantiate for the function:

You can press Enter for optional arguments.

Once this is successfully instantiated, you should see a successful notification in the output view, and the smart contract listed under Instantiated in your LOCAL FABRIC OPS console.

3. Run the application

In a new terminal, navigate to the web-app directory:

cd global-financing-blockchain/web-app/

Build the node dependencies:

npm install

Run the application:

npm start

Unified member's view:

Extending the code pattern

This application can be expanded in a couple of ways:

  • Create a wallet for every member and use the member's wallet to interact with the application.
  • Update the application to interact through the IBM Blockchain Platform starter plan on IBM Cloud.



This code pattern is licensed under the Apache Software License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ

You can’t perform that action at this time.