• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Kotlin
  • Created over 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Kotlin CorDapp Template. Extend it via the Hello, World tutorial: https://docs.corda.net/hello-world-introduction.html

Corda

CorDapp Template - Kotlin

Welcome to the Kotlin CorDapp template. The CorDapp template is a stubbed-out CorDapp that you can use to bootstrap your own CorDapps.

This is the Kotlin version of the CorDapp template. The Java equivalent is here.

Pre-Requisites

See https://docs.corda.net/getting-set-up.html.

Usage

Running tests inside IntelliJ

We recommend editing your IntelliJ preferences so that you use the Gradle runner - this means that the quasar utils plugin will make sure that some flags (like -javaagent - see below) are set for you.

To switch to using the Gradle runner:

  • Navigate to Build, Execution, Deployment -> Build Tools -> Gradle -> Runner (or search for runner)
    • Windows: this is in "Settings"
    • MacOS: this is in "Preferences"
  • Set "Delegate IDE build/run actions to gradle" to true
  • Set "Run test using:" to "Gradle Test Runner"

If you would prefer to use the built in IntelliJ JUnit test runner, you can run gradlew installQuasar which will copy your quasar JAR file to the lib directory. You will then need to specify -javaagent:lib/quasar.jar and set the run directory to the project root directory for each test.

Running the nodes

See https://docs.corda.net/tutorial-cordapp.html#running-the-example-cordapp.

Interacting with the nodes

Shell

When started via the command line, each node will display an interactive shell:

Welcome to the Corda interactive shell.
Useful commands include 'help' to see what is available, and 'bye' to shut down the node.

Tue Nov 06 11:58:13 GMT 2018>>>

You can use this shell to interact with your node. For example, enter run networkMapSnapshot to see a list of the other nodes on the network:

Tue Nov 06 11:58:13 GMT 2018>>> run networkMapSnapshot
[
  {
  "addresses" : [ "localhost:10002" ],
  "legalIdentitiesAndCerts" : [ "O=Notary, L=London, C=GB" ],
  "platformVersion" : 3,
  "serial" : 1541505484825
},
  {
  "addresses" : [ "localhost:10005" ],
  "legalIdentitiesAndCerts" : [ "O=PartyA, L=London, C=GB" ],
  "platformVersion" : 3,
  "serial" : 1541505382560
},
  {
  "addresses" : [ "localhost:10008" ],
  "legalIdentitiesAndCerts" : [ "O=PartyB, L=New York, C=US" ],
  "platformVersion" : 3,
  "serial" : 1541505384742
}
]

Tue Nov 06 12:30:11 GMT 2018>>> 

You can find out more about the node shell here.

Client

clients/src/main/kotlin/com/template/Client.kt defines a simple command-line client that connects to a node via RPC and prints a list of the other nodes on the network.

Running the client

Via the command line

Run the runTemplateClient Gradle task. By default, it connects to the node with RPC address localhost:10006 with the username user1 and the password test.

Via IntelliJ

Run the Run Template Client run configuration. By default, it connects to the node with RPC address localhost:10006 with the username user1 and the password test.

Webserver

clients/src/main/kotlin/com/template/webserver/ defines a simple Spring webserver that connects to a node via RPC and allows you to interact with the node over HTTP.

The API endpoints are defined here:

 clients/src/main/kotlin/com/template/webserver/Controller.kt

And a static webpage is defined here:

 clients/src/main/resources/static/

Running the webserver

Via the command line

Run the runTemplateServer Gradle task. By default, it connects to the node with RPC address localhost:10006 with the username user1 and the password test, and serves the webserver on port localhost:10050.

Via IntelliJ

Run the Run Template Server run configuration. By default, it connects to the node with RPC address localhost:10006 with the username user1 and the password test, and serves the webserver on port localhost:10050.

Interacting with the webserver

The static webpage is served on:

http://localhost:10050

While the sole template endpoint is served on:

http://localhost:10050/templateendpoint

Extending the template

You should extend this template as follows:

  • Add your own state and contract definitions under contracts/src/main/kotlin/
  • Add your own flow definitions under workflows/src/main/kotlin/
  • Extend or replace the client and webserver under clients/src/main/kotlin/

For a guided example of how to extend this template, see the Hello, World! tutorial here.

More Repositories

1

corda

Corda is an open source blockchain project, designed for business from the start. Only Corda allows you to build interoperable blockchain networks that transact in strict privacy. Corda's smart contract technology allows businesses to transact directly, with value.
Kotlin
3,976
star
2

samples

This repository has been deprecated. Please use the links in the README to access the new repositories.
JavaScript
98
star
3

corda-training-materials

89
star
4

bootcamp-cordapp

Java
83
star
5

cordapp-template-java

A Java CorDapp Template. Extend it via the Hello, World tutorial: https://docs.corda.net/hello-world-introduction.html
Java
81
star
6

token-sdk

Corda Tokens SDK
Kotlin
80
star
7

corda-training-template

A template for the corda two day training course.
Java
78
star
8

cordapp-example

This repository is deprecated. The latest version of all the official CorDapp samples can be found in the official samples repository: https://github.com/corda/samples.
Java
76
star
9

samples-java

This repository contains multiple sample apps, from CorDapps that help you get started, all the way to demonstrating specific features and advanced usage.
Java
74
star
10

corda-runtime-os

Corda is a scalable, permissioned peer-to-peer (P2P) distributed ledger technology (DLT) platform that enables the building of applications that foster and deliver digital trust between parties in regulated markets.
Kotlin
66
star
11

corda-settler

Corda Off-ledger settlement for all the things
Kotlin
62
star
12

corda-training-solutions

Solutions for the two day Corda training
Java
59
star
13

samples-kotlin

This repository contains multiple sample apps, from CorDapps that help you get started, all the way to demonstrating specific features and advanced usage.
Kotlin
51
star
14

accounts

Accounts on Corda
Kotlin
36
star
15

cash-issuer

Project Cash
Kotlin
30
star
16

corda-kubernetes-deployment

Corda Kubernetes Deployment
Shell
29
star
17

corda-solutions

Corda Solutions
Kotlin
28
star
18

djvm

Deterministic Sandbox for the JVM
Kotlin
27
star
19

node-explorer

Corda Node Explorer
CSS
26
star
20

corda-gradle-plugins

Gradle plugins used by Corda and Cordapps
Kotlin
24
star
21

msr-vc

A copy of the verifiable computation projects from Microsoft Research, Pinnochio and Gepetto
C++
18
star
22

corda5-samples

This repository contains the Corda 5 sample apps, from CorDapps that help you get started, all the way to demonstrating specific features and advanced usage.
Java
13
star
23

bank-in-a-box

Reference CorDapp - Bank in a Box
Kotlin
12
star
24

corda-docs-portal

R3 product documentation.
HTML
12
star
25

corda-training-code

This repository contains the projects used with the guided course on Corda
Java
11
star
26

cenm-deployment

Corda Enterprise Network Manager (CENM) deployment
Shell
10
star
27

corda-api

Corda public API modules
Java
10
star
28

vscode-corda

Corda extension for Visual Studio Code
JavaScript
10
star
29

accounts-demo-supplychain

Kotlin
10
star
30

corda-ansible

Ansible role to install Corda
Ruby
10
star
31

cdl-example

Example CorDapp showing how to convert a CDL diagram into code
Kotlin
9
star
32

bn-extension

Kotlin
9
star
33

contract-sdk

Utility making writing Corda contracts a breeze.
Kotlin
9
star
34

CSDE-cordapp-template-kotlin

Kotlin Template Repo which provides the CorDapp Standard Development Environment (CSDE) and getting started CorDapp Template for Corda 5.
Kotlin
9
star
35

bpqs

BPQS - The Blockchained Post-Quantum Signature library
Kotlin
7
star
36

CSDE-cordapp-template-java

Java Template Repo which provides the CorDapp Standard Development Environment (CSDE) and getting started CorDapp Template for Corda 5.
Java
7
star
37

error-codes-web-app

Web application mapping error codes to available information
Kotlin
6
star
38

oracle-example

This repository is deprecated. The latest version of all the official CorDapp samples can be found in the official samples repository: https://github.com/corda/samples.
Kotlin
6
star
39

node-server

Corda Springboot and RPCClient server for DevEx tools
Java
5
star
40

openapi-sample

This sample is a develoepr preview of setting up a webapp using Braid server and OpenAPI generator.
JavaScript
5
star
41

corda-docs

Home of the public Corda documentation source for Corda open source, Corda Enterprise, and Corda Enterprise Network Manager (CENM).
JavaScript
5
star
42

TokenSDKDemo

Delivery vs Payment demo of the Token SDK using evolvable tokens and Money
Kotlin
4
star
43

barclays-derivhack

Barclays Derivhack Starter Application
Kotlin
4
star
44

corda5-cordapp-template-kotlin

Kotlin
4
star
45

training.corda.net

The Corda Training site
JavaScript
4
star
46

cordapp-client-template

A template for R3 clients to and take and adapt to their use-cases.
Kotlin
4
star
47

corda-tut2-solution-java

After completing part two of the Java Hello, World tutorial, this is what your repo should look like.
Java
3
star
48

reissue-sample-cordapp

Kotlin
3
star
49

confidential-identities

Kotlin
3
star
50

bootcamp-cordapp-2

New CorDapp for Bootcamps. Uses a car servicing use-case
Java
3
star
51

community-cordapps

These projects are built and maintained by the Corda Developer Community.
3
star
52

corda-tut2-solution-kotlin

After completing part two of the Kotlin Hello, World tutorial, this is what your repo should look like.
Kotlin
3
star
53

jira-create-issue-action

JavaScript
3
star
54

gallery-demo

As Corda 5 separates applications into distinct networks the need arises for reliable inter-operation between applications/networks. This repository demonstrates a cross-chain swap mechanism.
CSS
3
star
55

corda-utxo-ledger-extensions

We are building advanced contract state types, such as fungible and identifiable states for Corda 5, but they are a cordapp layer that sits on top of (and separate from) the API and runtime. The new repo will contain these advanced contract state types and UTXO ledger extensions.
Kotlin
3
star
56

reissue-cordapp

Kotlin
2
star
57

corda-tut1-solution-java

After completing part one of the Java Hello, World tutorial, this is what your repo should look like.
Java
2
star
58

samples-java-corda5

SCSS
2
star
59

corda5-solarsystem-contracts-demo

SCSS
2
star
60

flow-db

This repository is deprecated. The latest version of all the official CorDapp samples can be found in the official samples repository: https://github.com/corda/samples.
Kotlin
2
star
61

jmeter-sampler

Example code how to create custom JMeter samplers for the Corda Enterprise performance test suite.
Java
2
star
62

millionaires-problem

Java
1
star
63

cordman

A funny pacman-like javascript game, available under http://corda.games
JavaScript
1
star
64

auctionhouse

Auction House CorDapp
Kotlin
1
star
65

ping-pong

This repository is deprecated. The latest version of all the official CorDapp samples can be found in the official samples repository: https://github.com/corda/samples.
Kotlin
1
star
66

rec-orda

Kotlin
1
star
67

flow-http

This repository is deprecated. The latest version of all the official CorDapp samples can be found in the official samples repository: https://github.com/corda/samples.
Kotlin
1
star
68

quickstart

QuickStart Repository for Remote Training
HTML
1
star
69

cordapp-trial-framework

Tools to enable Cordapp Trial Partners
Shell
1
star
70

corda-cli-plugin-host

A Plugable CLI host for corda cli using pf4j and picocli
Groovy
1
star
71

obligation

Kotlin
1
star
72

corda-logic-app-adapter

An adapter linking Corda to Microsoft Logic Apps over Azure Service Bus.
Kotlin
1
star
73

corda-dev-prereqs

Helm chart for deploying Corda 5 prereqs
Smarty
1
star