Skip to content

The Fabric Token SDK is a set of API and services that lets developers create token-based distributed application on Hyperledger Fabric.

License

Notifications You must be signed in to change notification settings

hyperledger-labs/fabric-token-sdk

Fabric Token SDK

License Go Report Card Go CodeQL

The Fabric Token SDK provides a collection of APIs and services that streamline development for token-based distributed applications.

Disclaimer

Fabric Token SDK has not been audited and is provided as-is, use at your own risk. The project will be subject to rapid changes to complete the open-sourcing process, and the list of features.

Useful Links

  • Documentation: Discover the design principles of the Fabric Token SDK.

  • Fabric Samples Token SDK sample application is the quickest way to get a full network running with a REST API to issue, transfer and redeem tokens right away.

  • Feedback: Your help is the key to the success of the Fabric Token SDK.

    • Submit your issues here.
    • Found a bug? Need help to fix an issue? You have a great idea for a new feature? Talk to us! You can reach us on Discord in #fabric-token-sdk.
  • Fabric Smart Client: The Token SDK leverages the Fabric Smart Client for transaction orchestration, storing tokens and wallets, and more. Check it out.

Getting started

Clone the code and make sure it is on your $GOPATH. (Important: we assume in this documentation and default configuration that your $GOPATH has a single root-directory!). Sometimes, we use $FTS_PATH to refer to the Fabric Token SDK repository in your filesystem.

export FTS_PATH=$GOPATH/src/github.com/hyperledger-labs/fabric-token-sdk
git clone https://github.com/hyperledger-labs/fabric-token-sdk.git $FTS_PATH

Further information

Fabric Token SDK uses a system called NWO from Fabric Smart Client for its integration tests and samples to programmatically create a fabric network along with the fabric-smart-client nodes. The current version of fabric that is tested can be found in the project Makefile set in the FABRIC_VERSION variable.

In order for a fabric network to be able to be created you need to ensure you have downloaded the appropriate version of the hyperledger fabric binaries from Fabric Releases and unpack the compressed file onto your file system. This will create a directory structure of /bin and /config. You will then need to set the environment variable FAB_BINS to the bin directory. For example if you unpacked the compressed file into /home/name/fabric then you would

export FAB_BINS=/home/name/fabric/bin

Do not store the fabric binaries within your fabric-token-sdk cloned repo as this will cause problems running the samples and integration tests as they will not be able to install chaincode.

Almost all the samples and integration tests require the fabric binaries to be downloaded and the environment variable FAB_BINS set to point to the directory where these binaries are stored. One way to ensure this is to execute the following in the root of the fabric-token-sdk project

make download-fabric
export FAB_BINS=$PWD/../fabric/bin

You can also use this to download a different version of the fabric binaries for example

FABRIC_VERSION=2.5 make download-fabric

If you want to provide your own versions of the fabric binaries then just set FAB_BINS to the directory where all the fabric binaries are stored.

Utilities

  • tokengen is an utility for generating Fabric Token-SDK material. It is provided as a means of preconfiguring public parameters, token chaincode, and so. It would normally not be used in the operation of a production network.

Additional Resources

  • (March 17, 2022) Hyperledger in-Depth: Tokens in Hyperledger Fabric: What’s possible today and what’s coming: Tokenizing the physical world is a hot blockchain topic in the industry, especially as it relates to the trade of tokens as a basis of new forms of commerce. In this Hyperledger Foundation member webinar, the IBM Research team describes in this webinar what tokenization use cases are possible with Hyperledger Fabric today, and what enhancements are in the works (aka Fabric Token SDK).
  • (October 12, 2023) How to create a currency management app and deploy it to a Hyperledger Fabric network: In this comprehensive guide, we'll walk you through two essential aspects of the Fabric Token-SDK. Firstly, you'll learn how to develop a straightforward token application to manage a currency. You'll grasp the fundamentals of creating tokens, and implementing transaction logic using the Fabric Token-SDK. Once you've mastered the application development, we'll then show you how to effortlessly deploy it in your existing Fabric network, ensuring a seamless integration with your blockchain infrastructure. By the end of this tutorial, you'll be equipped with the skills to expand your blockchain capabilities and unleash the true potential of decentralized currency management. (Refers to Fabric Samples)

Motivation

Hyperledger Fabric: Blockchain Built for Business

Hyperledger Fabric (https://hyperledger-fabric.readthedocs.io/) is an open-source platform designed for permissioned blockchain networks. It offers a modular and extensible architecture, allowing for customization and future growth. Unlike traditional blockchains, Fabric applications can be written in any general-purpose programming language, making them more accessible to developers.

Beyond Cryptocurrencies: Tokenizing the World

While blockchain is often associated with cryptocurrencies, its potential extends far beyond. Fabric allows for the creation of tokens that represent real-world assets, both fungible (like loyalty points) and non-fungible (like unique digital artwork). This opens doors for new business models and unlocks additional value from existing assets.

The Challenge: Building Tokenized Applications

Developing applications that leverage tokens on Hyperledger Fabric can be complex. Fabric lacked a built-in SDK for creating and managing tokens, forcing developers to build solutions from scratch. This not only led to wasted effort with duplicated code, but also exposed applications to potential security vulnerabilities.

Introducing the Fabric Token SDK: Streamlining Tokenized Development (and Beyond)

The Fabric Token SDK has evolved beyond its initial focus on Hyperledger Fabric. It now empowers developers with the following capabilities across various platforms, including permissioned blockchains like Fabric and even centralized systems like Orion:

  • Tokenization Made Easy: Create tokens representing any type of asset, be it physical or digital.
  • Privacy by Design: Select the appropriate privacy level for your specific use case, without modifying your application logic.
  • Peer-to-Peer Transactions: Orchestrate token transfers directly between users, streamlining the process.
  • Atomic Swaps: Facilitate secure exchanges of different tokens without relying on intermediaries.
  • Transaction Auditing: Review transactions before they are finalized, ensuring accuracy and compliance.
  • Interoperability: Connect with token systems on other blockchain networks, fostering broader ecosystems.
  • Seamless Integration: Add a token layer to existing applications, regardless of platform, with minimal effort.

With a robust Fabric Token SDK, developing secure and efficient enterprise-grade tokenized applications becomes a reality, offering flexibility for developers to choose the platform that best suits their needs.

Testing Philosophy

Write tests. Not too many. Mostly Integration

We also believe that when developing new functions running tests is preferable than running the application to verify the code is working as expected.

For more information about our integration tests, look here.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the Apache 2 License - see the LICENSE file for details

About

The Fabric Token SDK is a set of API and services that lets developers create token-based distributed application on Hyperledger Fabric.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages