Corda Token SDK
Reminder
This project is open source under an Apache 2.0 licence. That means you can submit PRs to fix bugs and add new features if they are not currently available.
What is the token SDK?
The token SDK exists to make it easy for CorDapp developers to create CorDapps which use tokens. Functionality is provided to create token types, then issue, move and redeem tokens of a particular type.
The tokens SDK comprises three CorDapp JARs:
- Contracts which contains the base types, states and contracts
- Workflows which contains flows for issuing, moving and redeeming tokens as well as utilities for the above operations.
- Token Builder which contains builder classes and utility functions for creating token objects
- Selection that contains both database and in memory token selection of fungible tokens
The token SDK is intended to replace the "finance module" from the core Corda repository.
For more details behind the token SDK's design, see here.
How to use the SDK?
Tokens SDK binaries for the current Developer Preview version of Corda 5 are published to R3's corda-lib Artifactory and can be used from there.
Adding token SDK dependencies to an existing CorDapp
- Add a repository definition for R3's corda-lib Artifactory:
repositories {
maven { url 'https://software.r3.com/artifactory/corda-lib' }
}
- Add a variable for the tokens release group and the version you wish to use.
buildscript {
ext {
tokens_release_version = '2.0.0-DevPreview-1.0'
tokens_release_group = 'com.r3.corda.lib.tokens'
}
}
-
Now, you can add the
token-sdk
dependencies to thedependencies
block in each module of your CorDapp.For contract modules add:
cordapp "$tokens_release_group:tokens-contracts:$tokens_release_version"
In your workflow
build.gradle
add:cordapp "$tokens_release_group:tokens-workflows:$tokens_release_version"
You can also add the token selection and token builder to your workflows:
cordapp "$tokens_release_group:tokens-selection:$tokens_release_version" cordapp "$tokens_release_group:tokens-builder:$tokens_release_version"
Building locally and installing the token SDK binaries
If you wish to build the token-sdk
from source then do the following to
publish binaries to your local maven repository:
git clone http://github.com/corda/corda5-token-sdk
cd corda5-token-sdk
./gradlew clean install
You then need to add maven-local()
to your repositories and reference the version you published
locally in your CorDapp build configuration to use your local build.
Where to go next?
Simple delivery versus payment tutorial