Skip to content

Commit

Permalink
Initial Checkin - Rebased to V2
Browse files Browse the repository at this point in the history
  • Loading branch information
CaisManai committed Jan 23, 2018
1 parent d01f6fb commit e4204a2
Show file tree
Hide file tree
Showing 133 changed files with 690,212 additions and 17 deletions.
84 changes: 67 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,72 @@
# Compiled class file
*.class

# Log file
# Eclipse, ctags, Mac metadata, log files
.classpath
.project
.settings
tags
.DS_Store
*.log
*.log.gz
*.orig

.gradle

# General build files
**/build/*
!docs/build/*

lib/dokka.jar

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio

*.iml

## Directory-based project format:
#.idea

# if you remove the above rule, at least ignore the following:

# Specific files to avoid churn
.idea/*.xml
.idea/copyright
.idea/jsLibraryMappings.xml

# User-specific stuff:
.idea/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# BlueJ files
*.ctxt
# mpeltonen/sbt-idea plugin
.idea_modules/

# Mobile Tools for Java (J2ME)
.mtj.tmp/
# JIRA plugin
atlassian-ide-plugin.xml

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# docs related
docs/virtualenv/
13 changes: 13 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2016, R3 Limited.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
154 changes: 154 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
![Corda](https://www.corda.net/wp-content/uploads/2016/11/fg005_corda_b.png)

Project status: Early alpha. Expect bugs and rapid iterative development.

### Voltron

A [trade finance](http://www.investopedia.com/terms/t/tradefinance.asp) solution using the R3 Corda framework.

### Technologies

* [JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
installed and available on your path.
* Latest version of [IntelliJ IDEA](https://www.jetbrains.com/idea/download/)
(note the Community Edition is free)
* [H2 web console](http://www.h2database.com/html/download.html)
(download the "platform-independent zip") - you can get by with the Database tab in Intellij
* [git](https://help.github.com/articles/set-up-git/)

### Getting started

Voltron is a Gradle build from a git repository. It relies on libraries provided by R3 which are
in the public domain (Corda).

#### Verify you have Git

```
$ git --version
```

[Install git](https://help.github.com/articles/set-up-git/) if necessary.

#### Verify you have R3 Corda

If this is your first time working with CorDapps, clone and build the source code repository (over HTTPS) for
the `release-M10` milestone (for example) using:

```
$ git clone https://github.com/corda/corda.git
$ cd corda
$ git checkout release-M10
$ ./gradlew
$ gradle clean install
```
This will install the release artifacts into the local repository so they can be picked up by this project.

#### Clone this repo

Get the source code from here:

```
$ git clone https://{your-bitbucket-user}@bitbucket.org/R3-CEV/voltron.git
```
A sub-directory called `voltron` will be created which is your project root directory.

To update a previous clone of the project use a pull instead:

```
$ cd <project root>
$ git pull
```

We use the Release Branch approach, where `master` is the current release candidate, and `release-X` is the release
of version X. Feature branches are named after their respective issue numbers which are included in each commit to assist tracking.
Once feature branches are merged, they are deleted.

#### Build with Gradle

Everything is automated, including installing gradle on your system. Just type the following:

```
$ cd <project root>
$ ./gradlew
```

Gradle uses a file called `build.gradle` present in the project root directory to provide all the build information.
Make sure you reference that file when opening the project.

Also, in Intellij the default grade wrapper isn't always supported. If you've installed gradle through Homebrew you
may need to directly reference Gradle home using `/usr/local/opt/gradle/libexec` instead. If you are having a
compilation error, and the issue might be gradle version. [Corda issue #18](https://github.com/corda/corda/issues/18)
Make sure that your Gradle version is 2.10.
```
$ ./gradlew wrapper --gradle-version 2.10
```

#### Start the application (from an IDE)

Create a runtime configurations with the following specification:

`Main [run]`:
```
Main Class: com.template.MainKt
VM Options: -javaagent:lib/quasar.jar -Dco.paralleluniverse.fibers.verifyInstrumentation=false
```

Running this will automatically initiate trades between all nodes.

Note the presence of the `lib/quasar.jar`. This is to allow Quasar to instrument the classes that are using the
Fiber classes using an Ahead-Of-Time (AOT) approach. Since the location of the local Gradle repo is not known for all
users of the code it has been provided in the project as a convenience.

#### Start the application (from the command line)

To run the application from the command line do the following:
```
$ cd <project root>
$ ./gradlew kotlin-source:installDist
$ ./gradlew kotlin-source:deployNodes
$ ./kotlin-source/build/nodes/runnodes
$ ./kotlin-source/build/install/kotlin-source/bin/kotlin-source --role ApplyForLOC
```
This will create a small network of Corda nodes and deploy the Voltron CorDapp into them.

### Issue tracking

We use the `project-voltron` private Slack channel to discuss the current situation with the code.

### Contributing

Please refer to the [Corda code style guide](https://docs.corda.net/codestyle.html) to ensure that your contribution
fits well with every one else's.

### Troubleshooting

#### My Corda nodes take 30 seconds or more to start

This is most likely due to a network timeout occurring during startup/run phases within the node. You will need to
ensure that you have a network connection (even if it is dead) so that localhost resolution occurs in a timely manner.

(Quick fix tip: Try a mobile hotspot network).

A typical startup time for a Corda node on a basic development machine is around 200 ms.

#### When the format of transactions changes, then system triggers this error.

```
Requesting signature by Notary service
E 14:01:09 [263:Node thread] [f0a602c5-353f-4c84-b1a4-e0d460256c3e].uncaughtException - Caught exception from protocol
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Failed requirement.
at com.r3corda.node.services.statemachine.ProtocolStateMachineImpl.run(ProtocolStateMachineImpl.kt:90) ~[node-0.4.jar:?]
```
Solution: Delete the build directory.

#### When building Gradle, an index error regarding `https://dl.bintray.com/kotlin/exposed` occurs.

```
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: Resource nexus-maven-repository-index.properties does not exist
at org.jetbrains.idea.maven.server.Maven3ServerIndexerImpl$2.run(Maven3ServerIndexerImpl.java:204)
at org.jetbrains.idea.maven.server.Maven30ServerEmbedderImpl.executeWithMavenSession(Maven30ServerEmbedderImpl.java:568)
at org.jetbrains.idea.maven.server.Maven3ServerIndexerImpl.updateIndex(Maven3ServerIndexerImpl.java:170)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
```
Solution: Known issue - see https://youtrack.jetbrains.com/issue/IDEA-138029
4 changes: 4 additions & 0 deletions TRADEMARK
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Corda and the Corda logo are trademarks of R3CEV LLC and its affiliates.
All rights reserved.

For R3CEV LLC's trademark and logo usage information, please consult our Trademark Usage Policy available at https://www.r3.com/trademark-usage-policy
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
buildscript {
ext.corda_release_version = '2.0.0'
ext.corda_gradle_plugins_version = '1.0.0'
ext.kotlin_version = '1.1.4'
ext.quasar_version = '0.7.6'
ext.junit_version = '4.12'

repositories {
mavenLocal()
mavenCentral()
jcenter()
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version"
classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version"
}
}

repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' }
}
59 changes: 59 additions & 0 deletions config/dev/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info">

<Properties>
<Property name="log-path">logs</Property>
<Property name="log-name">node-${hostName}</Property>
<Property name="archive">${log-path}/archive</Property>
</Properties>

<ThresholdFilter level="trace"/>

<Appenders>
<Console name="Console-Appender" target="SYSTEM_OUT">
<PatternLayout>
<pattern>
%highlight{%level{length=1} %d{HH:mm:ss} %T %c{1}.%M - %msg%n}{INFO=white,WARN=red,FATAL=bright red blink}
</pattern>>
</PatternLayout>
</Console>

<!-- Will generate up to 10 log files for a given day. During every rollover it will delete
those that are older than 60 days, but keep the most recent 10 GB -->
<RollingFile name="RollingFile-Appender"
fileName="${log-path}/${log-name}.log"
filePattern="${archive}/${log-name}.%d{yyyy-MM-dd}-%i.log.gz">

<PatternLayout pattern="[%-5level] %d{ISO8601}{GMT+0} [%t] %c{1} - %msg%n"/>

<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>

<DefaultRolloverStrategy min="1" max="10">
<Delete basePath="${archive}" maxDepth="1">
<IfFileName glob="${log-name}*.log.gz"/>
<IfLastModified age="60d">
<IfAny>
<IfAccumulatedFileSize exceeds="10 GB"/>
</IfAny>
</IfLastModified>
</Delete>
</DefaultRolloverStrategy>

</RollingFile>
</Appenders>

<Loggers>
<Root level="info">
<AppenderRef ref="Console-Appender"/>
<AppenderRef ref="RollingFile-Appender"/>
</Root>
<Logger name="net.corda" level="info" additivity="false">
<AppenderRef ref="Console-Appender"/>
<AppenderRef ref="RollingFile-Appender"/>
</Logger>
</Loggers>

</Configuration>
20 changes: 20 additions & 0 deletions config/test/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info">
<Appenders>
<Console name="Console-Appender" target="SYSTEM_OUT">
<PatternLayout>
<pattern>
[%-5level] %d{HH:mm:ss.SSS} [%t] %c{1}.%M - %msg%n
</pattern>>
</PatternLayout>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console-Appender"/>
</Root>
<Logger name="net.corda" level="info" additivity="false">
<AppenderRef ref="Console-Appender"/>
</Logger>
</Loggers>
</Configuration>
20 changes: 20 additions & 0 deletions doc/interop/InteropSendTxExample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"interopTxPayload": {
"sourceLedgerId": 'Fabric01",
"destinationNode": "advisingbankserver:80",
"contractAddress": "EF443545453443544343434FEFEF",
"contractFunction": "transferEbLOwner",
"functionPayload": {
"eBL": {
"carrierName": "happy shipping co",
"owner": "AdvisingBankPublicKey"
}
},
"ed25519signatures": [
"etc",
"etc1"
],
"transactionId":"SOMEGUID",
},
"payloadHMAC": "blahbalh"
}
Loading

0 comments on commit e4204a2

Please sign in to comment.