/FabricSharp

Enhanced Hyperledger Fabric

Primary LanguageGoApache License 2.0Apache-2.0

Overview

FabricSharp (hash) project is a variant of Hyperledger Fabric 2.2, a permissioned blockchain platform from Hyperledger. Compared with the vanilla version, FabricSharp supports fine-grained secure data provenance, sharding, smart transaction management, use of trusted hardware (eg. SGX), and a blockchain native storage engine called ForkBase, to boost system performance.

Thanks to colleagues from MediLOT, NUS, SUTD, BIT, Zhejiang University, MZH Technologies and other organizations for their contributions.

Quick Start

  • Build the peer docker image
make peer-docker # Will build an image hyperledger/fabric-sharp-peer:2.2.0
  • Build the orderer docker image
make orderer-docker # Will build an image hyperledger/fabric-sharp-orderer:2.2.0

If docker run hyperledger/fabric-sharp-peer:2.2.0 peer version shows a line of Version: 2.2.0(SHARP), then the building process is successful. And so is the orderer image.

NOTE: FabricSharp relies on ForkBase[3] as the storage engine, which is close-sourced. Hence FabricSharp can only be built and run within the docker container.

Architecture

architecture

Usage

Provenance-dependent Smart Contract

This chaincode demonstrates a Golang contract on token management. It captures and queries the provenance information. Note that we instrument the original shim package for the provenance managenent. So the imported package is our github.com/RUAN0007/fabric-chaincode-go, instead of the official github.com/hyperledger/fabric-chaincode-go.

Smart Scheduler

We require users to set bash environment variable $CC_TYPE for each run of orderer and peer. There are five optional value for $CC_TYPE, each corresponding to a transaction scheduler described in branch sigmod20.

  • original: the original FIFO scheduler
  • fpp: the scheduler proposed by Fabric++.
  • occ-standard: one of the schedulers migrated from the OCC database
  • occ-latest: one of the schedulers migrated from the OCC database
  • occ-sharp: our state-of-the-art scheduler.

DB type

We add two options for STATEDATABASE: Provleveldb and UstoreDB. Both support provenance-dependent smart contracts and five schedulers. Provleveldb extends the existing leveldb to store the data provenance. Ustoredb relies on ForkBase. FabricSharp is compatible with the existing two options: goleveldb and CouchDB. But both do not support provenance management. And both are only compatible with original scheduler.

To work with any occ-*-typed scheduler, users must set a directory path $MV_STORE_PATH for the LevelDB instance. The instance implements the multi-versioned storage, used to compute the transaction dependency. The directory will be emptied every time that the docker container runs

When CC_TYPE=occ-sharp, users may set $TXN_SPAN_LIMIT to restrict the max block span of a transaction. By default, it is 10.

For any cases, users can optionally control the block size by setting $BLOCK_SIZE. Otherwise, the transactions per block is configured at configtx.yaml.

Progress

The current master branch incorporates the optimization from [2] and [7] on the basis of Fabric v2.2.0. We dedicate another branch vldb19, which, based on v1.3.1, shows more details only about [2], including the experimental baseline, scripts, chaincode examples and so on. Similarly, branch sigmod20, also based on v1.3.1, is dedicated for [7].

We will soon merge the optimization in [1] to this master branch and similarly dedicate another branch for [1].

Previous Official Readme

Other

Refer to YCSB and Smallbank for contract codes utilized in [6] to benchmark the original Fabric v2.2.

Papers.