hyperledger-archives / education

Hyperledger training material
https://wiki.hyperledger.org/display/LMDWG
Apache License 2.0
372 stars 360 forks source link

Successfully committed the change to the ledger by the peer #118

Closed robelkebede closed 5 years ago

robelkebede commented 5 years ago

git

git2

Successfully committed the change to the ledger by the peer but it is not upadating the ledger what is the problem Thank you.

vishal3152 commented 5 years ago

There could be multiple issues::

  1. Your chaincode might need endorsement from more than one peer(of different orgs). But you might have collected from one and would have send the transaction to order. You should read the emitted block to know exact status of commit.
robelkebede commented 5 years ago

@vishal3152 thank you for the answer but i am a new to fabric how to read the emitted block

vishal3152 commented 5 years ago

This is one of the way :-

var startBlockListener = async function () {
     const client = await Client.loadFromConfig("<file path>");
     const channel = client.getChannel("<channelName>");
     var eh = channel.getChannelEventHubsForOrg()[0];// read from network-config.json
     var block_reg = eh.registerBlockEvent((block) => {
        console.log('New block received: ' + block.number);
            // read block here
   }
 eh.connect();
}
startBlockListener().then(() => {});
robelkebede commented 5 years ago

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

var Client = new Fabric_Client();

var startBlockListener = async function () { const client = await Client.loadFromConfig("");

TypeError: Client.loadFromConfig is not a function