mirror of
https://github.com/corda/corda.git
synced 2024-12-29 17:28:56 +00:00
485 lines
26 KiB
HTML
485 lines
26 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>Creating a Cordapp — 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="Running the demos" href="running-the-demos.html"/>
|
|
<link rel="prev" title="Persistence" href="persistence.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’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="merkle-trees.html">Transaction Tear-offs</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 current"><a class="current reference internal" href="#">Creating a Cordapp</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="#app-plugins">App Plugins</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#services">Services</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#starting-nodes">Starting Nodes</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#installing-apps">Installing Apps</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#starting-your-node">Starting your Node</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#debugging-your-node">Debugging your Node</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#viewing-persisted-state-of-your-node">Viewing persisted state of your Node</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#building-against-corda">Building Against Corda</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="#gradle-plugins-for-cordapps">Gradle Plugins for Cordapps</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="#building-gradle-plugins">Building Gradle Plugins</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#using-gradle-plugins">Using Gradle Plugins</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#template-build-gradle">Template build.gradle</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#cordformation">Cordformation</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="running-the-demos.html">Running the demos</a></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> »</li>
|
|
|
|
<li>Creating a Cordapp</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
|
|
|
|
<a href="_sources/creating-a-cordapp.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="creating-a-cordapp">
|
|
<h1>Creating a Cordapp<a class="headerlink" href="#creating-a-cordapp" title="Permalink to this headline">¶</a></h1>
|
|
<p>A Cordapp is an application that runs on the Corda platform using the platform APIs and plugin system. They are self
|
|
contained in separate JARs from the node server JAR that are created and distributed.</p>
|
|
<div class="section" id="app-plugins">
|
|
<h2>App Plugins<a class="headerlink" href="#app-plugins" title="Permalink to this headline">¶</a></h2>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">Currently apps are only supported for JVM languages.</p>
|
|
</div>
|
|
<p>To create an app plugin you must you must extend from <a class="reference external" href="api/com.r3corda.core.node/-corda-plugin-registry/index.html">CordaPluginRegistry</a>. The JavaDoc contains
|
|
specific details of the implementation, but you can extend the server in the following ways:</p>
|
|
<ol class="arabic simple">
|
|
<li>Required protocols: Specify which protocols will be whitelisted for use in your web APIs.</li>
|
|
<li>Service plugins: Register your services (see below).</li>
|
|
<li>Web APIs: You may register your own endpoints under /api/ of the built-in web server.</li>
|
|
<li>Static web endpoints: You may register your own static serving directories for serving web content.</li>
|
|
</ol>
|
|
</div>
|
|
<div class="section" id="services">
|
|
<h2>Services<a class="headerlink" href="#services" title="Permalink to this headline">¶</a></h2>
|
|
<p>Services are classes which are constructed after the node has started. It is provided a <a class="reference external" href="api/com.r3corda.node.services.api/-service-hub-internal/index.html">ServiceHubInternal</a> which
|
|
allows a richer API than the <a class="reference external" href="api/com.r3corda.node.services.api/-service-hub/index.html">ServiceHub</a> exposed to contracts. It enables adding protocols, registering
|
|
message handlers and more. The service does not run in a separate thread, so the only entry point to the service is during
|
|
construction, where message handlers should be registered and threads started.</p>
|
|
</div>
|
|
<div class="section" id="starting-nodes">
|
|
<h2>Starting Nodes<a class="headerlink" href="#starting-nodes" title="Permalink to this headline">¶</a></h2>
|
|
<p>To use an app you must also have a node server. To create a node server run the gradle installTemplateNodes task.</p>
|
|
<p>This will output the node JAR to <code class="docutils literal"><span class="pre">build/libs/corda.jar</span></code> and several sample/standard
|
|
node setups to <code class="docutils literal"><span class="pre">build/nodes</span></code>. For now you can use the <code class="docutils literal"><span class="pre">build/nodes/nodea</span></code> configuration as a template.</p>
|
|
<p>Each node server by default must have a <code class="docutils literal"><span class="pre">node.conf</span></code> file in the current working directory. After first
|
|
execution of the node server there will be many other configuration and persistence files created in a node workspace directory. This is specified as the basedir property of the node.conf file, or else can be overidden using <code class="docutils literal"><span class="pre">--base-directory=<workspace></span></code>.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">Outside of development environments do not store your node directories in the build folder.</p>
|
|
</div>
|
|
<div class="admonition warning">
|
|
<p class="first admonition-title">Warning</p>
|
|
<p class="last">Also note that the bootstrapping process of the <code class="docutils literal"><span class="pre">corda.jar</span></code> unpacks the Corda dependencies into a temporary folder. It is therefore suggested that the CAPSULE_CACHE_DIR environment variable be set before starting the process to control this location.</p>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="installing-apps">
|
|
<h2>Installing Apps<a class="headerlink" href="#installing-apps" title="Permalink to this headline">¶</a></h2>
|
|
<p>Once you have created your app JAR you can install it to a node by adding it to <code class="docutils literal"><span class="pre"><node_dir>/plugins/</span></code>. In this
|
|
case the <code class="docutils literal"><span class="pre">node_dir</span></code> is the location where your node server’s JAR and configuration file is.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">If the directory does not exist you can create it manually.</p>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="starting-your-node">
|
|
<h2>Starting your Node<a class="headerlink" href="#starting-your-node" title="Permalink to this headline">¶</a></h2>
|
|
<p>Now you have a node server with your app installed, you can run it by navigating to <code class="docutils literal"><span class="pre"><node_dir></span></code> and running</p>
|
|
<blockquote>
|
|
<div>java -jar corda.jar</div></blockquote>
|
|
<p>The plugin should automatically be registered and the configuration file used.</p>
|
|
<div class="admonition warning">
|
|
<p class="first admonition-title">Warning</p>
|
|
<p class="last">If your working directory is not <code class="docutils literal"><span class="pre"><node_dir></span></code> your plugins and configuration will not be used.</p>
|
|
</div>
|
|
<p>The configuration file and workspace paths can be overidden on the command line e.g.</p>
|
|
<p><code class="docutils literal"><span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">corda.jar</span> <span class="pre">--config-file=test.conf</span> <span class="pre">--base-directory=/opt/r3corda/nodes/test</span></code>.</p>
|
|
<p>Otherwise the workspace folder for the node is created based upon the <code class="docutils literal"><span class="pre">basedir</span></code> property in the <code class="docutils literal"><span class="pre">node.conf</span></code> file and if this is relative it is applied relative to the current working path.</p>
|
|
</div>
|
|
<div class="section" id="debugging-your-node">
|
|
<h2>Debugging your Node<a class="headerlink" href="#debugging-your-node" title="Permalink to this headline">¶</a></h2>
|
|
<p>To enable remote debugging of the corda process use a command line such as:</p>
|
|
<p><code class="docutils literal"><span class="pre">java</span> <span class="pre">-Dcapsule.jvm.args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"</span> <span class="pre">-jar</span> <span class="pre">corda.jar</span></code></p>
|
|
<p>This command line will start the debugger on port 5005 and pause the process awaiting debugger attachment.</p>
|
|
</div>
|
|
<div class="section" id="viewing-persisted-state-of-your-node">
|
|
<h2>Viewing persisted state of your Node<a class="headerlink" href="#viewing-persisted-state-of-your-node" title="Permalink to this headline">¶</a></h2>
|
|
<p>To make examining the persisted contract states of your node or the internal node database tables easier, and providing you are
|
|
using the default database configuration used for demos, you should be able to connect to the internal node database over
|
|
a JDBC connection at the URL that is output to the logs at node start up. That URL will be of the form <code class="docutils literal"><span class="pre">jdbc:h2:tcp://<host>:<port>/node</span></code>.</p>
|
|
<p>The user name and password for the login are as per the node data source configuration.</p>
|
|
<p>The name and column layout of the internal node tables is in a state of flux and should not be relied upon to remain static
|
|
at the present time, and should certainly be treated as read-only.</p>
|
|
</div>
|
|
<div class="section" id="building-against-corda">
|
|
<h2>Building Against Corda<a class="headerlink" href="#building-against-corda" title="Permalink to this headline">¶</a></h2>
|
|
<div class="admonition warning">
|
|
<p class="first admonition-title">Warning</p>
|
|
<p class="last">This feature is subject to rapid change</p>
|
|
</div>
|
|
<p>Corda now supports publishing to Maven local to build against it. To publish to Maven local run the following in the
|
|
root directory of Corda</p>
|
|
<div class="highlight-shell"><div class="highlight"><pre><span></span>./gradlew install
|
|
</pre></div>
|
|
</div>
|
|
<p>This will publish corda-$version.jar, finance-$version.jar, core-$version.jar and node-$version.jar to the
|
|
group com.r3corda. You can now depend on these as you normally would a Maven dependency.</p>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="gradle-plugins-for-cordapps">
|
|
<h1>Gradle Plugins for Cordapps<a class="headerlink" href="#gradle-plugins-for-cordapps" title="Permalink to this headline">¶</a></h1>
|
|
<p>There are several Gradle plugins that reduce your build.gradle boilerplate and make development of Cordapps easier.
|
|
The available plugins are in the gradle-plugins directory of the Corda repository.</p>
|
|
<div class="section" id="building-gradle-plugins">
|
|
<h2>Building Gradle Plugins<a class="headerlink" href="#building-gradle-plugins" title="Permalink to this headline">¶</a></h2>
|
|
<p>To install to your local Maven repository the plugins that Cordapp gradle files require, run the following from the
|
|
root of the Corda project:</p>
|
|
<div class="highlight-text"><div class="highlight"><pre><span></span>./gradlew install
|
|
</pre></div>
|
|
</div>
|
|
<p>The plugins will now be installed to your local Maven repository in ~/.m2 on Unix and %HOMEPATH%.m2 on Windows.</p>
|
|
</div>
|
|
<div class="section" id="using-gradle-plugins">
|
|
<h2>Using Gradle Plugins<a class="headerlink" href="#using-gradle-plugins" title="Permalink to this headline">¶</a></h2>
|
|
<p>To use the plugins, if you are not already using the Cordapp template project, you must modify your build.gradle. Add
|
|
the following segments to the relevant part of your build.gradle.</p>
|
|
</div>
|
|
<div class="section" id="template-build-gradle">
|
|
<h2>Template build.gradle<a class="headerlink" href="#template-build-gradle" title="Permalink to this headline">¶</a></h2>
|
|
<p>To build against Corda and the plugins that cordapps use, update your build.gradle to contain the following:</p>
|
|
<div class="highlight-groovy"><div class="highlight"><pre><span></span><span class="n">buildscript</span> <span class="o">{</span>
|
|
<span class="n">ext</span><span class="o">.</span><span class="na">corda_version</span> <span class="o">=</span> <span class="s1">'<enter the corda version you build against here>'</span>
|
|
<span class="o">...</span> <span class="n">your</span> <span class="n">buildscript</span> <span class="o">...</span>
|
|
|
|
<span class="n">repositories</span> <span class="o">{</span>
|
|
<span class="o">...</span> <span class="n">other</span> <span class="n">repositories</span> <span class="o">...</span>
|
|
<span class="n">mavenLocal</span><span class="o">()</span>
|
|
<span class="o">}</span>
|
|
|
|
<span class="n">dependencies</span> <span class="o">{</span>
|
|
<span class="o">...</span> <span class="n">your</span> <span class="n">dependencies</span> <span class="o">...</span>
|
|
<span class="n">classpath</span> <span class="s2">"com.r3corda.plugins:cordformation:$corda_version"</span>
|
|
<span class="n">classpath</span> <span class="s2">"com.r3corda.plugins:quasar-utils:$corda_version"</span>
|
|
<span class="n">classpath</span> <span class="s2">"com.r3corda.plugins:publish-utils:$corda_version"</span>
|
|
<span class="o">}</span>
|
|
<span class="o">}</span>
|
|
|
|
<span class="n">apply</span> <span class="nl">plugin:</span> <span class="s1">'com.r3corda.plugins.cordformation'</span>
|
|
<span class="n">apply</span> <span class="nl">plugin:</span> <span class="s1">'com.r3corda.plugins.quasar-utils'</span>
|
|
<span class="n">apply</span> <span class="nl">plugin:</span> <span class="s1">'com.r3corda.plugins.publish-utils'</span>
|
|
|
|
<span class="n">repositories</span> <span class="o">{</span>
|
|
<span class="n">mavenLocal</span><span class="o">()</span>
|
|
<span class="o">...</span> <span class="n">other</span> <span class="n">repositories</span> <span class="n">here</span> <span class="o">...</span>
|
|
<span class="o">}</span>
|
|
|
|
<span class="n">dependencies</span> <span class="o">{</span>
|
|
<span class="n">compile</span> <span class="s2">"com.r3corda:core:$corda_version"</span>
|
|
<span class="n">compile</span> <span class="s2">"com.r3corda:finance:$corda_version"</span>
|
|
<span class="n">compile</span> <span class="s2">"com.r3corda:node:$corda_version"</span>
|
|
<span class="n">compile</span> <span class="s2">"com.r3corda:corda:$corda_version"</span>
|
|
<span class="o">...</span> <span class="n">other</span> <span class="n">dependencies</span> <span class="n">here</span> <span class="o">...</span>
|
|
<span class="o">}</span>
|
|
|
|
<span class="o">...</span> <span class="n">your</span> <span class="n">tasks</span> <span class="o">...</span>
|
|
|
|
<span class="c1">// Sets the classes for Quasar to scan. Loaded by the the quasar-utils plugin.</span>
|
|
<span class="n">quasarScan</span><span class="o">.</span><span class="na">dependsOn</span><span class="o">(</span><span class="s1">'classes'</span><span class="o">,</span> <span class="o">...</span> <span class="n">your</span> <span class="n">dependent</span> <span class="n">subprojects</span><span class="o">...)</span>
|
|
|
|
<span class="c1">// Standard way to publish Cordapps to maven local with the maven-publish and publish-utils plugin.</span>
|
|
<span class="n">publishing</span> <span class="o">{</span>
|
|
<span class="n">publications</span> <span class="o">{</span>
|
|
<span class="n">jarAndSources</span><span class="o">(</span><span class="n">MavenPublication</span><span class="o">)</span> <span class="o">{</span>
|
|
<span class="n">from</span> <span class="n">components</span><span class="o">.</span><span class="na">java</span>
|
|
<span class="c1">// The two lines below are the tasks added by this plugin.</span>
|
|
<span class="n">artifact</span> <span class="n">sourceJar</span>
|
|
<span class="n">artifact</span> <span class="n">javadocJar</span>
|
|
<span class="o">}</span>
|
|
<span class="o">}</span>
|
|
<span class="o">}</span>
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="cordformation">
|
|
<h2>Cordformation<a class="headerlink" href="#cordformation" title="Permalink to this headline">¶</a></h2>
|
|
<p>Cordformation is the local node deployment system for Cordapps, the nodes generated are intended to be used for
|
|
experimenting, debugging, and testing node configurations and setups but not intended for production or testnet
|
|
deployment.</p>
|
|
<p>To use this gradle plugin you must add a new task that is of the type <code class="docutils literal"><span class="pre">com.r3corda.plugins.Cordform</span></code> to your
|
|
build.gradle and then configure the nodes you wish to deploy with the Node and nodes configuration DSL.
|
|
This DSL is specified in the <a class="reference external" href="api/index.html">JavaDoc</a>. An example of this is in the template-cordapp and below
|
|
is a three node example;</p>
|
|
<div class="highlight-text"><div class="highlight"><pre><span></span>task deployNodes(type: com.r3corda.plugins.Cordform, dependsOn: ['build']) {
|
|
directory "./build/nodes" // The output directory
|
|
networkMap "Controller" // The artemis address of the node named here will be used as the networkMapAddress on all other nodes.
|
|
node {
|
|
name "Controller"
|
|
dirName "controller"
|
|
nearestCity "London"
|
|
advertisedServices = [ "corda.notary.validating" ]
|
|
artemisPort 12345
|
|
webPort 12346
|
|
cordapps []
|
|
}
|
|
node {
|
|
name "NodeA"
|
|
dirName "nodea"
|
|
nearestCity "London"
|
|
advertisedServices = []
|
|
artemisPort 31337
|
|
webPort 31339
|
|
cordapps []
|
|
}
|
|
node {
|
|
name "NodeB"
|
|
dirName "nodeb"
|
|
nearestCity "New York"
|
|
advertisedServices = []
|
|
artemisPort 31338
|
|
webPort 31340
|
|
cordapps []
|
|
}
|
|
}
|
|
</pre></div>
|
|
</div>
|
|
<p>You can create more configurations with new tasks that extend Cordform.</p>
|
|
<p>New nodes can be added by simply adding another node block and giving it a different name, directory and ports. When you
|
|
run this task it will install the nodes to the directory specified and a script will be generated (for UNIX users only
|
|
at present) to run the nodes with one command.</p>
|
|
<p>Other cordapps can also be specified if they are already specified as classpath or compile dependencies in your
|
|
<code class="docutils literal"><span class="pre">build.gradle</span></code>.</p>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<footer>
|
|
|
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
|
|
|
<a href="running-the-demos.html" class="btn btn-neutral float-right" title="Running the demos" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
|
|
|
|
|
|
<a href="persistence.html" class="btn btn-neutral" title="Persistence" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
|
|
|
</div>
|
|
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<p>
|
|
© 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> |