Running Productivity Apps on Hyperledger Fabric

What do you think of when you hear “smart contracts”? Cryptocurrencies? Tokenization of assets? Automating financial agreements?

But what could be more critical to your business than the tools you use to get your tasks done? Whether it’s a to-do list, internal communications, or even tracking time-off, these are key processes at the heart of everyday organizations. Any application or workflow that involves collaboration — between organizations, individuals, or even software systems — can benefit from a robust and secure definition of the processes involved.

OpenWork is a suite of smart contract-powered productivity apps. Thanks to the fact that the smart contracts are written in DAML, they can run on Fabric, Sawtooth, and Besu thanks to the community integrations. For more information about OpenWork, check out our series of posts on why we did this, a dive into the apps and their features, and where we plan on taking OpenWork.

In this post, we’ll walk you through the process of getting Board, OpenWork’s Kanban-style project management app, running locally on a Hyperledger Fabric network (you can see a running version here). The final stack will look something like the following diagram.

Getting Set Up

Prerequisite services:

  • Git
  • Docker
  • Scala with SBT
  • The DAML SDK
  • Python 3 with the dazl library installed (pip3 install dazl)
  • Node and Yarn

Files:

1. Running the Fabric Network

The DAML on Fabric repo comes with a test fixture for running a local 5 node deployment:

$ cd daml-on-fabric/src/test/fixture
$ ./restart_fabric.sh

Once that’s up and running, you’ll need to start the DAML service. One bit of housekeeping: you might need to update sbt.version in project/build.properties to match your local SBT version (latest is 1.3.8). Next, we’ll want to start the DAML Ledger API Server and load the ChainCode onto the endorser peers. In the root daml-on-fabric folder:

 $ sbt "run --port 6865 --role provision,time,ledger,explorer danban/quickstart/danban-upgrade-3.0.0.dar" 

2. Prime the Ledger

We’ll need some data on the ledger to get started. Some parties will need to be onboarded onto the ledger and then a new app contract will need to be instantiated. The fabric-quickstart folder contains some simple scripts to simplify this process:

$ cd danban/quickstart
$ daml ledger allocate-parties
$ python3 setup.py

3. Running the Frontend

Finally, we’ll want to run the frontend. It’s a fairly standard client-side Web app, but as the ledger API is gRPC, we’ll need an HTTP server for the app to talk to. To start the HTTP JSON API server:

$ cd ../client
$ daml json-api --ledger-host=localhost --ledger-port=6865 --http-port=7575
$ yarn install && yarn start

The app should open in your browser on a login page. DAML ledgers are flexible regarding user authentication, but the examples here use a JWT based scheme (you can read more here). For this example, you can log in as the user “Alice” with the following JWT:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJmYWJyaWMtbGVkZ2VyIiwiYXBwbGljYXRpb25JZCI6ImZvb2JhciIsImFjdEFzIjpbIkFsaWNlIl19fQ.6I3_M0PCpc3tqqFf1TbHZ84GQOkOl6KpmuVyoRYLvSg

Instructions for how to create tokens for other users are detailed in the documentation here.

What’s Next

Let’s say you’re up and running, planning your project on your Fabric-powered Kanban tool. Great! But now you want to collaborate with another team, already running a Hyperledger Besu network. You could try and agree on a common framework to use (good luck!), but DAML gives you another way — synchronizing data from the apps across running Hyperledger networks on different frameworks. This is going to be possible soon with our work on DAML interoperability, which we recently previewed at the Hyperledger Global Forum.

OpenWork is just at the start of a process to see how far smart contract-powered productivity apps can go. There are features to be built and more apps to be added to the suite. We’d love your support. If you’re a developer or a user and you want to get involved, check out the OpenWork page for our repos and contact resources.

Back to all blog posts