In a scenario where a smart contract needs to check against a third party service (Let's say an API with weather information from a trusted source like Weather.com) and make a decision on moving tokens or some such action based on the results for a specific date/time (for example a refund if there is rain during a scheduled cruise) - Can this all be written from within the smart contract and scheduled as well? If so how would you go about calling an API and scheduling when that call would be made?

1 Answer 1


I'm not sure but I think that's the purpose of Inbound Oracles to write data on the chain.

You should develop an application that reads data from somewhere and input to your smart contract weather table. And then you can always read from it inside your contracts much faster without spending cpu bandwith...

The problem is that you would need the storage for these weather data.

  • Thanks, is there an example somewhere of calling an API from inside a smart contract?
    – INNVTV
    Commented May 15, 2018 at 18:25
  • I don't believe it's possible to call an external API from a smart contract because it may return different values to the different BPs, which would break determinism. I think you need to listen for changes to your smart contract, and provide input to them at that stage. That's kind of what @Leo is saying here I think.
    – andybets
    Commented May 23, 2018 at 19:02

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.