GithubHelp home page GithubHelp logo

liuhangyu / fabric-sdk-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hyperledger/fabric-sdk-go

0.0 1.0 0.0 4.53 MB

Read-only mirror of https://gerrit.hyperledger.org/r/#/admin/projects/fabric-sdk-go

Home Page: https://hyperledger.org

License: Apache License 2.0

Makefile 0.57% Go 97.96% Shell 1.47%

fabric-sdk-go's Introduction

Hyperledger Fabric Client SDK for Go

Build Status Go Report Card GoDoc

This SDK enables Go developers to build solutions that interact with Hyperledger Fabric.

Getting started

Obtain the client SDK packages for Fabric and Fabric CA.

# Hyperledger Fabric client package
go get -u github.com/hyperledger/fabric-sdk-go/fabric-client

# Hyperledger Fabric CA client package
go get -u github.com/hyperledger/fabric-sdk-go/fabric-ca-client

You're good to go, happy coding! Check out the examples for usage demonstrations.

Examples

  • E2E Test and Base Test: Part of the E2E tests included with the Go SDK.
  • CLI: An example CLI for Fabric built with the Go SDK.
  • More examples needed!

Community

  • Discussion is happening in Rocket Chat.
  • Issue tracking is handled in Jira.
  • Active development occurs in the Gerrit repository.

Client SDK

Compatibility

This client SDK was last tested and found to be compatible with the following Hyperledger Fabric commit levels:

  • fabric: v1.0.0-alpha
  • fabric-ca: v1.0.0-alpha

Running the test suite

# In the Fabric SDK Go directory
cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/

# Running test suite
make

# Clean test suite run artifacts
make clean

Contributing to the Go SDK

If you want to contribute to the Go SDK, please run the test suite and submit patches to the Gerrit git repostory for review. For general guidelines, please refer to the Fabric project's contribution page.

You need:

  • Go
  • Make
  • Docker
  • Docker Compose
  • Git

Gerrit Git repository

To contribute patches, you will need to clone (or add a remote) from Gerrit with authentication.

Running a portion of the test suite

# In the Fabric SDK Go directory
cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/

# Ensure dependencies are installed
make depend

# Running code checks (license, linting, spelling, etc)
make checks

# Running all unit tests
make unit-test

# Running all integration tests
make integration-test

Running package unit tests manually

# In a package directory
go test

Running integration tests manually

You need:

  • A working fabric and fabric-ca set up. It is recommended that you use the docker-compose file provided in test/fixtures. It is also recommended that you use the default .env settings provided in test/fixtures. See steps below.
  • Customized settings in the test/fixtures/config/config_test.yaml in case your Hyperledger Fabric network is not running on localhost or is using different ports.

Testing with Fabric Images at Docker Hub

The test suite defaults to the latest compatible tag of fabric images at Docker Hub. The following commands starts Fabric:

# Start fabric
cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/test/fixtures/
docker-compose up --force-recreate

Running Integration Tests

Fabric should now be running. In a different shell, run integration tests

# In the Fabric SDK Go directory
cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/

# Clean previous test run artifacts
make clean

# In the Fabric SDK integration tests directory
cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/test/integration/
go test

Testing with Local Build of Fabric (Advanced)

Alternatively you can build and run Fabric on your own box using the following commands:

# Build fabric:
cd $GOPATH/src/github.com/hyperledger/
git clone https://github.com/hyperledger/fabric
cd $GOPATH/src/github.com/hyperledger/fabric/
git checkout v1.0.0-alpha
make docker

# Build fabric-ca:
cd $GOPATH/src/github.com/hyperledger/
git clone https://github.com/hyperledger/fabric-ca
cd $GOPATH/src/github.com/hyperledger/fabric-ca/
git checkout v1.0.0-alpha
make docker

# Start fabric - latest-env.sh overrides the default docker tags in .env
cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/test/fixtures/
(source latest-env.sh && docker-compose up --force-recreate)

License

This project uses the Apache License Version 2.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.