Fix bank of corda demo (#787)

* Small fix in Bank Of Corda demo, move Notary to Zurich so it's better displayed.
Add CashExitFlow permission to Bank Of Corda node.

* Changes in running-the-demos documentation.
This commit is contained in:
Katarzyna Streich 2017-06-06 12:01:32 +01:00
parent e892181bd6
commit e0650ba205
3 changed files with 18 additions and 21 deletions

View File

@ -10,12 +10,10 @@ Corda's functionality:
3. The Attachment Demo, which demonstrates uploading attachments to nodes
4. The SIMM Valuation Demo, which shows two nodes agreeing on a portfolio and valuing the initial margin
using the Standard Initial Margin Model
5. The Distributed Notary Demo, which shows a single node getting multiple transactions notarised by a distributed (Raft-based) notary
5. The Notary Demo, which shows three different types of notaries and a single node getting multiple transactions notarised.
6. The Bank of Corda Demo, which shows a node acting as an issuer of assets (the Bank of Corda) while remote client
applications request issuance of some cash on behalf of a node called Big Corporation
We recommend running the demos from the command line rather than from IntelliJ. For more details about running via the command line or from within IntelliJ, see :doc:`CLI-vs-IDE`.
If any of the demos don't work, please raise an issue on GitHub.
.. note:: If you are running the demos from the command line in Linux (but not macOS), you may have to install xterm.
@ -64,8 +62,8 @@ To run from the command line in Unix:
5. Run ``./install/irs-demo/bin/irs-demo --role UploadRates``. You should see a
message be printed to the first node (the notary/oracle/network map node) saying that it has accepted the new
interest rates
6. Now run ``./install/irs-demo/bin/irs-demo --role Trade 1``. The number is a trade ID. You should
see lots of activity as the nodes set up the deal, notarise it, get it signed by the oracle, and so on
6. Now run ``./install/irs-demo/bin/irs-demo --role Trade 1``. The number is a trade ID. If you enter in node's terminal
``run stateMachinesAndUpdates`` you should see lots of activity as the nodes set up the deal, notarise it, get it signed by the oracle, and so on
7. Now run ``./install/irs-demo/bin/irs-demo --role Date 2017-12-12`` to roll the simulated clock forward and see some fixings take place
To run from the command line in Windows:
@ -77,8 +75,8 @@ To run from the command line in Windows:
5. Run ``install\irs-demo\bin\irs-demo --role UploadRates``. You should see a
message be printed to the first node (the notary/oracle/network map node) saying that it has accepted the new
interest rates
6. Now run ``install\irs-demo\bin\irs-demo --role Trade 1``. The number is a trade ID. You should
see lots of activity as the nodes set up the deal, notarise it, get it signed by the oracle, and so on
6. Now run ``install\irs-demo\bin\irs-demo --role Trade 1``. The number is a trade ID. If you enter in node's terminal
``run stateMachinesAndUpdates`` you should see lots of activity as the nodes set up the deal, notarise it, get it signed by the oracle, and so on
7. Now run ``install\irs-demo\bin\irs-demo --role Date 2017-12-12`` to roll the simulated clock forward and see some fixings take place
This demo also has a web app. To use this, run nodes and upload rates, then navigate to
@ -125,7 +123,7 @@ You will notice that successive transactions get signed by different members of
To run the Raft version of the demo from the command line in Unix:
1. Run ``./gradlew samples:notary-demo:deployNodes``, which will create all three types of notaries' node directories
with configs under ``samples/notary-demo/build/nodes/nodesRaft`` (``nodesBFT`` and ``nodesSingle`` for BFT and Single notaries).
with configs under ``samples/notary-demo/build/nodes/nodesRaft`` (``nodesBFT`` and ``nodesSingle`` for BFT and Single notaries).
2. Run ``./samples/notary-demo/build/nodes/nodesRaft/runnodes``, which will start the nodes in separate terminal windows/tabs.
Wait until a "Node started up and registered in ..." message appears on each of the terminals
3. Run ``./gradlew samples:notary-demo:notarise`` to make a call to the "Party" node to initiate notarisation requests
@ -134,7 +132,7 @@ with configs under ``samples/notary-demo/build/nodes/nodesRaft`` (``nodesBFT`` a
To run from the command line in Windows:
1. Run ``gradlew samples:notary-demo:deployNodes``, which will create all three types of notaries' node directories
with configs under ``samples/notary-demo/build/nodes/nodesRaft`` (``nodesBFT`` and ``nodesSingle`` for BFT and Single notaries).
with configs under ``samples/notary-demo/build/nodes/nodesRaft`` (``nodesBFT`` and ``nodesSingle`` for BFT and Single notaries).
2. Run ``samples\notary-demo\build\nodes\nodesRaft\runnodes``, which will start the nodes in separate terminal windows/tabs.
Wait until a "Node started up and registered in ..." message appears on each of the terminals
3. Run ``gradlew samples:notary-demo:notarise`` to make a call to the "Party" node to initiate notarisation requests
@ -197,21 +195,18 @@ To run from the command line in Windows:
http://localhost:10007/api/bank/date
.. note:: The Bank of Corda node explicitly advertises with a node service type as follows:
``advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("issuer"))))``
``advertisedServices = ["corda.issuer.USD"]``
This allows for 3rd party applications to perform actions based on Node Type.
For example, the Explorer tool only allows nodes of this type to issue and exit cash.
In the "Bank Of Corda Demo: Run Issuer" window, you should see the following progress steps displayed:
- Awaiting issuance request
- Self issuing asset
- Transferring asset to issuance requester
- Confirming asset issuance to requester
In the client issue request window, you should see the following printed:
In the window you run the command you should see (in case of Web, RPC is simmilar):
- Requesting Cash via Web ...
- Successfully processed Cash Issue request
If you want to see flow activity enter in node's shell ``run stateMachinesAndUpdates``. It will display all state machines
running currently on the node.
Launch the Explorer application to visualize the issuance and transfer of cash for each node:
``./gradlew tools:explorer:run`` (on Unix) or ``gradlew tools:explorer:run`` (on Windows)

View File

@ -42,9 +42,9 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
directory "./build/nodes"
// This name "Notary" is hard-coded into BankOfCordaClientApi so if you change it here, change it there too.
// In this demo the node that runs a standalone notary also acts as the network map server.
networkMap "CN=Notary Service,O=R3,OU=corda,L=London,C=UK"
networkMap "CN=Notary Service,O=R3,OU=corda,L=Zurich,C=CH"
node {
name "CN=Notary Service,O=R3,OU=corda,L=London,C=UK"
name "CN=Notary Service,O=R3,OU=corda,L=Zurich,C=CH"
advertisedServices = ["corda.notary.validating"]
p2pPort 10002
rpcPort 10003
@ -61,6 +61,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
['username' : "bankUser",
'password' : "test",
'permissions': ["StartFlow.net.corda.flows.CashPaymentFlow",
"StartFlow.net.corda.flows.CashExitFlow",
"StartFlow.net.corda.flows.IssuerFlow\$IssuanceRequester"]]
]
}

View File

@ -9,6 +9,7 @@ import net.corda.core.node.services.ServiceInfo
import net.corda.core.node.services.ServiceType
import net.corda.core.transactions.SignedTransaction
import net.corda.core.utilities.DUMMY_NOTARY
import net.corda.flows.CashExitFlow
import net.corda.flows.CashPaymentFlow
import net.corda.flows.IssuerFlow
import net.corda.node.driver.driver
@ -57,7 +58,7 @@ private class BankOfCordaDriver {
val role = options.valueOf(roleArg)!!
if (role == Role.ISSUER) {
driver(dsl = {
val bankUser = User(BANK_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>(), startFlowPermission<IssuerFlow.IssuanceRequester>()))
val bankUser = User(BANK_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>(), startFlowPermission<IssuerFlow.IssuanceRequester>(), startFlowPermission<CashExitFlow>()))
val bigCorpUser = User(BIGCORP_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>()))
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type)))
val bankOfCorda = startNode(BOC.name, rpcUsers = listOf(bankUser), advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("issuer.USD"))))