mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
Samples: trader-demo can now be run from the command line with gradle
This commit is contained in:
parent
010112e44e
commit
7265614d5c
15
.idea/runConfigurations/Trader_Demo__Run_Buyer.xml
generated
Normal file
15
.idea/runConfigurations/Trader_Demo__Run_Buyer.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Trader Demo: Run Buyer" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.corda.traderdemo.TraderDemoKt" />
|
||||
<option name="VM_PARAMETERS" value="-ea -javaagent:lib/quasar.jar " />
|
||||
<option name="PROGRAM_PARAMETERS" value="--role BUYER" />
|
||||
<option name="WORKING_DIRECTORY" value="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="trader-demo_main" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
15
.idea/runConfigurations/Trader_Demo__Run_Nodes.xml
generated
Normal file
15
.idea/runConfigurations/Trader_Demo__Run_Nodes.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Trader Demo: Run Nodes" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.corda.traderdemo.MainKt" />
|
||||
<option name="VM_PARAMETERS" value="-ea -javaagent:lib/quasar.jar " />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="trader-demo_main" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
15
.idea/runConfigurations/Trader_Demo__Run_Seller.xml
generated
Normal file
15
.idea/runConfigurations/Trader_Demo__Run_Seller.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Trader Demo: Run Seller" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.corda.traderdemo.TraderDemoKt" />
|
||||
<option name="VM_PARAMETERS" value="-ea -javaagent:lib/quasar.jar " />
|
||||
<option name="PROGRAM_PARAMETERS" value="--role SELLER" />
|
||||
<option name="WORKING_DIRECTORY" value="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="trader-demo_main" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
@ -20,6 +20,22 @@ so far. We have:
|
||||
Trader demo
|
||||
-----------
|
||||
|
||||
This demo brings up three nodes: Bank A, Bank B and a notary/network map node that they both use. Bank A will
|
||||
be the buyer, and self-issues some cash in order to acquire the commercial paper from Bank B, the seller.
|
||||
|
||||
This can be run either from the command line (recommended for Mac/Linux/BSD users), or from inside IntelliJ.
|
||||
|
||||
To run from the command line:
|
||||
|
||||
1. Run ``./gradlew samples:trader-demo:deployNodes`` to create a set of configs and installs under ``samples/trader-demo/build/nodes``
|
||||
2. Run ``./samples/trader-demo/build/nodes/runnodes`` to open up three new terminal tabs/windows with the three nodes.
|
||||
3. Run ``./gradlew samples:trader-demo:runBuyer`` to set up the buyer node with some self-issued cash. This step
|
||||
is not expected to print much.
|
||||
4. Run ``./gradlew samples:trader-demo:runSeller`` to trigger the transaction. You can see both sides of the
|
||||
trade print their progress and final transaction state in the bank node tabs/windows.
|
||||
|
||||
To run from IntelliJ:
|
||||
|
||||
1. Open the Corda project in IntelliJ and run the "Install" configuration
|
||||
2. Open the Corda samples project in IntelliJ and run the "Trader Demo: Run Nodes" configuration
|
||||
3. Run "Trader Demo: Run Buyer"
|
||||
|
@ -1,64 +1,5 @@
|
||||
# Trader Demo
|
||||
|
||||
Please see docs/build/html/running-the-demos.html
|
||||
This demo shows a couple of nodes doing an atomic asset swap: cash for commercial paper.
|
||||
|
||||
This program is a simple driver for exercising the two party trading protocol. Until Corda has a unified node server
|
||||
programs like this are required to wire up the pieces and run a demo scenario end to end.
|
||||
|
||||
If you are creating a new scenario, you can use this program as a template for creating your own driver. Make sure to
|
||||
copy/paste the right parts of the build.gradle file to make sure it gets a script to run it deposited in
|
||||
build/install/r3prototyping/bin
|
||||
|
||||
In this scenario, a buyer wants to purchase some commercial paper by swapping his cash for the CP. The seller learns
|
||||
that the buyer exists, and sends them a message to kick off the trade. The seller, having obtained his CP, then quits
|
||||
and the buyer goes back to waiting. The buyer will sell as much CP as he can!
|
||||
|
||||
The different roles in the scenario this program can adopt are:
|
||||
|
||||
This template contains the build system and an example application required to get started with [Corda](http://todo.todo).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You will need to have [JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
|
||||
installed and available on your path.
|
||||
|
||||
## Getting Started
|
||||
|
||||
First clone this repository and the Corda repository locally. Then open a terminal window in the Corda directory and run:
|
||||
|
||||
Unix:
|
||||
|
||||
./gradlew publishToMavenLocal
|
||||
|
||||
Windows:
|
||||
|
||||
gradle.bat publishToMavenLocal
|
||||
|
||||
This will publish a copy of Corda to your local Maven repository for your Cordapp to use. Next open a terminal window
|
||||
in your Cordapp directory (this one) and run:
|
||||
|
||||
Unix:
|
||||
|
||||
./gradlew deployNodes
|
||||
|
||||
Windows:
|
||||
|
||||
gradlew.bat deployNodes
|
||||
|
||||
This command will create several nodes in `build/nodes` that you can now run with:
|
||||
|
||||
Unix:
|
||||
|
||||
cd build/nodes
|
||||
./runnodes
|
||||
|
||||
Windows:
|
||||
|
||||
cd build/nodes
|
||||
ruunnodes.bat
|
||||
|
||||
This will now have nodes running on your machine running this Cordapp. You can now begin developing your Cordapp.
|
||||
|
||||
## Further Reading
|
||||
|
||||
Tutorials and developer docs for Cordapps and Corda are [here](https://docs.corda.r3cev.com).
|
||||
Please see docs/build/html/running-the-demos.html to learn how to use this demo.
|
@ -95,7 +95,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install']) {
|
||||
cordapps = []
|
||||
}
|
||||
node {
|
||||
name "NodeA"
|
||||
name "Bank A"
|
||||
dirName "nodea"
|
||||
nearestCity "London"
|
||||
advertisedServices = []
|
||||
@ -104,7 +104,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install']) {
|
||||
cordapps = []
|
||||
}
|
||||
node {
|
||||
name "NodeB"
|
||||
name "Bank B"
|
||||
dirName "nodeb"
|
||||
nearestCity "New York"
|
||||
advertisedServices = []
|
||||
|
Loading…
Reference in New Issue
Block a user