1

Following is my contract:

pragma solidity ^0.4.4;
contract Process{
address public owner;
uint balance;
uint amount;

function Process(){
    owner = msg.sender;
    balance = 1000;
}

 event DepositMade(string msg);
 event WithdrawalMade(string msg);

 function deposit(uint amot){
    balance = balance + amot;
    DepositMade("Deposit is done");
}

function getBalance()constant returns (uint){
    return balance;   
}

function withdraw(uint amot)returns (bool){
    if(amot > balance){
        return false;
    }
    else{
        balance = balance - amot;
        WithdrawalMade("Withdrawal is done");
        return true;
    }
}

}

Now i am able to run this code using command prompt using its compiled code. When i deposit or withdraw amount, i only receive transaction hash, even though i have created events. I don't know the syntax of nodejs and web3js. I tried , but failed.How should i retrieve events using nodejs for above code?

Rahul Sharma
  • 1,303
  • 2
  • 16
  • 24
  • 1
    check http://ethereum.stackexchange.com/questions/8241/event-result-documentation and http://ethereum.stackexchange.com/questions/6449/event-log-fetch-issue – Badr Bellaj Nov 29 '16 at 09:59
  • @BadrBellaj a best practice is to vote to close the question when you find a duplicate. – niksmac Nov 30 '16 at 07:12
  • see also http://ethereum.stackexchange.com/questions/1381/how-do-i-parse-the-transaction-receipt-log-with-web3-js/2101#2101 which has working code on github. between this and the above comment you should be fully covered and thus this question is a duplicate. – Paul S Dec 02 '16 at 01:27

0 Answers0