It appears my events are not being fired in my node application when I transact the contract in the ethereum wallet gui.

  1. I deployed a custom contract via ethereum-wallet
  2. I have fired up geth attach
  3. in geth I have started the rpc admin.startRPC("", 8545, "*", "web3,db,net,eth")
  4. within the node repl shell I have done the following:

    > var Web3 = require('web3')
    > web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
    > var contractAddress = "0x807bF45B0245d8FA96F68E319116E18a15b07A10"
    > var contractCode = "<paste in the code above for the contract>"
    > var compiledContract = web3.eth.compile.solidity(contractCode)
    > var contractDefinition = compiledContract.ShareClass.info.abiDefinition
    > var reference = web3.eth.contract(contractDefinition).at(contractAddress)
    > reference.Transfer().watch(
         function(error, result){
             console.log(result.args.from + " => "+result.args.to + " ["+result.args.value+"]");

When I then call the Transfer method on my contract in ethereum wallet, the contract balance changes, but the console logging does not take place in my node app.

  • a bit hard to debug if we can't see the code that emits the event. Please include at least the snippet of code emitting the event. You could try allEvents and see if it's a filtering issue.
    – Paul S
    Commented Mar 18, 2016 at 20:38
  • one possible reason is when web3.eth.defaultAccountis not set or has no Ether. Then it can still call readonly functions, but won't emit events.
    – didi_X8
    Commented Nov 19, 2016 at 17:08

2 Answers 2


I think you're supposed to add watch to the event object, not the function.


contract Test {
    Event MyLog(string);

    function MyFunction() {
        MyLog("Hello World!");


// NOT reference.MyFunction().watch
reference.MyLog().watch(function(error, result) {
    if (!err) {
    } else {
        console.log("Error! + " error);
  • MyFunction is calling the event with the wrong name.
    – Ismael
    Commented May 31, 2016 at 18:09

Event listening is only available for WebSocket or IPC provider


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.