-1

Why does an Oraclize contract deployed with Remix JavaScript VM gives an "invalid opcode error" and not on main/testnet?

I have thought why the Remix JavaScript VM reports the error:

Exception during execution. (invalid opcode). Please debug the transaction for more information.

for any Oraclize contract Create through the Remix interface, when the same contract is perfectly deployable on the main/testnet?

In the end, solc compiles the contract, so if the bytecode contains an invalid opcode, it must be the case also on the main/testnet? So, why doesn't Ethereum complaint when the contract is deployed on, e.g., Rinkeby?

Does anyone have technical insight to describe why only the Remix JavaScript VM sees an invalid opcode?

2 Answers 2

2

How Oraclize works is:

  • You send a transaction to a contract that Oraclize have deployed onto the blockchain
  • That Contract logs a message onto the blockchain, to say that you've requested some data
  • Somewhere at Oraclize HQ, there's a server that monitors the blockchain for these messages
  • That server reads the message, gets the data, and creates a transaction that sends the data to your contract

This works fine on mainnet and all the public testnets (Oraclize has servers that monitor these blockchains too, and has contracts deployed on them). However, they can't monitor the Remix JavaScript VM's blockchain, because it only exists in your browser, so there is no Oraclize contract deployed to it.

1
  • This needs to be tagged as the correct answer.
    – n1cK
    Commented Jun 2, 2018 at 15:47
1

I was using the javascript VM and was not getting any error or message. But the

--callback

method was never getting called. I found this answer Why isnt Oraclize working? which kind of indicatest hat JS VM with Oraclize may not work from the browser Remix. So you can use the Oraclize Remix IDE at https://dapps.oraclize.it/browser-solidity/ and get your code tested end to end. I am yet to try out that IDE, will update if I am able to run my code there.

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.