Skip to content

Latest commit

 

History

History

the-simple-testing-network

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

The simple testing network

This gives an example on how to run your FPC Chaincode with a simple testing network build with the Fabric Smart Client. The network is specified in pkg/topology/fabric.go.

Preparation

Before we run the network, let's make sure we have built the Enclave Registry (ERCC) Container Images and a FPC Chaincode Container Image. In this example we use the FPC kvs-test-go sample chaincode.

Build ERCC image:

make -C $FPC_PATH/ercc all docker

Build the kv-test-go chaincode:

export CC_NAME=kv-test-go
export CC_PATH=$FPC_PATH/samples/chaincode/kv-test-go
make -C $CC_PATH build docker
export FPC_CHAINCODE_IMAGE=fpc/kv-test-go

To run the Fabric network we need the Fabric binaries. Additionally, we want to use the Hyperledger blockchain explorer to visualize the network activity so we need to get the docker images. We will use the following:

make images
make -C $FPC_PATH/fabric
export FAB_BINS=$FPC_PATH/fabric/_internal/bin

Run the network

make run
# OR
go run . network start --path ./testdata

Once the network is up and running, use a second terminal to interact with the network. Uou can shut down the network using CTRL+C.

To clean up the network you can run make clean or go run . network clean --path ./testdata.

Interact with your FPC Chaincode

In this sample we use the simple FPC Cli tool to invoke functions of our FPC Chaincode.

How to use simple-cli-go

You can also use $FPC_PATH/samples/application/simple-cli-go instead of the simple-go application.

# Make fpcclient
cd $FPC_PATH/samples/application/simple-cli-go
make

# Run the following script and source the resulting environment variables
export CC_NAME=kv-test-go
$FPC_PATH/samples/deployment/fabric-smart-client/the-simple-testing-network/env.sh Org1
source Org1.env

# Interact with the FPC Chaincode
export FABRIC_LOGGING_SPEC=warning
./fpcclient invoke put_state hello world
./fpcclient query get_state hello

You can switch the user by running ./env.sh either with Org1 or Org2.

Hyperledger Explorer

The test network includes a Hyperledger Blockchain explorer that you can use to see what is happening on the network. By default, you can reach the Blockchain Explorer Dashboard via your browser on http://localhost:8080 with username admin and password admin.

Troubleshooting

Sometimes something goes wrong. This is a collection of helpful commands to kill dangling network components.

# If the tstn does not find your docker socket automatically, try this!
# You can check via `docker context ls` and set it via the following environment variable. 
export DOCKER_HOST=unix://"$HOME/.docker/run/docker.sock"
killall peer
killall orderer
docker ps -a | grep fpc

We also provide shortcuts to run and clean the network:

make clean
make run