v1.0.0-beta Latest Latest

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

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


What is block-listener

block-listener.go will connect to a peer and receive block and chaincode events (if there are chaincode events being set). Currently, this example only runs with TLS disabled.

To Run

1. go build

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

Please be noted that if no msp info provided, it uses default MSP under fabric/sampleconfig.

Example with e2e

Please make sure you have finished running the e2e_cli example. Before doing that, don't forget to make sure that TLS has been disabled by setting the CORE_PEER_TLS_ENABLED=false in docker-compose-cli.yaml, base/docker-compose-base.yaml and base/peer-base.yaml.

Suppose you just finished the All-in-one:

./ up

Attach event client to peer (suppose you are running block-listener in the host environment):

./block-listener -events-address= -events-mspdir=<'s msp directory > -events-mspid=Org1MSP

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 received in events client.

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


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