mirror of
https://github.com/corda/corda.git
synced 2024-12-19 21:17:58 +00:00
Merged in rg_doc_changes_2 (pull request #500)
Changes from a doc review that were omitted in first PR, also changes from corda=samples repo
This commit is contained in:
commit
50415d2afa
@ -6,8 +6,8 @@ Corda is written in a language called `Kotlin <https://kotlinlang.org/>`_. Kotli
|
||||
and can be thought of as a simpler Scala, with much better Java interop. It is developed by and has commercial support
|
||||
from JetBrains, the makers of the IntelliJ IDE and other popular developer tools.
|
||||
|
||||
As Kotlin is relatively new language and is extremely easy to learn. It is designed as as better Java for industrial
|
||||
use and as such, the syntax was carefully designed to be readable even to people who don't know the language, after only
|
||||
Kotlin is a relatively new language and is extremely easy to learn. It is designed as a better Java for industrial
|
||||
use and, as such, the syntax was carefully designed to be readable even to people who don't know the language, after only
|
||||
a few minutes of introduction. Additionally, at R3, we find that all of our developers are up to productive writing speed
|
||||
in Kotlin within their first week.
|
||||
|
||||
|
@ -8,8 +8,8 @@ IntelliJ issues
|
||||
If IntelliJ complains about lack of an SDK
|
||||
******************************************
|
||||
|
||||
If on attempting to open the project (including importing Gradle project), IntelliJ refuses because SDK was not selected,
|
||||
you may need to fix the project structure. Do this by following `these instructions<https://www.jetbrains.com/help/idea/2016.2/configuring-global-project-and-module-sdks.html>`_. The correct JDK is often found at a path such as ``jdk1.8.0_xx…/Contents/Home``
|
||||
If on attempting to open the project (including importing Gradle project), IntelliJ refuses because an SDK was not selected,
|
||||
you may need to fix the project structure. Do this by following `these instructions <https://www.jetbrains.com/help/idea/2016.2/configuring-global-project-and-module-sdks.html>`_. The correct JDK is often found at a path such as ``jdk1.8.0_xx…/Contents/Home``
|
||||
|
||||
Ensure that you have the Project language level set at as 8. If you are having trouble selecting the correct JDK, the
|
||||
Jetbrains website offers the `following guidelines <https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under>`_.
|
||||
@ -22,7 +22,7 @@ Installation
|
||||
|
||||
There are two ways to configure Kotlin from IntelliJ. One way is via the initial project opening screen in which you will
|
||||
need to use the ``Configure > Plugins`` tab. The other way is when you are in an open project, then you will need to
|
||||
configure it via (on Mac) ``IntelliJ -> Preferences ...``, where on PC it is ``File -> Settings``. Select the plugins
|
||||
configure it via (on Mac) ``IntelliJ -> Preferences ...``, whereas on PC it is ``File -> Settings``. Select the plugins
|
||||
bar, confirm that Kotlin is installed and up to date.
|
||||
|
||||
If you are having trouble installing Kotlin, first try upgrading the Kotlin plugin. At the time of writing, you can
|
||||
@ -32,6 +32,9 @@ confirm what is the latest version of the Kotlin plugin on `this page <https://p
|
||||
Gradle issues
|
||||
-------------
|
||||
|
||||
Gradle within IntelliJ
|
||||
**********************
|
||||
|
||||
After you have updated your code to the latest version from git, ensure that the gradle project is imported. Although
|
||||
gradle is used via the command line, it is also integrated with IntelliJ in order for IntelliJ to determine dependencies
|
||||
and index the project correctly.
|
||||
@ -40,22 +43,33 @@ When opening a project for the first time, you should see the "Unlinked Gradle p
|
||||
right corner or in a popup alert window. If you miss this, it will also appear in the "Event Log" windows which can be
|
||||
opened by clicking on "Event Log" at the bottom right of the IntelliJ window. Either way, click on "Import Gradle Project".
|
||||
|
||||
.. image:: unlinked-gradle.png
|
||||
.. image:: resources/unlinked-gradle.png
|
||||
:height: 50 px
|
||||
:width: 410 px
|
||||
:alt: IntelliJ Gradle Prompt
|
||||
|
||||
Wait for it to think and download the dependencies. After that you might have another popup titled "Unindexed remote maven repositories found." This is general IntelliJ question and doesn't affect Corda, therefore you can decided to index them or not.
|
||||
|
||||
Next click on "green arrow" next to "All tests" pop-up on the top toolbar.
|
||||
Wait for it to think and download the dependencies. After that you might have another popup titled "Unindexed remote maven repositories found." This is a general IntelliJ question and doesn't affect Corda, therefore you can decided to index them or not. Next click on the "green arrow" next to "All tests" pop-up on the top toolbar.
|
||||
|
||||
The code should build, the unit tests should show as all green.
|
||||
|
||||
If still have problems, the Jetbrains website has more information on `gradle here <https://www.jetbrains.com/help/idea/2016.2/working-with-gradle-projects.html>`_.
|
||||
|
||||
Gradle via the CLI
|
||||
******************
|
||||
|
||||
Gradle commands can also be run in the command line - further details of command line gradle can be found in
|
||||
|
||||
.. TODO: add gradle cmd line doc link here
|
||||
|
||||
Doing it without IntelliJ
|
||||
-------------------------
|
||||
|
||||
If you don't want to explore or modify the code in a local IDE, you can also just use the command line and a text editor:
|
||||
* First run ``git clone TODO:Corda_repo_name_here`` to download Corda source code.
|
||||
* Next ensure that you are in r3repository ``cd r3repository`` // TODO - change to be correct location
|
||||
|
||||
* First run ``git clone https://github.com/corda/corda`` to download Corda core source code
|
||||
|
||||
* Next ensure that you are in correct directory ``cd corda``
|
||||
|
||||
* Then you can run ``./gradlew test`` to run the unit tests.
|
||||
|
||||
* Finally remember to run ``git pull`` occasionally to upgrade the source code to the latest revision
|
||||
|
@ -43,7 +43,6 @@ git configuration are quite seemless although the first time you use it, you wil
|
||||
of your git command installation. More details regarding this can be found
|
||||
on the `JetBrains website <https://www.jetbrains.com/help/idea/2016.2/using-git-integration.html>`_
|
||||
|
||||
|
||||
Gradle
|
||||
------
|
||||
|
||||
@ -53,7 +52,6 @@ on the gradle tab (generally found on the right hand side), or by following the
|
||||
are performing (details expounded later). Whenever prompted about gradle, accept the defaults suggested by IntelliJ.
|
||||
|
||||
|
||||
|
||||
Corda Source Code
|
||||
-----------------
|
||||
|
||||
|
@ -30,7 +30,6 @@ Read on to learn:
|
||||
inthebox
|
||||
getting-set-up
|
||||
running-the-demos
|
||||
initialmarginagreement
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
@ -77,6 +76,7 @@ Read on to learn:
|
||||
|
||||
network-simulator
|
||||
node-explorer
|
||||
initial-margin-agreement
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
BIN
docs/source/resources/unlinked-gradle.png
Normal file
BIN
docs/source/resources/unlinked-gradle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
63
samples/simm-valuation-demo/README.md
Normal file
63
samples/simm-valuation-demo/README.md
Normal file
@ -0,0 +1,63 @@
|
||||
# SIMM Valuation Demo
|
||||
|
||||
## Introduction and Background
|
||||
|
||||
See our documentation regarding the SIMM valuation and agreement on a distributed ledger
|
||||
|
||||
.. TODO: main_doc_site_link
|
||||
|
||||
This demo allows you to trade swaps - a type of financial product - with another counterparty. Once several swaps have been traded, the demo shows how a process can be run in order to generate what is known as the Standard Initial Margin. This is a payment made from one counterparty to the other so that in the event of a default (ie non payment of the overall value of the contract), the receiving counterparty has received sufficient cash to purchase replacement contracts in the market (hopefully preventing a domino effect associated with the global financial crisis of 2007 and 2008)
|
||||
|
||||
This demo does not, however, include real SIMM valuation code but a stub for the OpenGamma set of libraries (see below), so please do not base any financial decisions on results generated by this demo.
|
||||
|
||||
## Preparation / Building
|
||||
|
||||
You will need to build the core Corda component libraries and ensure they have been installed into your local maven repository. Do this by following the instructions if you haven't done this already.
|
||||
|
||||
.. TODO: Link Instructions when finalised
|
||||
|
||||
Once they are available, you will need to run (in the directory containing the samples repo)
|
||||
|
||||
./gradle deployNodes
|
||||
|
||||
which will compile all of the demos in this project, create the web framework and generate test nodes for this demonstration
|
||||
|
||||
|
||||
## Startup
|
||||
|
||||
This demo is best run via the command line and a web browser, although it can be run via IntelliJ for debugging purposes.
|
||||
|
||||
Change directory to `simm-valuation-demo/build/nodes` and execute the `runnodes` script. This will start four nodes - a notary node and three bank nodes. Wait until the message TODO: _when logging output changes completed_ appears and then all of the nodes will be ready for interaction.
|
||||
|
||||
## Interacting
|
||||
|
||||
The demo shows a simple web front end with both a trade entry and a portfolio view. The simple portfolio view is filtered by the counterparty selected.
|
||||
|
||||
Start by browsing [here](http://localhost:10005/web/simmvaluationdemo/) . This is the home page for Bank A (as determined in the top right corner). In the dropdown titled "Select a counterparty", choose the party you wish to transact with, in our case "Bank B". Click the "Create New Trade" function in the top menu bar. Choose any convention for the swap (the top one - EUR fixed 1Y EURIBOR 3M - works well). Feel free to amend any of the new deal parameters. Lastly, click the Submit bar to send your completed trade to the other counterparty. Once you are taken to the "view-trade" page, then that trade has been sent across the network to the other node, signed and sent back and then signed by your node, committing it to the Corda ledger. At this stage, you can optionally verify that the trade exists on the other node by visiting [Bank B's node](http://localhost:10007/web/simmvaluationdemo/). Additionally, you can confirm that these trades are not visible from [Bank C's node](http://localhost:10009/web/simmvaluationdemo/).
|
||||
|
||||
Once the portfolio has some trades, you can start the valuation and agreement flow. Do this by clicking the "Agree Valuations" tab and then the "Start Calculations" button. The flow will execute and then the web page will demonstrate a simulation of the agreement as it proceeds. Eventually, the flow will complete with the Initial Margin figures being agreed by and then signed by both nodes. For more details on exactly what is happening here, please see the link in the Introduction and Background section.
|
||||
|
||||
Please note that any URL text after `simmvaluationdemo` should not be bookmarked or navigated directly to as they are only for aesthetics.
|
||||
|
||||
### Shutting down
|
||||
|
||||
The script to start the nodes has been written such that when you press a key in the window the script is running, the nodes will close down.
|
||||
|
||||
## SIMM Library Licensing
|
||||
|
||||
This demo was built in partnership with OpenGamma and used their SIMM library. However, due to licensing constraints we cannot distribute their library with this code. For this reason, we have stubbed out the relevant parts and replaced it with a very simplistic template that returns fake (but correctly structured) data. However, if you wish to use a realistic library, then please do get in touch with OpenGamma directly for access to their libraries and we will be happy to demonstrate how to replace the stub code.
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Error | Fix |
|
||||
|-------|------ |
|
||||
| Could not find net.corda.(...):(...):0.6-SNAPSHOT | The corda libraries have not been installed into your local maven directory. View the instructions for doing this in the core corda repository |
|
||||
| Execution failed for task ':simm-valuation-demo:buildWeb' : A problem occurred starting process 'command 'ng'' | You need to have `node packet manager` installed in order to build out some of the web resources. This is not a necessary step as we include pre-built web resources but if you do modify the web source, you will need to rebuild this area |
|
||||
|
||||
.. TODO: expand upon how the the web site is built
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user