GithubHelp home page GithubHelp logo

corda-linearpointer-demo's Introduction

Corda Linear Pointer Demo

This repo demonstrates the use of Linear Pointers in Corda.

It uses a very simplistic model of an unsecured MBS (Mortgage Backed Security).

What Is An MBS + How Does It Work?

Homeowners can get a mortgage from a bank to buy their house. The bank gives them a lump sum, and the owners pay the loan back in monthly payments.

The bank sells the rights to these payments to an Investment bank/issuer. The banks charge a fee and also make some profit from this since they are still servicing the homeowner.

This frees up the capital (that the bank had previously given to the homeowner to buy the house) to invest elsewhere.

The Investment bank will create a Special Purpose Entity (a new legal company) to hold all these loans.

This SPE now receives all the monthly payments from the mortgages (and the principal at maturity), which means the SPE now has assets and thus value.

Shares are issued in this SPE and sold to Investors -> this is the MBS.

If homeowners default on their mortgage then the value of the SPE will go down, and the return on the SPE shares will go down too.

What Part Of That Does This Demo Do?

The purpose of the code is to demonstrate Linear Pointers, so it skims over several parts of the business case such as creating the SPE, issuing shares and even the valuation of the MBS.

  • Bank1 creates 3 mortgages
  • Bank2 creates 2 mortgages
  • Bank1 sells their mortgages to the Investment Bank
  • Bank2 sells their mortgages to the Investment Bank
  • Investment Bank creates an empty MBS
  • Investment Bank adds the mortgages to the MBS using Linear Pointers
  • Investment Bank sells the MBS to an Investor

The mortgages are added to the MBS using Linear Pointers which means that the MBS state can be updated without modifying the mortgage states.

This also means that the mortgages can be updated without the MBS state being modified.

The Investor will be able to see the MBS but won't be able to see the detail of the mortgages backing it as they won't be able to resolve the Linear Pointers.

The flow that uses the LinearPointer is AddToMBSFlow.

The TransferMBSFlow should demonstrate the fact that the Investor can't access the mortgages as they are LinearPointers and haven't been transferred.

The end-to-end demonstration is in the test class workflows/src/test/kotlin/com/github/opticyclic/corda/demo/linearpointers/flows/EndToEndTest.kt

NB:

  • The EndToEnd test currently fails due to this Corda bug: corda/corda#6883
  • When running all the tests together with ./gradlew test you will get a failure due to this Corda bug: corda/corda#6884

The build.gradle contains all the necessary nodes, so you can run ./gradlew deployNodes and run the flows from the shell if you would like.

corda-linearpointer-demo's People

Contributors

opticyclic avatar

Watchers

 avatar  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.