Giter VIP home page Giter VIP logo

hlf-trade-finance's Introduction

Trade finance on Hyperledger Fabric (*** Only Request, Issue and Accept Letter of Credit workflow implemented ***)

Trade finance application on Hyperledger Fabric

*** Use sudo prefix to commands if you get permission denied error while executing any command, assumption is you already have required software to run Hyperledger fabric network and node SDK ***

Start the Hyperledger Fabric Network

  1. cd hlf-trade-finance
  2. ./start.sh

Setup the Hyperledger Fabric Network

  1. cd hlf-trade-finance
  2. ./setup.sh

Setup API users

  1. cd hlf-trade-finance/tfbc-api
  2. npm install
  3. rm hfc-key-store/*
  4. node enrollBankUser.js
  5. node enrollBuyerUser.js
  6. node enrollSellerUser.js

Run Node APIs

  1. cd hlf-trade-finance/tfbc-api
  2. npm start

Execute APIs on Swagger UI

http://localhost:3000/api-docs

API definition if you want to run APIs using some rest client like Postman etc.

Request LC (Letter of Credit)

  1. URL -> http://localhost:3000/tfbc/requestLC
  2. Http Method -> Post
  3. content-type: application/json
  4. Input-> { "lcId": "LC001", "expiryDate": "31-Dec-2018", "buyer": "buyerUser", "bank": "bankUser", "seller": "sellerUser", "amount": "100000" }
  5. Output-> { "code": "200", "message": "LC requested successsfully." }

Issue LC (Letter of Credit)

  1. URL -> http://localhost:3000/tfbc/issueLC
  2. Http Method -> Post
  3. content-type: application/json
  4. Input-> { "lcId": "LC001" }
  5. Output-> { "code": "200", "message": "LC issued successsfully." }

Accept LC (Letter of Credit)

  1. URL -> http://localhost:3000/tfbc/acceptLC
  2. Http Method -> Post
  3. content-type: application/json
  4. Input-> { "lcId": "LC001" }
  5. Output-> { "code": "200", "message": "LC accepted successsfully." }

Get LC Details

  1. URL -> http://localhost:3000/tfbc/getLC
  2. Http Method -> Post
  3. content-type: application/json
  4. Input-> { "lcId": "LC001" }
  5. Output-> { "lcId": "LC001", "expiryDate": "31-Dec-2018", "buyer": "buyerUser", "bank": "bankUser", "seller": "sellerUser", "amount": "100000" }

Get LC History

  1. URL -> http://localhost:3000/tfbc/getLCHistory
  2. Http Method -> Post
  3. content-type: application/json
  4. Input-> { "lcId": "LC001" }
  5. Output-> { "code": "200", "data": [ { "TxId": "f05b3c1cf24da09f657434c7aff7c3a449565421d409a6b3328975858137b826", "Value": { "lcId": "LC001", "expiryDate": "31-Dec-2018", "buyer": "buyerUser", "bank": "bankUser", "seller": "sellerUser", "amount": 100000, "status": "Requested" }, "Timestamp": "2018-11-28 13:59:59.79 +0000 UTC", "IsDelete": "false" }, { "TxId": "9b7d25533de4d1cb1d3fff1f65d6f1bcaf3821ebedf4a8ffbf7c85fd7e2ff49f", "Value": { "lcId": "LC001", "expiryDate": "31-Dec-2018", "buyer": "buyerUser", "bank": "bankUser", "seller": "sellerUser", "amount": 100000, "status": "Issued" }, "Timestamp": "2018-11-28 14:00:36.362 +0000 UTC", "IsDelete": "false" }, { "TxId": "0e6ccb1e1fbbd47937979ad981c7865c7f170b0487480322d172ebfaf25f4575", "Value": { "lcId": "LC001", "expiryDate": "31-Dec-2018", "buyer": "buyerUser", "bank": "bankUser", "seller": "sellerUser", "amount": 100000, "status": "Accepted" }, "Timestamp": "2018-11-28 14:00:50.469 +0000 UTC", "IsDelete": "false" } ] }

Stop the network

  1. cd hlf-trade-finance
  2. ./stop.sh

hlf-trade-finance's People

Contributors

purulalwani avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.