io.cordite:cordite-cordapp

this is a component of the Cordite open source project


Keywords
accounting, blockchain, corda, dao, distributed ledger, economics, finance, governance, ico, tokens
Licenses
Apache-2.0/libpng-2.0

Documentation

Cordite Cordite

What is Cordite?

Cordite provides decentralised economic and governance services including:

  • decentralised stores and transfers of value allowing new financial instruments to be created inside the existing regulatory framework. eg. tokens, crypto-coins, digital cash, virtual currency, distributed fees, micro-billing
  • decentralised forms of governance allowing new digital autonomous organisations to be created using existing legal entities eg. digital mutual societies or digital joint stock companies
  • decentralised consensus in order to remove the need for a central operator, owner or authority. Allowing Cordite to be more resilient, cheaper, agile and private than incumbent market infrastructure

Cordite is open source, regulatory friendly, enterprise ready and finance grade.

Cordite is built on Corda, a finance grade distributed ledger technology, meeting the highest standards of the banking industry, yet it is applicable to any commercial scenario. The outcome of over two years of intense research and development by over 80 of the world’s largest financial institutions.

How do I get started?

  1. Connect to a Cordite node
  2. Read the docs
  3. Deploy your own node
  4. Use Cordite in your project
  5. Build Cordite from source

How do I get in touch?

What if something does not work?

We encourage you to raise any issues/bugs you find in Cordite. Please follow the below steps before raising issues:

  1. Check on the Issues backlog to make sure an issue on the topic has not already been raised
  2. Post your question on the #cordite channel on Corda slack
  3. If none of the above help solve the issue, raise an issue following the contributions guide

How do I contribute?

We welcome contributions both technical and non-technical with open arms! There's a lot of work to do here. The Contributing Guide provides more information on how to contribute.

Who is behind Cordite?

Cordite is being developed by a group of financial services companies, software vendors and open source contributors. The project is hosted on here on GitLab.

What open source license has this been released under?

All software in this repository is licensed under the Apache License, Version 2.0 (the "License"); you may not use this software 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.


How do I connect to a Cordite node?

We have created a few test nodes:

These are available as public nodes hosted in East US, SE Asia and W Europe locations respectively. You can use the REST endpoint /api or use the following clients:

How do I deploy my own Cordite node?

We use Docker to deploy Cordite nodes. For instructions on starting up a Cordite node using Docker, please visit our Docker Hub Repo for more information on configuration including environment variables:

docker run -it \
        --memory=2048m \
        --cpus=2 \
        -e MY_LEGAL_NAME="O=Cordite-example,L=Berlin,C=DE" \
        -e MY_PUBLIC_ADDRESS="cordite.example.com" \
        -e MY_EMAIL_ADDRESS="noreply@cordite.foundation" \
        -e NETWORK_MAP_URL="https://nms-test.cordite.foundation" \
        -v $(pwd):/opt/corda/certificates \
        -v $(pwd):/opt/corda/persistence \
        -p 10200:10200 \
        -p 8080:8080 \
        cordite/cordite:latest

Once the node is running, you will be able to see the REST API for accessing Cordite at https://localhost:8080/api. This will bring up a new node on Cordite TEST, certificates will be created and stored in certificates.

You can also use Cordite to join the Corda.Network. Process to join the Corda Network. Below is an example for joining Corda UAT network

docker run -it \
        --memory=2048m \
        --cpus=2 \
        -e MY_LEGAL_NAME="O=Cordite-example,L=Berlin,C=DE" \
        -e MY_PUBLIC_ADDRESS="cordite.example.com" \
        -e MY_EMAIL_ADDRESS="noreply@cordite.foundation" \
        -e NETWORK_MAP_URL="https://netmap.uat.corda.network/3FCF6CEB-20BD-4B4F-9C72-1EFE7689D85B" \
        -v $(pwd):/opt/corda/certificates \
        -v $(pwd):/opt/corda/persistence \
        -p 10200:10200 \
        -p 8080:8080 \
        cordite/cordite:latest

If you do not wish to use Docker then alternatively you can download the Cordite node and run without docker by running ./run-corda.sh. You will need Oracle JRE 8 JVM - minimum supported version 8u131.

Environment Variables

Cordite uses environment variables to configure Cordite and create amoungst other things the Corda node.conf file at runtime. We have moved to use the Official Corda Docker Image.

Env Name Description Default
REQUIRED
MY_LEGAL_NAME The Corda Network X500 name to use for this node O=Cordite-XXX, OU=Cordite, L=London, C=GB
MY_PUBLIC_ADDRESS The public FQDN to advertise the node on localhost
MY_EMAIL_ADDRESS The email address the network operator can reach you noreply@cordite.foundation
OPTIONAL
NETWORK_MAP_URL The address of the network map service. https://nms-test.cordite.foundation
DOORMAN_URL The address of the doorman service https://nms-test.cordite.foundation
TRUST_STORE_NAME The filename of the Trust Root network-root-truststore.jks
NETWORK_TRUST_PASSWORD The password to the Trust Root trustpass
MY_P2P_PORT The port to advertise the node on 10200
TLS_CERT_CERL_ISSUER CRL distribution point (i.e. URL) for the TLS certificate NULL
TLS_CERT_CRL_DIST_POINT CRL issuer (given in the X500 name format) for the TLS certificate NULL
CORDITE_KEY_STORE_PASSWORD Keystore password cordacadevpass
CORDITE_TRUST_STORE_PASSWORD Truststore password trustpass
CORDITE_DB_USER Username for db sa
CORDITE_DB_PASS Password for db dnpass
CORDITE_DB_DIR Path to db directory - only used for H2 /opt/corda/persistence/
CORDITE_DB_URL database JDBC URI <default corda url>
CORDITE_DB_DRIVER driver class name for database access - postgres 42.2.5 driver is embedded - you can use org.postgresql.ds.PGSimpleDataSource to enable it org.h2.jdbcx.JdbcDataSource
CORDITE_DB_MAX_POOL_SIZE DB Max pool size 10
CORDITE_H2_PORT H2 DB port 9090
CORDITE_BRAID_PORT Braid port 8080
CORDITE_DEV_MODE Start up node in dev mode true
CORDITE_DETECT_IP Allow node to auto detect external visible IP false
CORDITE_CACHE_NODEINFO Persist NodeInfo-* file false
CORDITE_LOG_MODE Log in normal or JSON normal
CORDITE_JVM_MX JVM -Xmx value 1536m
CORDITE_JVM_MS JVM -Xms value 512m
CORDITE_EXPORT_JMX exportJMXTo: value in node.conf
CORDITE_TLS_ENABLED True iff TLS enabled true
CORDITE_TLS_CERT_PATH Path to TLS certificate null
CORDITE_TLS_KEY_PATH Path to TLS Key null
CORDITE_WEBSOCKET_FRAME_SIZE TLS max framesize min(networkMaxTransationSize, 10MB)
CORDITE_WEBSOCKET_MESSAGE_SIZE TLS max message size min(networkMaxTransationSize, 10MB)
CORDITE_NOTARY Set to true to be a validating notary, false for non-validating or do not set to be a notary null
CORDITE_METERING_CONFIG JSON to set metering notary configuration null
CORDITE_FEE_DISPERSAL_CONFIG JSON to set metering fee dispersal config null
JVM_ARGS Override JVM args See Dockerfile
CORDA_ARGS Override CORDA args See Dockerfile
RPC_PASSWORD Not used
MY_RPC_PORT Not used
MY_RPC_ADMIN_PORT Not used
CORDAPPS_FOLDER Override location of cordapps /opt/corda/cordapps
PERSISTENCE_FOLDER Override location of persistence /opt/corda/persistence
CERTIFICATES_FOLDER Override location of certificates /opt/corda/certificates
DRIVERS_FOLDER Override location of drivers /opt/corda/drivers
CONFIG_FOLDER Override location of config /etc/corda
DEPRECATED Use Official Corda variables instead
CORDITE_COMPATIBILITY_ZONE_URL The address of the Network Map Service. https://nms-test.cordite.foundation
CORDITE_LEGAL_NAME The name of the node O=Cordite-XXX, OU=Cordite, L=London, C=GB
CORDITE_P2P_ADDRESS The address other nodes will use to speak to your node localhost:10002
backward compatible If deprecated variables are passed they override the MY_* variables

Volume Mounts

File/Folder Description
REQUIRED
/opt/corda/certificates certificates must be mounted at location
/opt/corda/persistence persistent volume must be mounted for H2 and nodeInfo cache
OPTIONAL
/etc/corda/node.config mounted node.conf will be used rather than generated
/opt/corda/logs logs can be externally mounted
/opt/corda/cordapps override Cordite corDapps
DEPRECATED Use Official Corda mounts instead
/opt/cordite/node.conf Configuration file detailing specifics of your node - will be created using env variables if a node.conf is not mounted
/opt/cordite/db Location of the database for that node - for persistence, use volume mount
/opt/cordite/certificates Location of the nodes' corda certificates - will be created if no certificates are mounted to node and devmode=true
/opt/cordite/tls-certificates Location of TLS certificates - will use self-signed certificates if none are mounted to node
/opt/cordite There is a soft link from /opt/cordite to /opt/corda providing backward compatability

How do I build from source?

When building from source we recommend the following setup:

  • Unix OS (ie OS X)
  • Docker - minimum supported version 18.03.0
  • NPM - minimum supported version 5.6.0
  • Oracle JDK 8 JVM - minimum supported version 8u131

For those wishing to build Cordite from source run ./build.sh. (NOTE: this script is not to designed to be run on Windows.) Cordite node is laid out in ./node and gradle builds in ./cordapps. To start node after the build run (cd node && run-corda.sh).

How do I use Cordite in my own project

The core of Cordite is a collection of CorDapps which are java libraries. These are releasd to Maven Central and can be used in your project

Can I run multiple nodes on a single machine?

Yes you can. You need to be aware of the ports you are using for each node on the same host to ensure none clash. For all new ports assigned to each node, you will need to update the firewall accordingly.

How do I use Cordite in my own project

The core of Cordite is a collection of CorDapps which are java libraries. These are releasd to Maven Central and can be used in your project

How does json logging work

You can turn JSON, or structured, logging on by setting CORDITE_LOG_MODE=json in the docker environment variables. If you do this, beware of a few things:

  • each log line is a flat JSON object with strings mapping to strings
  • the severities are mapped on to stack driver severity levels
  • MDC properties tip up as entries in the JSON object
  • you can put as many [key=value] bits in your log message and each one will be stripped out of the message and will show up in the JSON object
  • Jolokia agent is serving on port 7005 unless JVM_ARGS are over-ridden

You might well be asking why on earth we want to do this. A number of reasons:

  • in this way we can get Stackdriver and other JSON based monitoring solution not to interpret every message as INFO level!
  • we can use the MDC for tracking requests across the entire cluster that we are monitoring - perhaps using session id, or some other discrim like txnId
  • we can mark up various log messages as having certain types - we can then use this to slice and dice the messages - in particular we could figure out how much time we spend in certain blocks, or how often we call a method, but across a whole cluster, or within a certain type of transaction.