block-listener

command
v1.0.0-rc1 Latest Latest
Warning

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

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

README

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:

./network_setup.sh up

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

./block-listener -events-address=127.0.0.1:7053 -events-mspdir=$GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp -events-mspid=Org1MSP

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

Exec into the cli container:

docker exec -it cli bash

Setup the environment variables for peer0.org1.example.com

CORE_PEER_MSPCONFIGPATH=$GOPATH/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_PEER_LOCALMSPID="Org1MSP"

Create an invoke transaction:

peer chaincode invoke -o orderer.example.com:7050 -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.

Documentation

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