Samples
Samples are a collection of small and simple apps that demonstrate how to use the library.
To run the samples, we recommend to use go 1.20
. You will also need docker as it is needed by Fabric.
To make sure you have all the required docker images, you can run make docker-images
in the
Fabric Smart Client repository folder ($FSC_PATH
).
The samples will make use of docker to run various components. To make sure you have all the docker images you need,
please, run make docker-images
in the folder $FSC_PATH
.
($FSC_PATH
refers to the Fabric Smart Client repository in your filesystem see getting started)
Additional Examples via Integration Tests
Integration tests are useful to show how multiple components work together.
The Fabric Smart Client comes equipped with some of them to show the main features.
To run the integration tests, you need to have Docker installed and ready to be used.
Each integration test bootstraps the FSC and Fabric networks as needed, and initiate the
business processes by invoking the initiator view
on the specific FSC nodes.
Here is a list of available integration tests:
Ping Pong
: A simple ping-pong between two FSC nodes to start with the basics.
Moreover, we will learn more about the State-Based Programming model
.
Secured Asset Transfer
:
In this example, our starting point is the Secured asset transfer in Fabric
sample.
The objectives are manifolds:
- First, to show how the
Fabric Smart Client
's integration infrastructure provides a convenient programmatic environment to test
chaincodes-based solutions. Already a huge improvement for the developers.
- Second, to highlights the limitations of the current sample and show how these limitations can be overcome
using the
Fabric Smart Client
's advanced capabilities.
Fabric Private Chaincode: Echo
: In this example, we show how to invoke a Fabric
Private Chaincode called Echo
.
Orion: Cars
: In this example, we show how to orchestrate transactions for Orion
.
Logging configuration
Topology logging levels can be configured with SetLogging
method. However, it is not possible to disable logging completely with the mentioned method because FSC may require to inspect the output of the commands that are run inside the topology.
If you are using FSC outside of ginkgo tests need to disable logging, or use a stream other then stdout
, you can use the following two methods.
flogging.Global.SetWriter()
allows to modify the stream used for FSC log messages.
- Assigning
ginkgo.GinkgoWriter
the required stream redirects the command output, such as Fabric node.
Almost all the samples and integration tests require the fabric binaries to be downloaded and the environment variable FAB_BINS
set to point to the directory where these binaries are stored. One way to ensure this is to execute the following in the root of the fabric-smart-client project
make download-fabric
export FAB_BINS=$PWD/../fabric/bin