This CorDapp is an example of how Trades can be created and settled confidentially. The CorDapp includes:
- An trade state definition that records an trade from one party to another.
- A contract that facilitates the verification of trade and counter trade.
- Two flows for creating trade and counter trade for trade settlement.
The CorDapp allows you to create trade and counter trade with buying and selling value. An party can select the counter party whoile creating the trade and specify the sell / buy value with currency details.It also comes with an API and website that allows you to do all of the aforementioned things.
git clone https://github.com/dineshrivankar/cordapp-netting-and-settlement.git
cd cordapp-netting-and-settlement
./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.
- PartyA:
http://localhost:10009
- PartyB:
http://localhost:10012
- PartyC:
http://localhost:10015
You'll see a basic page, listing all the API end-points and static web content. Click on the "nettingWeb" link under "static web content". The dashboard shows you a number of things:
- All trads to date
- A button to create new trade
- Click on the "Create Trade" button.
- Select the counterparty, enter in the sell value, sell currency, buy value, buy currency
- Click "Create Trade"
- Wait for the transaction confirmation
- After transaction message popup, click anywere
- The UI should update to reflect the new trade
- Navigate to the counterparties dashboard. You should see the same trade there
- Navigate to the counterparties dashboard
- Select the trade for creating the counter trade
- Click on the "Counter Trade" button
- Counter Trade popup will apper where the current trade is reversed as counter trade
- Click "Counter Trade"
- Wait for the transaction confirmation
- After transaction message popup, click anywere
- The UI should update to reflect the new trade
- Select the trade for viewing the transaction details
- Click on the "Transaction Details" button
- Transaction details popup will apper where the trade state is displayed in JSON format
- If the trade is already approved then we will have two states for the same trade
That's it!
Feel free to submit a PR.