block-listener

command
v1.0.0-beta Latest Latest
Warning

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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

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:

./network_setup.sh up

Attach event client to peer peer0.org1.example.com (suppose you are running block-listener in the host environment):

./block-listener -events-address=127.0.0.1:7053 -events-mspdir=<peer0.org1.example.com's msp directory > -events-mspid=Org1MSP

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

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

Documentation

The Go Gopher

There is no documentation for this package.

Source Files

  • block-listener.go

Jump to

Keyboard shortcuts

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