This CorDapp comprises a demo of an IOU-like agreement that can be issued, transfered and settled confidentially. The CorDapp includes:
- An obligation state definition that records an amount of any currency payable from one party to another. The obligation state
- A contract that facilitates the verification of issuance, transfer (from one lender to another) and settlement of obligations
- Three sets of flows for issuing, transferring and settling obligations. They work with both confidential and non-confidential obligations
The CorDapp allows you to issue, transfer (from old lender to new lender) and settle (with cash) obligations. It also comes with an API and website that allows you to do all of the aforementioned things.
git clone http://github.com/roger3cev/obligation-cordapp
cd obligation-cordapp
./gradlew deployNodes
- building may take upto a minute (it's much quicker if you already have the Corda binaries)./rcd kotlin-source/build/nodes
./runnodes
At this point you will have notary/network map node running as well as three other nodes and their corresponding webservers. There should be 7 console windows in total. One for the networkmap/notary and two for each of the three nodes. The nodes take about 20-30 seconds to finish booting up.
NOTE: That the obligation and corda-finance CorDapps will automatically be installed for each node.
In your favourite web browers, navigate to:
- PartyA:
http://localhost:10007
- PartyB:
http://localhost:10010
- PartyC:
http://localhost:10013
You'll see a basic page, listing all the API end-points and static web content. Click on the "obligation" link under "static web content". The dashboard shows you a number of things:
- All issued obligations to date
- A button to issue a new obligation
- A button to self issue cash (used to settle obligations)
- A refresh button
- Click on the "create IOU" button.
- Select the counterparty, enter in the currency (GBP) and the amount, 1000
- Click create IOU
- Wait for the transaction confirmation
- Click anywhere
- Press the refresh button
- The UI should update to reflect the new obligation.
- Navigate to the counterparties dashboard. You should see the same obligation there. The party names show up as random public keys as they are issued confidentially. Currently the web API doesn't resolve the party names.
From the obligation borrowers UI:
- Click the issue cash button
- Enter a currency (GBP) and amount, 10000
- Click "issue cash"
- Wait for the transaction confirmation
- click anywhere
- Click the refresh button
- You'll see the "Cash balances" section update
From the obligation borrowers UI:
- Click the "Settle" button for the obligation you previously just issued.
- Enter in a currency (GBP) and amount, 500
- Press the "settle" button
- Wait for the confirmation
- Click anywhere
- Press the refresh button
- You'll see that £500 of the obligation has been paid down
- Navigate to the lenders UI, click refresh, you'll see that £500 has been paid down
This is a partial settlement. you can fully settle by sending another £500. The settlement happens via atomic DvP. The obligation is updated at the same time the cash is transfered from the borrower to the lender. Either both the obligation is updated and the cash is transferred or neither happen.
That's it!
From the lenders UI you can transfer an obligation to a new lender. The procedure is straight-forward. Just select the Party which is to be the new lender. Refresh teh UIs to see the reflected changes.
- Remove references to "IOU"
- Resolve party names for the web front-end.
- Replace the Corda web server with a reactive spring boot web server
- Auto update the UI
Feel free to submit a PR.