v1.0.5 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2017 License: Apache-2.0 Imports: 11 Imported by: 0


What is block-listener

block-listener.go connects to a peer in order to receive block and chaincode events (if there are chaincode events being sent). Currently, this example only works with TLS disabled in the environment.

To Run

1. go build

2. ./block-listener -events-address=<peer-address> -events-from-chaincode=<chaincode-id> -events-mspdir=<msp-directory> -events-mspid=<msp-id>

Please note that the default MSP under fabric/sampleconfig will be used if no MSP parameters are provided.

Example with the e2e_cli example

In order to use the block listener with the e2e_cli example, make sure that TLS has been disabled by setting CORE_PEER_TLS_ENABLED=false in docker-compose-cli.yaml, base/docker-compose-base.yaml and base/peer-base.yaml.

Next, run the e2e_cli example.

Once the "All in one" command:

./ up

has completed, attach the event client to peer by doing the following (assuming you are running block-listener in the host environment):

./block-listener -events-address= -events-mspdir=$GOPATH/src/ -events-mspid=Org1MSP

The event client should output "Event Address:" and wait for events.

Exec into the cli container:

docker exec -it cli bash

Setup the environment variables for


Create an invoke transaction:

peer chaincode invoke -o -C $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}'

Now you should see the block content displayed in the terminal running the block listener.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.


The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL