2016-04-18 17:44:21 +00:00
|
|
|
Running the demos
|
|
|
|
=================
|
|
|
|
|
|
|
|
The repository contains a small number of demo programs that run two-node networks, demonstrating functionality developed
|
|
|
|
so far. We have:
|
|
|
|
|
|
|
|
1. The trader demo, which shows a delivery-vs-payment atomic swap of commercial paper for cash. You can learn more about
|
|
|
|
how this works in :doc:`protocol-state-machines`.
|
|
|
|
2. The IRS demo, which shows two nodes establishing an interest rate swap between them and performing fixings with a
|
|
|
|
rates oracle, all driven via the HTTP API.
|
2016-07-13 15:43:13 +00:00
|
|
|
3. The IRS demo web interface - a web interface to the IRS demo.
|
2016-04-18 17:44:21 +00:00
|
|
|
|
|
|
|
The demos create node data directories in the root of the project. If something goes wrong with them, blow away the
|
|
|
|
directories and try again.
|
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
.. note:: Corda is developed on MacOS and works best on UNIX systems. Both demos are easily run on Windows but
|
|
|
|
you won't get the nice coloured output.
|
2016-05-24 11:48:35 +00:00
|
|
|
|
2016-04-18 17:44:21 +00:00
|
|
|
Trader demo
|
|
|
|
-----------
|
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
Open two terminals, and in the first run:
|
2016-05-24 11:48:35 +00:00
|
|
|
|
2016-06-06 14:23:32 +00:00
|
|
|
.. note:: If you are planning to use non-default configuration you will need to run with --role=SetupA and --role=SetupB
|
|
|
|
beforehand with the same parameters you plan to supply to the respective nodes.
|
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
**Windows**::
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
gradlew.bat & .\build\install\r3prototyping\bin\trader-demo --role=BUYER
|
|
|
|
|
|
|
|
**Other**::
|
|
|
|
|
2016-07-25 10:55:23 +00:00
|
|
|
./gradlew installDist && ./build/install/r3prototyping/bin/trader-demo --role=BUYER
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-05-16 17:06:55 +00:00
|
|
|
It will compile things, if necessary, then create a directory named trader-demo/buyer with a bunch of files inside and
|
|
|
|
start the node. You should see it waiting for a trade to begin.
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
In the second terminal, run:
|
|
|
|
|
|
|
|
**Windows**::
|
|
|
|
|
|
|
|
.\build\install\r3prototyping\bin\trader-demo --role=SELLER
|
|
|
|
|
|
|
|
**Other**::
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-05-24 11:48:35 +00:00
|
|
|
./build/install/r3prototyping/bin/trader-demo --role=SELLER
|
2016-04-18 17:44:21 +00:00
|
|
|
|
|
|
|
You should see some log lines scroll past, and within a few seconds the messages "Purchase complete - we are a
|
|
|
|
happy customer!" and "Sale completed - we have a happy customer!" should be printed.
|
|
|
|
|
|
|
|
If it doesn't work, jump on the mailing list and let us know.
|
|
|
|
|
|
|
|
|
|
|
|
IRS demo
|
|
|
|
--------
|
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
Open three terminals. In the first run:
|
|
|
|
|
|
|
|
**Windows**::
|
2016-05-24 11:48:35 +00:00
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
gradlew.bat installDist & .\build\install\r3prototyping\bin\irsdemo.bat --role=NodeA
|
|
|
|
|
|
|
|
**Other**::
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-06-06 11:30:59 +00:00
|
|
|
./gradlew installDist && ./build/install/r3prototyping/bin/irsdemo --role=NodeA
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
And in the second run:
|
|
|
|
|
|
|
|
**Windows**::
|
|
|
|
|
2016-06-06 11:30:59 +00:00
|
|
|
.\build\install\r3prototyping\bin\irsdemo.bat --role=NodeB
|
2016-06-06 09:46:33 +00:00
|
|
|
|
|
|
|
**Other**::
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-06-01 17:49:24 +00:00
|
|
|
./build/install/r3prototyping/bin/irsdemo --role=NodeB
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-06-30 09:52:31 +00:00
|
|
|
NodeB also doubles up as the interest rates oracle and you should see some rates data get loaded.
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
Now in the third terminal run:
|
|
|
|
|
|
|
|
**Windows**::
|
|
|
|
|
|
|
|
.\build\install\r3prototyping\bin\irsdemo.bat --role=Trade trade1
|
|
|
|
|
|
|
|
**Other**::
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-06-01 17:49:24 +00:00
|
|
|
./build/install/r3prototyping/bin/irsdemo --role=Trade trade1
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-05-24 11:48:35 +00:00
|
|
|
You should see some activity in the other two terminals as they set up the deal. You can now run this command in
|
|
|
|
a separate window to roll the fake clock forward and trigger lots of fixing events. Things go fast so make sure you
|
2016-06-06 09:46:33 +00:00
|
|
|
can see the other terminals whilst you run this command!:
|
|
|
|
|
|
|
|
**Windows**::
|
|
|
|
|
|
|
|
.\build\install\r3prototyping\bin\irsdemo.bat --role=Date 2017-01-30
|
|
|
|
|
|
|
|
**Other**::
|
2016-04-18 17:44:21 +00:00
|
|
|
|
2016-06-06 09:46:33 +00:00
|
|
|
./build/install/r3prototyping/bin/irsdemo --role=Date 2017-01-30
|
2016-07-13 15:43:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
IRS web demo
|
|
|
|
------------
|
|
|
|
|
2016-07-22 11:44:42 +00:00
|
|
|
To install the web demo please follow these steps;
|
2016-07-18 13:39:22 +00:00
|
|
|
|
|
|
|
1. Install Node: https://nodejs.org/en/download/ and ensure the npm executable is on your classpath
|
|
|
|
2. Open a terminal
|
2016-07-19 08:24:39 +00:00
|
|
|
3. Run `npm install -g bower` or `sudo npm install -g bower` if on a *nix system.
|
2016-07-28 08:26:47 +00:00
|
|
|
4. In the terminal navigate to `<corda>/src/main/resources/com/r3corda/demos/irswebdemo`
|
2016-07-18 13:39:22 +00:00
|
|
|
5. Run `bower install`
|
|
|
|
|
2016-07-13 15:43:13 +00:00
|
|
|
To run the web demo, run the first two steps from the IRS Demo:
|
|
|
|
|
|
|
|
Open two terminals and in the first:
|
|
|
|
|
|
|
|
**Windows**::
|
|
|
|
|
|
|
|
gradlew.bat installDist & .\build\install\r3prototyping\bin\irsdemo.bat --role=NodeA
|
|
|
|
|
|
|
|
**Other**::
|
|
|
|
|
|
|
|
./gradlew installDist && ./build/install/r3prototyping/bin/irsdemo --role=NodeA
|
|
|
|
|
|
|
|
And in the second run:
|
|
|
|
|
|
|
|
**Windows**::
|
|
|
|
|
|
|
|
.\build\install\r3prototyping\bin\irsdemo.bat --role=NodeB
|
|
|
|
|
|
|
|
**Other**::
|
|
|
|
|
|
|
|
./build/install/r3prototyping/bin/irsdemo --role=NodeB
|
|
|
|
|
|
|
|
Now open your web browser to this URL:
|
|
|
|
|
|
|
|
.. note:: If using a custom node port address or port those must be used instead.
|
|
|
|
|
|
|
|
**Node A**:
|
|
|
|
|
2016-07-25 09:53:38 +00:00
|
|
|
http://localhost:31338/web/irsdemo
|
2016-07-13 15:43:13 +00:00
|
|
|
|
|
|
|
**Node B**:
|
|
|
|
|
2016-07-25 09:53:38 +00:00
|
|
|
http://localhost:31340/web/irsdemo
|
2016-07-13 15:43:13 +00:00
|
|
|
|
|
|
|
To use the demos click the "Create Deal" button, fill in the form, then click the "Submit" button. Now you will be
|
|
|
|
able to use the time controls at the top left of the home page to run the fixings. Click any individual trade in the
|
|
|
|
blotter to view it.
|