corda/docs/build/html/running-the-demos.html
2016-11-07 17:57:02 +01:00

445 lines
23 KiB
HTML

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Running the demos &mdash; R3 Corda latest documentation</title>
<link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
<link rel="top" title="R3 Corda latest documentation" href="index.html"/>
<link rel="next" title="Node administration" href="node-administration.html"/>
<link rel="prev" title="Creating a Cordapp" href="creating-a-cordapp.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> R3 Corda
</a>
<div class="version">
latest
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<br>
<a href="api/index.html">API reference</a>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Overview</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="inthebox.html">What&#8217;s included?</a></li>
<li class="toctree-l1"><a class="reference internal" href="getting-set-up.html">Getting set up</a></li>
<li class="toctree-l1"><a class="reference internal" href="data-model.html">Data model</a></li>
<li class="toctree-l1"><a class="reference internal" href="transaction-data-types.html">Data types</a></li>
<li class="toctree-l1"><a class="reference internal" href="consensus.html">Consensus model</a></li>
<li class="toctree-l1"><a class="reference internal" href="messaging.html">Networking and messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="persistence.html">Persistence</a></li>
<li class="toctree-l1"><a class="reference internal" href="creating-a-cordapp.html">Creating a Cordapp</a></li>
<li class="toctree-l1"><a class="reference internal" href="creating-a-cordapp.html#gradle-plugins-for-cordapps">Gradle Plugins for Cordapps</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Running the demos</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#trader-demo">Trader demo</a></li>
<li class="toctree-l2"><a class="reference internal" href="#irs-demo">IRS demo</a></li>
<li class="toctree-l2"><a class="reference internal" href="#irs-web-demo">IRS web demo</a></li>
<li class="toctree-l2"><a class="reference internal" href="#attachment-demo">Attachment demo</a></li>
<li class="toctree-l2"><a class="reference internal" href="#simm-and-portfolio-demo">SIMM and Portfolio Demo</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="node-administration.html">Node administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="corda-configuration-files.html">The Corda Configuration File</a></li>
<li class="toctree-l1"><a class="reference internal" href="corda-configuration-files.html#rpc-users-file">RPC Users File</a></li>
</ul>
<p class="caption"><span class="caption-text">Tutorials</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="where-to-start.html">Where to start</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-contract.html">Writing a contract</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-contract-clauses.html">Writing a contract using clauses</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-test-dsl.html">Writing a contract test</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-clientrpc-api.html">Client RPC API</a></li>
<li class="toctree-l1"><a class="reference internal" href="protocol-state-machines.html">Protocol state machines</a></li>
<li class="toctree-l1"><a class="reference internal" href="oracles.html">Writing oracle services</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-attachments.html">Using attachments</a></li>
<li class="toctree-l1"><a class="reference internal" href="event-scheduling.html">Event scheduling</a></li>
</ul>
<p class="caption"><span class="caption-text">Contracts</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="contract-catalogue.html">Contract catalogue</a></li>
<li class="toctree-l1"><a class="reference internal" href="contract-irs.html">Interest Rate Swaps</a></li>
<li class="toctree-l1"><a class="reference internal" href="initialmarginagreement.html">Initial Margin Agreements</a></li>
</ul>
<p class="caption"><span class="caption-text">Node API</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="clientrpc.html">Client RPC</a></li>
</ul>
<p class="caption"><span class="caption-text">Appendix</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="secure-coding-guidelines.html">Secure coding guidelines</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-process.html">Release process</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-process.html#steps-to-cut-a-release">Steps to cut a release</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="network-simulator.html">Network Simulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="node-explorer.html">Node Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="codestyle.html">Code style guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="building-the-docs.html">Building the documentation</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">R3 Corda</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>Running the demos</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/running-the-demos.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="running-the-demos">
<h1>Running the demos<a class="headerlink" href="#running-the-demos" title="Permalink to this headline"></a></h1>
<p>The repository contains a small number of demo programs that run two-node networks, demonstrating functionality developed
so far. We have:</p>
<ol class="arabic simple">
<li>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 <a class="reference internal" href="protocol-state-machines.html"><span class="doc">Protocol state machines</span></a>.</li>
<li>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.</li>
<li>The IRS demo web interface - a web interface to the IRS demo.</li>
</ol>
<p>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.</p>
<div class="section" id="trader-demo">
<h2>Trader demo<a class="headerlink" href="#trader-demo" title="Permalink to this headline"></a></h2>
<p>Open two terminals, and in the first run:</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you are planning to use non-default configuration you will need to run with &#8211;role=SetupA and &#8211;role=SetupB
beforehand with the same parameters you plan to supply to the respective nodes.</p>
</div>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>gradlew.bat &amp; .\build\install\r3prototyping\bin\trader-demo --role=BUYER
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">gradlew</span> <span class="n">installDist</span> <span class="p">&amp;&amp;</span> <span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">trader</span><span class="p">-</span><span class="n">demo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">BUYER</span>
</pre></div>
</div>
<p>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.</p>
<p>In the second terminal, run:</p>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>.\build\install\r3prototyping\bin\trader-demo --role=SELLER
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">trader</span><span class="p">-</span><span class="n">demo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">SELLER</span>
</pre></div>
</div>
<p>You should see some log lines scroll past, and within a few seconds the messages &#8220;Purchase complete - we are a
happy customer!&#8221; and &#8220;Sale completed - we have a happy customer!&#8221; should be printed.</p>
<p>If it doesn&#8217;t work, jump on the mailing list and let us know.</p>
</div>
<div class="section" id="irs-demo">
<h2>IRS demo<a class="headerlink" href="#irs-demo" title="Permalink to this headline"></a></h2>
<p>Open three terminals. In the first run:</p>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>gradlew.bat installDist &amp; .\build\install\r3prototyping\bin\irsdemo.bat --role=NodeA
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">gradlew</span> <span class="n">installDist</span> <span class="p">&amp;&amp;</span> <span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">irsdemo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">NodeA</span>
</pre></div>
</div>
<p>And in the second run:</p>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>.\build\install\r3prototyping\bin\irsdemo.bat --role=NodeB
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">irsdemo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">NodeB</span>
</pre></div>
</div>
<p>NodeB also doubles up as the interest rates oracle and you should see some rates data get loaded.</p>
<p>Now in the third terminal run:</p>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>.\build\install\r3prototyping\bin\irsdemo.bat --role=Trade trade1
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">irsdemo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">Trade</span> <span class="n">trade1</span>
</pre></div>
</div>
<p>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
can see the other terminals whilst you run this command!:</p>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>.\build\install\r3prototyping\bin\irsdemo.bat --role=Date 2017-01-30
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">irsdemo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">Date</span> <span class="m">2017</span><span class="p">-</span><span class="m">01</span><span class="p">-</span><span class="m">30</span>
</pre></div>
</div>
</div>
<div class="section" id="irs-web-demo">
<h2>IRS web demo<a class="headerlink" href="#irs-web-demo" title="Permalink to this headline"></a></h2>
<p>To install the web demo please follow these steps;</p>
<ol class="arabic simple">
<li>Install Node: <a class="reference external" href="https://nodejs.org/en/download/">https://nodejs.org/en/download/</a> and ensure the npm executable is on your classpath</li>
<li>Open a terminal</li>
<li>Run <cite>npm install -g bower</cite> or <cite>sudo npm install -g bower</cite> if on a Unix system.</li>
<li>In the terminal navigate to <cite>&lt;corda&gt;/src/main/resources/com/r3corda/demos/irswebdemo</cite></li>
<li>Run <cite>bower install</cite></li>
</ol>
<p>To run the web demo, run the first two steps from the IRS Demo:</p>
<p>Open two terminals and in the first:</p>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>gradlew.bat installDist &amp; .\build\install\r3prototyping\bin\irsdemo.bat --role=NodeA
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">gradlew</span> <span class="n">installDist</span> <span class="p">&amp;&amp;</span> <span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">irsdemo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">NodeA</span>
</pre></div>
</div>
<p>And in the second run:</p>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>.\build\install\r3prototyping\bin\irsdemo.bat --role=NodeB
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">irsdemo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">NodeB</span>
</pre></div>
</div>
<p>Now open your web browser to this URL:</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If using a custom node port address or port those must be used instead.</p>
</div>
<p><strong>Node A</strong>:</p>
<blockquote>
<div><a class="reference external" href="http://localhost:31338/web/irsdemo">http://localhost:31338/web/irsdemo</a></div></blockquote>
<p><strong>Node B</strong>:</p>
<blockquote>
<div><a class="reference external" href="http://localhost:31340/web/irsdemo">http://localhost:31340/web/irsdemo</a></div></blockquote>
<p>To use the demos click the &#8220;Create Deal&#8221; button, fill in the form, then click the &#8220;Submit&#8221; 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.</p>
</div>
<div class="section" id="attachment-demo">
<h2>Attachment demo<a class="headerlink" href="#attachment-demo" title="Permalink to this headline"></a></h2>
<p>Open two terminals, and in the first run:</p>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>gradlew.bat &amp; .\build\install\r3prototyping\bin\attachment-demo --role=RECIPIENT
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">gradlew</span> <span class="n">installDist</span> <span class="p">&amp;&amp;</span> <span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">attachment</span><span class="p">-</span><span class="n">demo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">RECIPIENT</span>
</pre></div>
</div>
<p>It will compile things, if necessary, then create a directory named attachment-demo/buyer with a bunch of files inside and
start the node. You should see it waiting for a trade to begin.</p>
<p>In the second terminal, run:</p>
<p><strong>Windows</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span>.\build\install\r3prototyping\bin\attachment-demo --role=SENDER
</pre></div>
</div>
<p><strong>Other</strong>:</p>
<div class="highlight-kotlin"><div class="highlight"><pre><span></span><span class="p">./</span><span class="n">build</span><span class="p">/</span><span class="n">install</span><span class="p">/</span><span class="n">r3prototyping</span><span class="p">/</span><span class="n">bin</span><span class="p">/</span><span class="n">attachment</span><span class="p">-</span><span class="n">demo</span> <span class="p">--</span><span class="n">role</span><span class="p">=</span><span class="n">SENDER</span>
</pre></div>
</div>
<p>You should see some log lines scroll past, and within a few seconds the message &#8220;File received - we&#8217;re happy!&#8221; should be printed.</p>
</div>
<div class="section" id="simm-and-portfolio-demo">
<h2>SIMM and Portfolio Demo<a class="headerlink" href="#simm-and-portfolio-demo" title="Permalink to this headline"></a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Read more about this demo at <a class="reference internal" href="initialmarginagreement.html"><span class="doc">Initial Margin Agreements</span></a>.</p>
</div>
<p>To run the demo run:</p>
<p><strong>Windows</strong></p>
<p>Open a terminal window and navigate to the root directory of Corda and run:</p>
<div class="highlight-shell"><div class="highlight"><pre><span></span>gradlew apps:vega:installTemplateNodes
<span class="nb">cd</span> build<span class="se">\n</span>odes<span class="se">\n</span>ameserver
java -jar corda.jar
</pre></div>
</div>
<p>Now open another terminal in the root directory of Corda and run:</p>
<div class="highlight-shell"><div class="highlight"><pre><span></span><span class="nb">cd</span> build<span class="se">\n</span>odes<span class="se">\n</span>odea
java -jar corda.jar
</pre></div>
</div>
<p>Now open a third terminal in the root directory of Corda and run:</p>
<div class="highlight-shell"><div class="highlight"><pre><span></span><span class="nb">cd</span> build<span class="se">\n</span>odes<span class="se">\n</span>odeb
java -jar corda.jar
</pre></div>
</div>
<p><strong>Other</strong></p>
<p>Open one terminal window and run the following commands from the root directory of Corda:</p>
<div class="highlight-shell"><div class="highlight"><pre><span></span>./gradlew apps:vega:installTemplateNodes
<span class="nb">cd</span> build/nodes
./runnodes
</pre></div>
</div>
<p>Now open <a class="reference external" href="http://localhost:31339/web/vega">http://localhost:31339/web/vega</a> and <a class="reference external" href="http://localhost:31340/web/vega">http://localhost:31340/web/vega</a> to view the two nodes that this
will have started respectively.</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="node-administration.html" class="btn btn-neutral float-right" title="Node administration" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="creating-a-cordapp.html" class="btn btn-neutral" title="Creating a Cordapp" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2016, Distributed Ledger Group, LLC.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'latest',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>