The Fabric Smart Client is a new Fabric Client that lets you focus on the business processes and simplifies the development of Fabric-based distributed application.

Fabric Smart Client

License Go Report Card Go CodeQL

The Fabric Smart Client (FSC, for short) is a new Fabric client-side component whose objective is twofold.

  1. FSC aims to simplify the development of Fabric-based distributed application by hiding the complexity of Fabric and leveraging Fabric's Hidden Gems that too often are underestimated if not ignored.
  2. FSC wants to allow developers and/or domain experts to focus on the business processes and not the blockchain technicalities.

Disclaimer

Fabric Smart Client 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 list of features.

Useful Links

  • Documentation: Discover the design principles of the Fabric Smart Client based on the Hidden Gems of Hyperledger Fabric.
  • Examples: Learn how to use the Fabric Smart Client via examples. There is nothing better than this.
  • Feedback: Your help is the key to the success of the Fabric Smart Client. Submit your issues here
  • Fabric Token SDK: Do you want to develop Token-Based Distributed application with simplicity and joy? Check our Token SDK out here.

Motivation

Hyperledger Fabric is a permissioned, modular, and extensible open-source DLT platform. Fabric architecture follows a novel execute-order-validate paradigm that supports distributed execution of untrusted code in an untrusted environment. Indeed, Fabric-based distributed applications can be written in any general-purpose programming language.

Developing applications for Hyperledger Fabric is often hard, sometimes painful. Fabric is a very powerful ecosystem whose building blocks must be carefully orchestrated to achieve the desired results. Currently, the Fabric Client SDKs are too limited. They do not offer any advanced capabilities to let the developers focus on the application business processes, and harness the full potential of Fabric.

What would happen if the developers could use a Smart(er) Fabric Client that offers:

  • A high level API that hides the complexity of Fabric;
  • A Peer-to-Peer infrastructure that let Fabric Clients and Endorsers talk to each as required by the business processes;
  • Advanced transaction orchestration;
  • A simplified model to interact with chaincodes;
  • A State-based programming model that let you forget about RW sets and focus on business objects and their interactions?

Developing Fabric-based distributed applications would become simpler and joyful. If you are a domain expert, the Fabric Smart Client hides the complexity of Fabric and allows you to focus on the business interactions. If you are a skilled software engineer, you will be able to leverage the full power of Fabric.

Use the Fabric Smart Client

Install

The Fabric Smart Client can be downloaded using go get as follows:

go get github.com/hyperledger-labs/fabric-smart-client

The above command clones the repo under $GOPATH/github.com/hyperledger-labs/fabric-smart-client.

We recommend to use go 1.14.13. We are testing FSC also against more recent versions of the go-sdk to make sure FSC works properly.

Makefile

FSC is equipped with a Makefile to simplify some tasks. Here is the list of commands available.

  • make checks: check code formatting, style, and licence header.
  • make unit-tests: execute the unit-tests.
  • make integration-tests: execute the integration tests. The integration tests use ginkgo. Please, make sure that $GOPATH/bin is in your PATH env variable.
  • make clean: clean the docker environment, useful for testing.

Executes the above from $GOPATH/github.com/hyperledger-labs/fabric-smart-client.

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.

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

Owner
Hyperledger Labs provides a space where work can easily be started without the creation of an official Hyperledger project.
null
Comments
  • Error while running Tests for PingPong

    Error while running Tests for PingPong

    I am new to fabric-smart-client. I was trying out he PingPong on my VM with following details: OS: Ubuntu 18 VM.

    • Go version go1.14.6 linux/amd64
    • build-essential
    • fabric-smart-client cloned at /home/ubuntu,

    I executed the 'go test' command at path /home/ubuntu/fabric-smart-client/integration/fsc/pingpong

    Error Received:

    Summarizing 3 Failures:
    
    [Panic!] EndToEnd Network-based Ping pong [It] generate artifacts & successful pingpong
    /home/ubuntu/fabric-smart-client/integration/integration.go:209
    
    [Panic!] EndToEnd Network-based Ping pong [It] generate artifacts & successful pingpong with Admin
    /home/ubuntu/fabric-smart-client/integration/integration.go:209
    
    [Panic!] EndToEnd Network-based Ping pong [It] load artifact & successful pingpong
    /home/ubuntu/fabric-smart-client/integration/integration.go:209
    
    

    errorlog.txt

  • fabric-sdk: do not add resolvers for Fabric peers

    fabric-sdk: do not add resolvers for Fabric peers

    This PR updates NWO to remove from the resolvers references to Fabric peers. The FPC integration was relaying in these resolvers. To fix this, the PR updates the FPC integration to leverage Fabric Discovery.

    In addition, a flaky unit-test has been disabled.

    Signed-off-by: Angelo De Caro [email protected]

  • Should not have to use replace in go.mod to build a simple example

    Should not have to use replace in go.mod to build a simple example

    As a user I want to create a single fabric smart client application that consists of 1 or more nodes. I should be able to declare my dependency on fabric-smart-client as that is the only direct dependency I have as follows

    module myfsc
    
    go 1.17
    
    require (
    	github.com/hyperledger-labs/fabric-smart-client v0.0.0-20220829121531-bfb66997d570
    	github.com/pkg/errors v0.9.1
    )
    

    however this fails due to various dependency clashes and the only way to resolve it appears to be to add the following replacements

    replace (
    	github.com/fsouza/go-dockerclient => github.com/fsouza/go-dockerclient v1.4.1
    	github.com/go-kit/kit => github.com/go-kit/kit v0.7.0
    	github.com/hyperledger/fabric => github.com/hyperledger/fabric v1.4.0-rc1.0.20210722174351-9815a7a8f0f7
    	github.com/hyperledger/fabric-protos-go => github.com/hyperledger/fabric-protos-go v0.0.0-20201028172056-a3136dde2354
    	go.etcd.io/etcd => go.etcd.io/etcd v0.5.0-alpha.5.0.20181228115726-23731bf9ba55
    )
    

    I am guessing that this comes about because the fsc code base has not kept upto date with the fabric code base in some way.

    There are 2 issues here, 1 short team and 1 long term short term issue: The replace information should be documented (not hidden somewhere examples as this is a definite usability requirement) long term issue: The need to specify replacements should be removed and there needs to be a detachment from the fabric code base. I didn't think fabric code was designed to be imported or meant to be imported.

  • Remove need for GOPATH to be set

    Remove need for GOPATH to be set

    If GOPATH is set and fabric-smart-client is a subdir in that GOPATH then it must still follow the pattern src/github.com/hyperledger-labs/fabric-smart-client

    GOPATH can be set and not contain fabric-smart-client (means the go module cache can be stored elsewhere)

    GOPATH not being set will default to $HOME/go and above rules apply

    It still requires to be checked out as fabric-smart-client still though, see TODO

    Signed-off-by: D [email protected]

  • Add Fabric Private Chaincode support

    Add Fabric Private Chaincode support

    Fabric Private Chaincode allows to execute chaincode using trusted execution environments (i.e., Intel SGX). This adds another level of protection to the smart contract and its data.

    The idea is to enable support for Fabric Private Chaincode to allow FSC users to develop and orchestrate applications with enhanced security requirements which can be satisfied using trusted execution.

  • Make IsFinal work for real

    Make IsFinal work for real

    The way how we implement broadcasting a transaction and then waiting for it to commit is inherently flawed:

    1. We send it to the orderer
    2. We connect to the orderer and start listening for blocks starting from the last block.

    After (1) and before (2) the transaction might already enter a block and then (2) will miss it. Moreover, the way (2) is implemented is connecting to the peer's delivery service and it just doesn't scale well when many transactions should be sent and waited for.

    Implemented a pub-sub mechanism that is piggybacking on the already existing background task that pulls blocks and parses them.

    Signed-off-by: Yacov Manevich [email protected]

  • Method `CallView` from package `web` always replace my input's to value: `

    Method `CallView` from package `web` always replace my input's to value: `"hi"`

    FSC-node always get input that contain only "hi" value, no matter what input values/data we try to send via method CallView from package web. We saw that here looks like value "hi" is hard-coded https://github.com/hyperledger-labs/fabric-smart-client/blob/b523bd306ea224d3ff8f61645bbc0be13fe54662/platform/view/services/client/web/client.go#L77 P.S. If we change: http.NewRequest(http.MethodPut, url, bytes.NewBuffer([]byte("hi"))) to http.NewRequest(http.MethodPut, url, bytes.NewBuffer(in)) we able to get expected input values/data on FSC node

  • Go dependency problem

    Go dependency problem

    I am experiencing issues when building and running a sample application that uses Fabric Smart Client.

    I would like to build the application outside the FSC repo and, thus, use FSC as a go dependency. See here my go.mod

    module example.com/irb-flow
    
    go 1.16
    
    require (
    	github.com/hyperledger-labs/fabric-smart-client v0.0.0-20210902095918-253c368629f0
    	github.com/stretchr/testify v1.7.0
    )
    

    The full source can be found here.

    When running go test -v . I get the following error:

      irb-fsc git:(main) ✗ go test -v .
    # github.com/hyperledger/fabric/discovery/client
    ../../../../../../../pkg/mod/github.com/hyperledger/[email protected]/discovery/client/api.go:43:28: undefined: discovery.ChaincodeCall
    ../../../../../../../pkg/mod/github.com/hyperledger/[email protected]/discovery/client/client.go:616:25: undefined: discovery.ChaincodeCall
    FAIL	example.com/irb-flow [build failed]
    

    Running the same code from the FSC/integration/fabric without the go.mod seem to work nicely (except of other issues with the code).

  • Enable staticcheck via make checks

    Enable staticcheck via make checks

    Runs staticcheck with make checks.

    Currently, this is supposed to fail via CI until #50 is resolved.

    Signed-off-by: Marcus Brandenburger [email protected]

  • Fabric upgrade and cleanup

    Fabric upgrade and cleanup

    • replace some old fabric idemix deps
    • remove legacy zookeeper/kafka from integration test suite
    • remove dep pin for go-kit since we use a pretty old version
    • pin Fabric version to 2.4.4 including fabric protos
  • Test fail on Pingpong example

    Test fail on Pingpong example

    Hi, I am testing FSC on Ubuntu 20.04 and I met this error(my Go version is 1.16.9):

    Output:
        package usr/local/go/pkg/pkg/mod/github.com/hyperledger-labs/[email protected]/integration/fsc/pingpong/cmd/responder: can only use path@version syntax with 'go get' and 'go install' in module-aware mode
    
    

    and finally:

    Ran 5 of 5 Specs in 39.811 seconds
    FAIL! -- 2 Passed | 3 Failed | 0 Pending | 0 Skipped
    

    Thank for your work!

  • Retrieve public MSP information from channel config for fabric driver resolvers

    Retrieve public MSP information from channel config for fabric driver resolvers

    For the fabric driver resolvers you might have an entry such as

        endpoint:
          resolvers: 
          - name: approver
            domain: org1.example.com
            identity:
              mspID: Org1MSP
              path: /home/dave/github-cloned/fabric-smart-client/samples/fabric/iou/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]
    

    Currenly the path either refers to the the public cert of the signer or the nodes public msp (ie without any private keys). Access to the public MSP is required in case the signer certificate is sanitized by fabric and thus doesn't match the certificate stored in the MSP file system.

    It would be better to obtain the public MSP from the channel configuration instead

  • Ensure that any missing or incorrectly specified key in core.yaml results in an appropriate error message

    Ensure that any missing or incorrectly specified key in core.yaml results in an appropriate error message

    Looking at some of the code, I have concerns that there isn't enough error checking on missing entries or incorrectly specified entries in core.yaml that could result in cryptic errors or unhelpful panic messages (eg index out of range).

    This issue is about testing and adding checks to ensure that this is the case

    (issues where optional keys are mandatory should also be addressed as well)

    kind of a followon to #406

  • fabric-sdk: delivery, restarted from latest seen block

    fabric-sdk: delivery, restarted from latest seen block

    currently, if the delivery connection is dropped for some reason, the connection is reestablish starting from the block of the latest known transaction to the FSC node. But if the node didn't crash so far, it can restart from the latest block seen.

Akroma GO client - Akroma is an EVM based application development platform (smart-contracts).

Akroma Akroma is an EVM based application development platform (smart-contracts). Akroma will utilize a Masternode system, and build out an Oracle pla

Dec 11, 2022
Hyperledger-fabric chaincode-devmode-contractapi - Hyperledger fabric chaincode devmode contractapi

All instructions below are composed by referring to https://hyperledger-fabric.r

Mar 11, 2022
An application based on fabric Hyperledger

An application based on fabric Hyperledger

Oct 31, 2021
A smart contract development toolchain for Go

ethgen - A smart contract development toolchain for Go A simple yet powerful toolchain for Go based smart contract development Compile solidity contra

Sep 14, 2022
OpenZeppelin Contracts is a library for secure smart contract development.

A library for secure smart contract development. Build on a solid foundation of community-vetted code. Implementations of standards like ERC20 and ERC

Jan 5, 2023
A phoenix Chain client based on the go-ethereum fork,the new PoA consensus engine is based on the VRF algorithm.

Phoenix Official Golang implementation of the Phoenix protocol. !!!The current version is for testing and developing purposes only!!! Building the sou

Apr 28, 2022
Yet another Binance Smart Chain client based on TrustFi Network

TrustFi Smart Chain The goal of TrustFi Smart Chain is to bring programmability and interoperability to Binance Chain. In order to embrace the existin

Mar 27, 2021
A Binance Smart Chain client based on the go-ethereum fork

A Binance Smart Chain client based on the go-ethereum fork

Dec 31, 2022
A Binance Smart Chain client based on the erigon fork

Erigon Erigon is an implementation of Ethereum (aka "Ethereum client"), on the efficiency frontier, written in Go. System Requirements Usage Getting S

Sep 17, 2022
A Binance Smart Chain client based on the go-ethereum fork

Binance Smart Chain The goal of Binance Smart Chain is to bring programmability and interoperability to Binance Chain. In order to embrace the existin

Feb 8, 2022
XT Smart Chain, a chain based on the go-ethereum fork

XT Smart Chain XT Smart Chain (XSC) is a decentralized, high-efficiency and ener

Dec 28, 2022
FabricPing: Network tools for service fabric

FabricPing Network debugging tools for Service Fabric Install Windows powershell

Sep 25, 2022
A Gomora template for building dApps and web3-powered API and smart contract listeners

Gomora dApp A Gomora template for building dApps and web3-powered API and smart contract listeners Local Development Setup the .env file first cp .env

Feb 15, 2022
Arbitrum is a Layer 2 cryptocurrency platform that makes smart contracts scalable, fast, and private.
Arbitrum is a Layer 2 cryptocurrency platform that makes smart contracts scalable, fast, and private.

Arbitrum is a Layer 2 cryptocurrency platform that makes smart contracts scalable, fast, and private. Arbitrum interoperates closely with Ethereum, so Ethereum developers can easily cross-compile their contracts to run on Arbitrum. Arbitrum achieves these goals through a unique combination of incentives, network protocol design, and virtual machine architecture.

Jan 8, 2023
Accompanying repository for the "Build Ethereum From Scratch - Smart Contracts and More" course by David Katz
Accompanying repository for the

Build Ethereum From Scratch - Smart Contracts and More This repository accompanies the "Build Ethereum From Scratch - Smart Contracts and More" course

Dec 7, 2022
The goal of Binance Smart Chain is to bring programmability and interoperability to Binance Chain

Binance Smart Chain The goal of Binance Smart Chain is to bring programmability

Aug 17, 2022
Troon-NFT-Contract is deployed on Flow Blockchain, which is a white-label smart-contract for NFTs with an addition layer of Brand, Schema and Template

Overview Summary of NFTContract NFTContract is a Non Fungible Token (NFT) standard for Flow blockchain. It offers a powerful set while keeping unneces

Jan 4, 2022
Arche - Smart Hybrid Workforce Manager: A system that aims to provide companies an easy to use platform for managing company resources by allowing employees to book company spaces and resources.
Arche - Smart Hybrid Workforce Manager: A system that aims to provide companies an easy to use platform for managing company resources by allowing employees to book company spaces and resources.

Description Smart Hybrid Workforce Manager is a system that aims to provide companies an easy to use system for managing company resources by allowing

Dec 8, 2022
Eunomia is a distributed application framework that support Gossip protocol, QuorumNWR algorithm, PBFT algorithm, PoW algorithm, and ZAB protocol and so on.

Introduction Eunomia is a distributed application framework that facilitates developers to quickly develop distributed applications and supports distr

Sep 28, 2021