This example returns syntax errors when the emit keyword is used.

emit AuctionEnded(highestBidder, highestBid);

This is the doc where the example code is.


Why are there syntax errors? How do you really call an event in pragma solidity ^0.4.21;


You also need the correct version of the compiler. pragma solidity ^0.4.21 is only a hint, but not the selection of the concrete compiler.

If you try this at https://remix.ethereum.org/ which loads the 0.4.21 compiler by default, it will work perfectly fine. When you switch the compiler to a lower version (settings tab), you'll get the syntax error.

  • 1
    I see, the version was the key thanks! (note etherium.org not com) – jlansey Mar 7 '18 at 20:38
  • oh.. my fault.. thanks for the pointer, changed it to org. – ivicaa Mar 7 '18 at 20:40

update truffle

npm install truffle@4.1.5 -g

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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