3

I just opened up the Oraclize website and copied their 'Quick Start' ethereum contract and pasted it into Solidity online compiler to try it out (environment is Javascript VM). When I change the value from 0 to something like 10 or 20 and then hit create, I'm expecting the contract to call the constructor, which calls the updatePrice() function and then a query should be sent. What happens instead is that I get an error:

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

Why am I getting an error if I just copied and pasted code in the documentation?

1 Answer 1

2

If you wish to use vanilla browser-solidity and test oraclize queries, you have a couple of options.

  • Run a local testrpc instance alongside the ethereum-bridge (Oracle (oraclize.it) with Truffle and Testrpc indepth guide), in your case, you will have to change the network environment to locally hosted web3 provider for this.
  • Running on already bridged networks like Kovan, Ropsten, and Morden testnets, or even mainnet (although that is recommended for production only of course)
  • We do have an upgrade in the works for the ethereum-bridge, called Oraclize Stargate, which seamlessly creates a bridge for you, although it's still in testing and ethereum-bridge is the way to go for now.

If you're looking to just prototype code, then a quick and easy way is via Oraclize's fork of browser-solidity via https://dapps.oraclize.it/browser-solidity/ which has an integrated Oraclize module, to handle calls right from the JVM environment, if that is your preferred, and it should work exactly as any other network, you can check and test return values etc... all contract side, unfortunately the last answer was misinformed about a number of these points.

2
  • deleted my comment as invalid. Thanks for fixing it!
    – thefett
    Commented Aug 11, 2017 at 16:51
  • Thanks @thefett , you were helpful mentioning the Oraclize fork of browser-solidity!
    – DenisM
    Commented Aug 11, 2017 at 18: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.