Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(corda): add Corda ledger support #608

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ cactus-openapi-spec.json
cactus-openapi-spec-*.json
.npmrc
*.log
build/
.gradle/
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"build:dev:plugin-consortium-manual": "lerna exec --stream --scope '*/*manual-consortium' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'",
"build:dev:example-supply-chain-backend": "lerna exec --stream --scope '*/*example-supply-chain-b*' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --display-modules --env=dev --target=node --config ../../webpack.config.js'",
"build:dev:sdk": "lerna exec --stream --scope '*/*sdk' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'",
"build:dev:plugin-ledger-connector-corda": "lerna exec --stream --scope '*/*connector-corda' -- 'del-cli dist/** && npm run tsc && webpack --env=dev --target=node --config ../../webpack.config.js'",
"test:plugin-ledger-connector-corda": "tap --jobs=1 --timeout=60 \"packages/cactus-*-corda/src/test/typescript/{unit,integration}/\"",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack:dev": "lerna run webpack:dev",
"webpack:dev:web": "lerna run webpack:dev:web",
Expand Down
161 changes: 161 additions & 0 deletions packages/cactus-plugin-ledger-connector-corda/README.md
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
```
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
}