Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (12.7k points)

In my chaincode I am emitting an event with the following command

ctx.stub.setEvent('sampleEvent', 'somedata');

I want to Listen to this event on the client application using the Node SDK.

I have the following questions,

Do I need to use ChannelEventHub?

If yes, from where do I import/require it?

Which npm module do I need?

I believe, the channelEventHub has the registerChaincodeEvent method, are there any examples on how to use it?

1 Answer

0 votes
by (29.5k points)

The package responsible for ChannelEventHub is the fabric-client.

npm install fabric-client

using it:

var Fabric_Client = require('fabric-client');
 

Also you probably want to install fabric-ca-client for user registration/enrolling as well.

Browse Categories

...