Ethereum function completed not event not showing up

0 votes

I have the following contract:

Contract Store{

    event Purchase(address buyer, int item_id);

    struct Product {
        string name;
        uint price;
        string desc;
        uint quantity;
        bool enabled;

    mapping (address => int) balances;

    function buyProduct(uint id) returns(bool){
        if(products[id].quantity <= 0){ return false; }

        balances[msg.sender] = balances[msg.sender] - int(products[id].price);
        Purchase(msg.sender, id);
        return true;


When I use web3 to purchase a product with Store.buyProduct, the product purchase is made, but the event doesn't fire on the front-end. Here is my event watcher code:

var eventFilter = Store.deployed().Purchase({from: "0xe02b4fc50f429624937e9425e1243292857291e2"}, {fromBlock: 0, toBlock: 'latest'});, event){
Oct 24, 2018 in Blockchain by slayer
• 29,040 points

retagged Nov 22, 2018 by Priyaj 11 views

2 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Are you passing the right arguments with right datatypes?
answered Oct 24, 2018 by Omkar
• 65,850 points
0 votes

Oh ya. I was passing unit but I had to pass int. It works now, thanks

answered Oct 24, 2018 by slayer
• 29,040 points

Related Questions In Blockchain

0 votes
1 answer

How to get notified when an event triggers on ethereum smart contract?

Here's a simple example for web3js 1.0.0.beta*: function handler ...READ MORE

answered Jun 8, 2018 in Blockchain by ariaholic
• 7,320 points
0 votes
1 answer

Error in Chaincodes not getting picked up by ./

After changing chaincode in fabric-samples/chaincode/fabcar/go/fabcar.go (this is ...READ MORE

answered Jul 31, 2018 in Blockchain by Shashank
• 10,330 points
0 votes
1 answer

Ethereum smart contract event trigger notification

I have an example here for web3js ...READ MORE

answered Aug 1, 2018 in Blockchain by slayer
• 29,040 points
0 votes
1 answer

Ethereum wallet not able to make transaction

I can see that the nonce you ...READ MORE

answered Aug 9, 2018 in Blockchain by slayer
• 29,040 points
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
0 votes
1 answer
+3 votes
2 answers

How to run ethereumjs using Node.JS

You need to install testrpc globally on ...READ MORE

answered Mar 27, 2018 in Blockchain by ned_crew
• 1,610 points
0 votes
1 answer
0 votes
1 answer

TypeError: XMLHttpRequest is not a function when using web3 on meteor server side

I had the same problem. Instead ethereum:web3 Meteor package ...READ MORE

answered Oct 10, 2018 in Blockchain by Omkar
• 65,850 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.