- Notifications
You must be signed in to change notification settings - Fork503
License
hyperledger/fabric-sdk-go
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Note: This API is deprecated and is no longer maintained as of Fabric v2.5. When developing applications for Hyperledger Fabric v2.4 and later, you should use theFabric Gateway client API.
This SDK enables Go developers to build solutions that interact withHyperledger Fabric.
Obtain the client SDK packages for Fabric and Fabric CA.
go get github.com/hyperledger/fabric-sdk-go
You're good to go, happy coding! Check out the examples for usage demonstrations.
SDK documentation can be viewed atGoDoc.
The packages intended for end developer usage are within the pkg/client folder along with the main SDK package (pkg/fabsdk).
If you wish to use the Fabric 'Gateway' programming model, then the API is in the pkg/gateway folder.
- E2E Test: Basic example that uses SDK to query and execute transaction
- Ledger Query Test: Basic example that uses SDK to query a channel's underlying ledger
- Multi Org Test: An example that has multiple organisations involved in transaction
- Dynamic Endorser Selection: An example that uses dynamic endorser selection (based on chaincode policy)
- E2E PKCS11 Test: E2E Test using a PKCS11 crypto suite and configuration
- More examples needed!
- Discussion is happening inRocket Chat.
- Issue tracking is handled inJira.
The SDK's integration tests run against three tagged Fabric versions:
- prev (currently v1.4.7)
- stable (currently v2.2.0)
- prerelease (currently disabled)
Additionally for development purposes integration tests also run against the devstable Fabric version as needed.
When the 'prev' code level is updated, the last tested fabric-sdk-go commit or tag is listed below.
- fabric v1.3: ac70276
- fabric v1.2: 5e291d3
- fabric v1.1: f7ae259
- fabric v1.0: 5ac5226
Obtain the client SDK packages for Fabric and Fabric CA.
git clone https://github.com/hyperledger/fabric-sdk-go.git
# In the Fabric SDK Go directorycd fabric-sdk-go/# Optional - Automatically install Go tools used by test suite# make depend# Running test suitemake# Clean test suite run artifactsmake clean
The following Go tags can be supplied to enable additional functionality:
- experimental: includes support for experimental features.
If you want to contribute to the Go SDK, please run the test suite and submit patches for review. For general guidelines, please refer to the Fabric project'scontribution page.
You need:
- Go 1.14
- Make
- Docker
- Docker Compose
- Git
- gobin (GO111MODULE=off go get -u github.com/myitcv/gobin)
- libtool
Notes:
- Dependencies are handled usingGo modules.
# In the Fabric SDK Go directorycd fabric-sdk-go/# Optional - Automatically install Go tools used by test suite# make depend# Optional - Running only code checks (linters, license, spelling, etc)# make checks# Running all unit tests and checksmake unit-test# Running all integration testsmake integration-test
# In a package directorygotest
You need:
- A working fabric and fabric-ca set up. It is recommended that you use the docker-compose file provided in
test/fixtures/dockerenv
. It is also recommended that you use the default .env settings provided intest/fixtures/dockerenv
. See steps below. - Customized settings in the
test/fixtures/config/config_test.yaml
in case your Hyperledger Fabric network is not running onlocalhost
or is using different ports.
The test suite defaults to the latest compatible tag of fabric images at Docker Hub.The following commands starts Fabric:
# In the Fabric SDK Go directorycd fabric-sdk-go# Start fabric (stable tag)make dockerenv-stable-up# Or more generally, start fabric at a different code level (prev, stable, prerelease, devstable)# make dockerenv-[CODELEVEL]-up
Fabric should now be running. In a different shell, run integration tests
# In the Fabric SDK Go directorycd fabric-sdk-go# Use script to setup parameters for integration tests and execute them# Previously we use to have hostnames like Fabric CA server, orderer and peer pointed to localhost# Now since we removed this now, We will be using a different configurationmake integration-tests-local# Or more generally, run integration tests at a different code level (prev, stable, prerelease, devstable)# and fixture target version# FABRIC_CODELEVEL_VER=[VER] FABRIC_CODELEVEL_TAG=[CODELEVEL] make integration-tests-local
# Previously we use to have hostnames like Fabric CA server, orderer and peer pointed to localhost# Now since we removed this now, We will be using a different config file config_test_local.yaml# which has the Fabric CA server, orderer and peers pointed to localhost# It is also possible to run integration tests using go test directly. For example:#cd fabric-sdk-go/test/integration/#go test -args testLocal=true#cd fabric-sdk-go/test/integration/orgs#go test -args testLocal=true# You should review test/scripts/integration.sh for options and details.# Note: you should generally prefer the scripted version to setup parameters for you.
Alternatively you can use a local build of Fabric using the following commands:
# Start fabric (devstable codelevel with latest docker tags)make dockerenv-latest-up
Hyperledger Fabric SDK Go software is licensed under theApache License Version 2.0.
This document is licensed under aCreative Commons Attribution 4.0 International License.
About
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.