mirror of
https://github.com/corda/corda.git
synced 2025-01-27 06:39:38 +00:00
Introduce an Enterprise node
This commit is contained in:
parent
260ebf962b
commit
74c2e6e75a
@ -1,52 +0,0 @@
|
||||
# Contributing to Corda
|
||||
|
||||
To start contributing you can fork our repo and begin making pull requests. Please use
|
||||
descriptive commit messages and follow our [coding style guidelines](https://docs.corda.net/codestyle.html).
|
||||
|
||||
## Community Locations
|
||||
|
||||
* [GitHub](https://github.com/corda/corda)
|
||||
* [Forums](https://discourse.corda.net)
|
||||
* [Chat](https://slack.corda.net)
|
||||
|
||||
## Developer Certificate of Origin
|
||||
|
||||
All contributions to this project are subject to the terms of the Developer Certificate of Origin, below:
|
||||
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
1 Letterman Drive
|
||||
Suite D4700
|
||||
San Francisco, CA, 94129
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
13
LICENSE
13
LICENSE
@ -1,13 +0,0 @@
|
||||
Copyright 2016 - 2017, 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.
|
96
README.md
96
README.md
@ -1,92 +1,14 @@
|
||||
![Corda](https://www.corda.net/wp-content/uploads/2016/11/fg005_corda_b.png)
|
||||
|
||||
<a href="https://ci-master.corda.r3cev.com/viewType.html?buildTypeId=Corda_CordaBuild&tab=buildTypeStatusDiv&guest=1"><img src="https://ci.corda.r3cev.com/app/rest/builds/buildType:Corda_CordaBuild/statusIcon"/></a>
|
||||
# Corda Enterprise
|
||||
|
||||
# Corda
|
||||
Corda Enterprise is R3's closed source patch set on top of Corda Open Source. It adds features and improvements that we
|
||||
plan to charge for.
|
||||
|
||||
Corda is a decentralised database system in which nodes trust each other as little as possible.
|
||||
## Extra features
|
||||
|
||||
## Features
|
||||
|
||||
* A P2P network of nodes
|
||||
* Smart contracts
|
||||
* Flow framework
|
||||
* "Notary" infrastructure to validate uniqueness of transactions
|
||||
* Written as a platform for distributed apps called CorDapps
|
||||
* Written in [Kotlin](https://kotlinlang.org), targeting the JVM
|
||||
|
||||
## Getting started
|
||||
|
||||
Firstly, read the [Getting started](https://docs.corda.net/getting-set-up.html) documentation.
|
||||
|
||||
Next, use the following guides to set up your dev environment:
|
||||
|
||||
* If you are on **Windows** [use this getting started guide](https://www.corda.net/wp-content/uploads/2017/01/Corda-Windows-Quick-start-guide-1.pdf) which also explains through how to run the sample apps.
|
||||
|
||||
* Alternatively if you are on **Mac/Linux**, [watch this brief Webinar](https://vimeo.com/200167665) which walks through getting Corda, installing it, building it, running nodes and opening projects in IntelliJ.
|
||||
|
||||
After the above, watching the following webinars will give you a great introduction to Corda:
|
||||
|
||||
### Webinar 1 – [Introduction to Corda](https://vimeo.com/192757743/c2ec39c1e1)
|
||||
|
||||
Richard Brown, R3 Chief Technology Officer, explains Corda's unique architecture, the only distributed ledger platform designed by and for the financial industry's unique requirements. You may want to read the [Corda non-technical whitepaper](https://www.r3cev.com/s/corda-introductory-whitepaper-final.pdf) as pre-reading for this session.
|
||||
|
||||
### Webinar 2 – [Corda Developers’ Tutorial](https://vimeo.com/192797322/aab499b152)
|
||||
|
||||
Roger Willis, R3 Developer Relations Lead, provides an overview of Corda from a developer’s perspective and guidance on how to start building CorDapps. You may want to view [Webinar 1 - Introduction to Corda](https://vimeo.com/192757743/c2ec39c1e1) as preparation for this session. **NB. This was recorded for the M5 release.**
|
||||
|
||||
## Building on Corda
|
||||
|
||||
To build your own CorDapps:
|
||||
|
||||
1. Clone the [CorDapp Template repository](https://github.com/corda/cordapp-template)
|
||||
2. Read the [README](https://github.com/corda/cordapp-template/blob/master/README.md) (**IMPORTANT!**)
|
||||
3. Read the [Writing a CorDapp](https://docs.corda.net/tutorial-cordapp.html) documentation
|
||||
|
||||
To look at the Corda source and run some sample applications:
|
||||
|
||||
1. Clone this repository
|
||||
2. To run some sample CorDapps, read the [running the demos documentation](https://docs.corda.r3cev.com/running-the-demos.html)
|
||||
3. Start hacking and [contribute](./CONTRIBUTING.md)!
|
||||
|
||||
## Useful links
|
||||
|
||||
* [Project website](https://corda.net)
|
||||
* [Documentation](https://docs.corda.net)
|
||||
* [Slack channel](https://slack.corda.net/)
|
||||
* [Forum](https://discourse.corda.net)
|
||||
* [Meetups](https://www.meetup.com/pro/corda/)
|
||||
* [Training Course](https://www.corda.net/corda-training/)
|
||||
|
||||
|
||||
## Development State
|
||||
|
||||
Corda is under active development and is maturing rapidly. We are targeting
|
||||
production-readiness in 2017. The API will continue to evolve throughout 2017;
|
||||
backwards compatibility not assured until version 1.0.
|
||||
|
||||
Pull requests, experiments, and contributions are encouraged and welcomed.
|
||||
|
||||
## Background
|
||||
|
||||
The project is supported by R3, a financial industry consortium, which is why it
|
||||
contains some code for financial use cases and why the documentation focuses on finance. The goal is to use it
|
||||
to construct a global ledger, simplifying finance and reducing the overheads of banking. But it is run as
|
||||
an open source project and the basic technology of a peer-to-peer decentralised database may be useful
|
||||
for many different projects.
|
||||
|
||||
## Contributing
|
||||
|
||||
Please read [here](./CONTRIBUTING.md).
|
||||
|
||||
## License
|
||||
|
||||
[Apache 2.0](./LICENSE)
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
![YourKit](https://www.yourkit.com/images/yklogo.png)
|
||||
|
||||
YourKit supports open source projects with its full-featured Java Profiler.
|
||||
|
||||
YourKit, LLC is the creator of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/) and [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/), innovative and intelligent tools for profiling Java and .NET applications.
|
||||
* Doorman
|
||||
* SOCKS relaying
|
||||
* Flow triage screen in Explorer
|
||||
* No stupid jokes at startup
|
||||
* SGX
|
||||
|
@ -1,4 +0,0 @@
|
||||
Corda and the Corda logo are trademarks of R3 HoldCo LLC and its affiliates.
|
||||
All rights reserved.
|
||||
|
||||
For R3 HoldCo LLC's trademark and logo usage information, please consult our Trademark Usage Policy available at https://www.r3.com/trademark-policy
|
@ -122,7 +122,7 @@ allprojects {
|
||||
attributes('Corda-Release-Version': corda_release_version)
|
||||
attributes('Corda-Platform-Version': corda_platform_version)
|
||||
attributes('Corda-Revision': corda_revision)
|
||||
attributes('Corda-Vendor': 'Corda Open Source')
|
||||
attributes('Corda-Vendor': 'Corda Enterprise Edition')
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ allprojects {
|
||||
systemProperties['java.io.tmpdir'] = buildDir
|
||||
}
|
||||
|
||||
group 'net.corda'
|
||||
group 'com.r3.corda.enterprise'
|
||||
version "$corda_release_version"
|
||||
|
||||
repositories {
|
||||
@ -239,9 +239,10 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
|
||||
}
|
||||
}
|
||||
|
||||
// User and key are commented out to prevent accidental pushes of Enterprise to public repos. DO NOT UNCOMMENT.
|
||||
bintrayConfig {
|
||||
user = System.getenv('CORDA_BINTRAY_USER')
|
||||
key = System.getenv('CORDA_BINTRAY_KEY')
|
||||
// user = System.getenv('CORDA_BINTRAY_USER')
|
||||
// key = System.getenv('CORDA_BINTRAY_KEY')
|
||||
repo = 'corda'
|
||||
org = 'r3'
|
||||
licenses = ['Apache-2.0']
|
||||
|
@ -6,7 +6,7 @@ apply plugin: 'net.corda.plugins.publish-utils'
|
||||
apply plugin: 'us.kirchmeier.capsule'
|
||||
apply plugin: 'com.jfrog.artifactory'
|
||||
|
||||
description 'Corda standalone node'
|
||||
description 'Corda Enterprise'
|
||||
|
||||
configurations {
|
||||
runtimeArtifacts.extendsFrom runtime
|
||||
@ -22,7 +22,7 @@ targetCompatibility = 1.6
|
||||
|
||||
task buildCordaJAR(type: FatCapsule, dependsOn: project(':node').compileJava) {
|
||||
applicationClass 'net.corda.node.Corda'
|
||||
archiveName "corda-${corda_release_version}.jar"
|
||||
archiveName "corda-enterprise-${corda_release_version}.jar"
|
||||
applicationSource = files(
|
||||
project(':node').configurations.runtime,
|
||||
project(':node').jar,
|
||||
@ -40,7 +40,7 @@ task buildCordaJAR(type: FatCapsule, dependsOn: project(':node').compileJava) {
|
||||
// def quasarExcludeExpression = "x(rx**;io**;kotlin**;jdk**;reflectasm**;groovyjarjarasm**;groovy**;joptsimple**;groovyjarjarantlr**;javassist**;com.fasterxml**;com.typesafe**;com.google**;com.zaxxer**;com.jcabi**;com.codahale**;com.esotericsoftware**;de.javakaffee**;org.objectweb**;org.slf4j**;org.w3c**;org.codehaus**;org.h2**;org.crsh**;org.fusesource**;org.hibernate**;org.dom4j**;org.bouncycastle**;org.apache**;org.objenesis**;org.jboss**;org.xml**;org.jcp**;org.jetbrains**;org.yaml**;co.paralleluniverse**;net.i2p**)"
|
||||
// javaAgents = ["quasar-core-${quasar_version}-jdk8.jar=${quasarExcludeExpression}"]
|
||||
javaAgents = ["quasar-core-${quasar_version}-jdk8.jar"]
|
||||
systemProperties['visualvm.display.name'] = 'Corda'
|
||||
systemProperties['visualvm.display.name'] = 'CordaEnterprise'
|
||||
minJavaVersion = '1.8.0'
|
||||
minUpdateVersion['1.8'] = java8_minUpdateVersion
|
||||
caplets = ['CordaCaplet']
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
package net.corda.node
|
||||
|
||||
import net.corda.node.internal.NodeStartup
|
||||
import net.corda.node.internal.EnterpriseNode
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
// Pass the arguments to the Node factory. In the Enterprise edition, this line is modified to point to a subclass.
|
||||
// It will exit the process in case of startup failure and is not intended to be used by embedders. If you want
|
||||
// to embed Node in your own container, instantiate it directly and set up the configuration objects yourself.
|
||||
NodeStartup(args).run()
|
||||
EnterpriseNode.Startup(args).run()
|
||||
}
|
||||
|
106
node/src/main/kotlin/net/corda/node/internal/EnterpriseNode.kt
Normal file
106
node/src/main/kotlin/net/corda/node/internal/EnterpriseNode.kt
Normal file
@ -0,0 +1,106 @@
|
||||
package net.corda.node.internal
|
||||
|
||||
import com.jcraft.jsch.JSch
|
||||
import com.jcraft.jsch.JSchException
|
||||
import net.corda.core.node.services.ServiceInfo
|
||||
import net.corda.core.utilities.Emoji
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.node.VersionInfo
|
||||
import net.corda.node.services.config.FullNodeConfiguration
|
||||
import net.corda.node.services.config.RelayConfiguration
|
||||
import org.fusesource.jansi.Ansi
|
||||
import org.fusesource.jansi.AnsiConsole
|
||||
import java.io.IOException
|
||||
|
||||
class EnterpriseNode(configuration: FullNodeConfiguration, advertisedServices: Set<ServiceInfo>,
|
||||
versionInfo: VersionInfo) : Node(configuration, advertisedServices, versionInfo) {
|
||||
companion object {
|
||||
private val logger by lazy { loggerFor<EnterpriseNode>() }
|
||||
}
|
||||
|
||||
class Startup(args: Array<String>) : NodeStartup(args) {
|
||||
override fun preNetworkRegistration(conf: FullNodeConfiguration) {
|
||||
super.preNetworkRegistration(conf)
|
||||
conf.relay?.let { connectToRelay(it, conf.p2pAddress.port) }
|
||||
}
|
||||
|
||||
override fun drawBanner(versionInfo: VersionInfo) {
|
||||
// This line makes sure ANSI escapes work on Windows, where they aren't supported out of the box.
|
||||
AnsiConsole.systemInstall()
|
||||
|
||||
val logo = """
|
||||
R ______ __ B
|
||||
R / ____/ _________/ /___ _ B_______ __ _ _______ _______ ______ _____ ______ _____ _______ _______
|
||||
R / / __ / ___/ __ / __ `/ B|______ | \ | | |______ |_____/ |_____] |_____/ | |______ |______
|
||||
R/ /___ /_/ / / / /_/ / /_/ / B|______ | \_| | |______ | \_ | | \_ __|__ ______| |______
|
||||
R\____/ /_/ \__,_/\__,_/ W____________________________________________________________________________
|
||||
D""".trimStart()
|
||||
|
||||
// Now replace the R, B and W letters with their colour code escapes to make the banner prettier.
|
||||
if (Ansi.isEnabled()) {
|
||||
val red = Ansi.ansi().fgBrightRed().toString()
|
||||
val blue = Ansi.ansi().fgBrightBlue().toString()
|
||||
val white = Ansi.ansi().reset().fgBrightDefault().toString()
|
||||
val default = Ansi.ansi().reset().toString()
|
||||
val colourLogo = logo.replace("R", red).replace("B", blue).replace("W", white).replace("D", default)
|
||||
val banner =
|
||||
colourLogo +
|
||||
System.lineSeparator() +
|
||||
(
|
||||
if (Emoji.hasEmojiTerminal)
|
||||
"${Emoji.CODE_LIGHTBULB} "
|
||||
else
|
||||
"Tip: "
|
||||
) +
|
||||
Ansi.ansi().bold().a(tip).reset() +
|
||||
System.lineSeparator()
|
||||
|
||||
println(banner)
|
||||
} else {
|
||||
println(logo.replace("R", "").replace("B", "").replace("W", "").replace("D", ""))
|
||||
}
|
||||
}
|
||||
|
||||
private val tip: String get() {
|
||||
val tips = javaClass.getResourceAsStream("tips.txt").bufferedReader().use { it.readLines() }
|
||||
return tips[(Math.random() * tips.size).toInt()]
|
||||
}
|
||||
|
||||
override fun createNode(conf: FullNodeConfiguration, versionInfo: VersionInfo, services: Set<ServiceInfo>) = EnterpriseNode(conf, services, versionInfo)
|
||||
|
||||
private fun connectToRelay(config: RelayConfiguration, localBrokerPort: Int) {
|
||||
with(config) {
|
||||
val jsh = JSch().apply {
|
||||
val noPassphrase = byteArrayOf()
|
||||
addIdentity(privateKeyFile.toString(), publicKeyFile.toString(), noPassphrase)
|
||||
}
|
||||
|
||||
val session = jsh.getSession(username, relayHost, sshPort).apply {
|
||||
// We don't check the host fingerprints because they may change often, and we are only relaying
|
||||
// data encrypted under TLS anyway: the relay box is NOT considered trusted. A compromised relay
|
||||
// box could observe packet sizes and timings, but the sort of attackers who might be able to
|
||||
// use such information have mostly compromised the network backbone already anyway. So this makes
|
||||
// setup more robust without changing security much.
|
||||
setConfig("StrictHostKeyChecking", "no")
|
||||
}
|
||||
|
||||
try {
|
||||
logger.info("Connecting to a relay at $relayHost")
|
||||
session.connect()
|
||||
} catch (e: JSchException) {
|
||||
throw IOException("Unable to establish a SSH connection: $username@$relayHost", e)
|
||||
}
|
||||
try {
|
||||
val localhost = "127.0.0.1"
|
||||
logger.info("Forwarding ports: $relayHost:$remoteInboundPort -> $localhost:$localBrokerPort")
|
||||
session.setPortForwardingR(remoteInboundPort, localhost, localBrokerPort)
|
||||
} catch (e: JSchException) {
|
||||
throw IOException("Unable to set up port forwarding - is SSH on the remote host configured correctly? " +
|
||||
"(port forwarding is not enabled by default)", e)
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("Relay setup successfully!")
|
||||
}
|
||||
}
|
||||
}
|
@ -73,8 +73,6 @@ open class NodeStartup(val args: Array<String>) {
|
||||
Node.printBasicNodeInfo(LOGS_CAN_BE_FOUND_IN_STRING, System.getProperty("log-path"))
|
||||
val conf = loadConfigFile(cmdlineOptions)
|
||||
banJavaSerialisation(conf)
|
||||
// TODO: Move this to EnterpriseNode.Startup
|
||||
conf.relay?.let { connectToRelay(it, conf.p2pAddress.port) }
|
||||
preNetworkRegistration(conf)
|
||||
maybeRegisterWithNetworkAndExit(cmdlineOptions, conf)
|
||||
logStartupInfo(versionInfo, cmdlineOptions, conf)
|
||||
@ -327,35 +325,4 @@ open class NodeStartup(val args: Array<String>) {
|
||||
reset())
|
||||
}
|
||||
}
|
||||
|
||||
private fun connectToRelay(config: RelayConfiguration, localBrokerPort: Int) {
|
||||
with(config) {
|
||||
val jsh = JSch().apply {
|
||||
val noPassphrase = byteArrayOf()
|
||||
addIdentity(privateKeyFile.toString(), publicKeyFile.toString(), noPassphrase)
|
||||
}
|
||||
|
||||
val session = jsh.getSession(username, relayHost, sshPort).apply {
|
||||
// We don't check the host fingerprints because they may change often
|
||||
setConfig("StrictHostKeyChecking", "no")
|
||||
}
|
||||
|
||||
try {
|
||||
logger.info("Connecting to a relay at $relayHost")
|
||||
session.connect()
|
||||
} catch (e: JSchException) {
|
||||
throw IOException("Unable to establish a SSH connection: $username@$relayHost", e)
|
||||
}
|
||||
try {
|
||||
val localhost = "127.0.0.1"
|
||||
logger.info("Forwarding ports: $relayHost:$remoteInboundPort -> $localhost:$localBrokerPort")
|
||||
session.setPortForwardingR(remoteInboundPort, localhost, localBrokerPort)
|
||||
} catch (e: JSchException) {
|
||||
throw IOException("Unable to set up port forwarding - is SSH on the remote host configured correctly? " +
|
||||
"(port forwarding is not enabled by default)", e)
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("Relay setup successfully!")
|
||||
}
|
||||
}
|
6
node/src/main/resources/net/corda/node/internal/tips.txt
Normal file
6
node/src/main/resources/net/corda/node/internal/tips.txt
Normal file
@ -0,0 +1,6 @@
|
||||
You can issue SQL queries to the database from the Corda shell with the jdbc command
|
||||
The config file format supports many useful features: https://github.com/typesafehub/config#using-hocon-the-json-superset
|
||||
You can chat to the Corda team using Slack: https://slack.corda.net/
|
||||
Administrator users can be granted access to do everything by granting them the ALL permission
|
||||
If you don't wish to use the shell it can be disabled with the --no-local-shell flag
|
||||
Use the "flow watch" shell command to see what flows your node is running
|
Loading…
x
Reference in New Issue
Block a user