-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(corda): add Corda ledger support
Primary Changes =============== 1. Corda all-in-one image Note: In this state of it it runs the full sample with all the nodes and web servers which ends up using 11GB of RAM so we will have to thin this down eventually once the Corda connector is otherwise passing the tests with this container. Once we are at that point we can start removing parts of the AIO container to reduce RAM usage and verify that the tests are still passing without issues or not. 2. Corda ledger connector server as a JVM app (uses the "kotlin-spring" generator template from OpenAPI) The only file that is non-generated in that folder is the service implementation called ApiPluginLedgerConnectorCordaServiceImpl.kt TODO: make sure the generated folder can be cleaned and regenerated without having to manually re-add the implementation file mentioned above. 3. The Typescript interfaces necessary for the NodeJS API server to be able to communicate with the JVM app in a transparent manner where higher level plugins can talk to Corda through the connector in Typescript without realizing that they are actually sending HTTP requests over the network to the JVM app. 4. Home-grown, JSON-embedded DSL is used to define the flow params. 5. Lots of to-dos still, but there are end to end tests passing and everything is working with containers. 6. Jar deployment is only partially supported for now: if the jar is already present on the node, then calling the jar deploy endpoint on the connector will make sure to add that jar to the classpath of the connector as well. If however the jar is not deployed on the corda node itself then it will no work just yet because the SSH connection is not yet implemented in the corda connector. Signed-off-by: Peter Somogyvari <[email protected]>
- Loading branch information
Showing
95 changed files
with
6,727 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,5 @@ cactus-openapi-spec.json | |
cactus-openapi-spec-*.json | ||
.npmrc | ||
*.log | ||
build/ | ||
.gradle/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 161 additions & 0 deletions
161
packages/cactus-plugin-ledger-connector-corda/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
# `@hyperledger/cactus-plugin-ledger-connector-corda` | ||
|
||
> TODO: description | ||
## Usage | ||
|
||
Take a look at how the API client can be used to run transactions on a corda ledger: | ||
`packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts` | ||
|
||
|
||
### Custom Configuration via Env Variables | ||
|
||
```json | ||
{ | ||
"cactus": { | ||
"corda": { | ||
"node": { | ||
"host": "localhost" | ||
}, | ||
"rpc": { | ||
"port": 10006, | ||
"username": "user1", | ||
"password": "test" | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
```sh | ||
SPRING_APPLICATION_JSON='{"cactus":{"corda":{"node": {"host": "localhost"}, "rpc":{"port": 10006, "username":"user1", "password": "test"}}}}' gradle test | ||
``` | ||
|
||
```json | ||
{ | ||
"flowFullClassName" : "net.corda.samples.example.flows.ExampleFlow${"$"}Initiator", | ||
"flowInvocationType" : "FLOW_DYNAMIC", | ||
"params" : [ { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.Integer" | ||
}, | ||
"primitiveValue" : 42, | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "REFERENCE", | ||
"jvmType" : { | ||
"fqClassName" : "net.corda.core.identity.Party" | ||
}, | ||
"primitiveValue" : null, | ||
"jvmCtorArgs" : [ { | ||
"jvmTypeKind" : "REFERENCE", | ||
"jvmType" : { | ||
"fqClassName" : "net.corda.core.identity.CordaX500Name" | ||
}, | ||
"primitiveValue" : null, | ||
"jvmCtorArgs" : [ { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "PartyB", | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "New York", | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "US", | ||
"jvmCtorArgs" : null | ||
} ] | ||
}, { | ||
"jvmTypeKind" : "REFERENCE", | ||
"jvmType" : { | ||
"fqClassName" : "org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl" | ||
}, | ||
"primitiveValue" : null, | ||
"jvmCtorArgs" : [ { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "EdDSA", | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "X.509", | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "MCowBQYDK2VwAyEAoOv19eiCDJ7HzR9UrfwbFig7qcD1jkewKkkS4WF9kPA=", | ||
"jvmCtorArgs" : null | ||
} ] | ||
} ] | ||
} ], | ||
"timeoutMs" : null | ||
} | ||
``` | ||
|
||
```json | ||
I 16:51:01 1 Client.main - nodeDiagnosticInfo= | ||
{ | ||
"version" : "4.6", | ||
"revision" : "85e387ea730d9be7d6dc2b23caba1ee18305af74", | ||
"platformVersion" : 8, | ||
"vendor" : "Corda Open Source", | ||
"cordapps" : [ { | ||
"type" : "Workflow CorDapp", | ||
"name" : "workflows-1.0", | ||
"shortName" : "Example-Cordapp Flows", | ||
"minimumPlatformVersion" : 8, | ||
"targetPlatformVersion" : 8, | ||
"version" : "1", | ||
"vendor" : "Corda Open Source", | ||
"licence" : "Apache License, Version 2.0", | ||
"jarHash" : { | ||
"offset" : 0, | ||
"size" : 32, | ||
"bytes" : "V7ssTw0etgg3nSGk1amArB+fBH8fQUyBwIFs0DhID+0=" | ||
} | ||
}, { | ||
"type" : "Contract CorDapp", | ||
"name" : "contracts-1.0", | ||
"shortName" : "Example-Cordapp Contracts", | ||
"minimumPlatformVersion" : 8, | ||
"targetPlatformVersion" : 8, | ||
"version" : "1", | ||
"vendor" : "Corda Open Source", | ||
"licence" : "Apache License, Version 2.0", | ||
"jarHash" : { | ||
"offset" : 0, | ||
"size" : 32, | ||
"bytes" : "Xe0eoh4+T6fsq4u0QKqkVsVDMYSWhuspHqE0wlOlyqU=" | ||
} | ||
} ] | ||
} | ||
``` | ||
|
||
## Building Docker Image Locally | ||
|
||
The `cccs` tag used in the below example commands is a shorthand for the | ||
full name of the container image otherwise referred to as `cactus-corda-connector-server`. | ||
|
||
From the project root: | ||
|
||
```sh | ||
DOCKER_BUILDKIT=1 docker build ./packages/cactus-plugin-ledger-connector-corda/src/main-server/ -t cccs | ||
``` |
76 changes: 76 additions & 0 deletions
76
packages/cactus-plugin-ledger-connector-corda/Request-Example-ExampleFlow-Initiator.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"flowFullClassName" : "net.corda.samples.example.flows.ExampleFlow$Initiator", | ||
"flowInvocationType" : "FLOW_DYNAMIC", | ||
"params" : [ { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.Integer" | ||
}, | ||
"primitiveValue" : 42, | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "REFERENCE", | ||
"jvmType" : { | ||
"fqClassName" : "net.corda.core.identity.Party" | ||
}, | ||
"primitiveValue" : null, | ||
"jvmCtorArgs" : [ { | ||
"jvmTypeKind" : "REFERENCE", | ||
"jvmType" : { | ||
"fqClassName" : "net.corda.core.identity.CordaX500Name" | ||
}, | ||
"primitiveValue" : null, | ||
"jvmCtorArgs" : [ { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "PartyB", | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "New York", | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "US", | ||
"jvmCtorArgs" : null | ||
} ] | ||
}, { | ||
"jvmTypeKind" : "REFERENCE", | ||
"jvmType" : { | ||
"fqClassName" : "net.corda.samples.example.PublicKeyImpl" | ||
}, | ||
"primitiveValue" : null, | ||
"jvmCtorArgs" : [ { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "EdDSA", | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "java.lang.String" | ||
}, | ||
"primitiveValue" : "X.509", | ||
"jvmCtorArgs" : null | ||
}, { | ||
"jvmTypeKind" : "PRIMITIVE", | ||
"jvmType" : { | ||
"fqClassName" : "[B" | ||
}, | ||
"primitiveValue" : "MCowBQYDK2VwAyEAoOv19eiCDJ7HzR9UrfwbFig7qcD1jkewKkkS4WF9kPA=", | ||
"jvmCtorArgs" : null | ||
} ] | ||
} ] | ||
} ], | ||
"timeoutMs" : null | ||
} |
Oops, something went wrong.