I'm trying to call a function in my smart contract and keep getting the error Uncaught Error: The MetaMask Web3 object does not support synchronous methods like eth_sendTransaction without a callback parameter I understand that I need to make the call asynchronous but am unsure how I would do this. My code is:

   mainEvent.watch(function(error, result){
        if (!error)
            } else {

   $("#button").click(function() {

1 Answer 1


You need to provide a callback to Raffle.main. (I'm assuming that's the function it's complaining about.)

Raffle.main(function (err, result) {
  • Thanks, where abouts would I put this in my code?
    – JAG
    Commented Jan 31, 2018 at 0:24
  • It replaces the line console.log(Raffle.main());
    – user19510
    Commented Jan 31, 2018 at 0:25

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.