I'm wanting to create a smart contract that sends an amount of ether to an address when the weather is above 30 degrees for 3 or more consecutive days, using the OpenWeatherMap API.

How can I use data from an API in a smart contract?

Thanks in advance..


Ethreum virtual machine (EVM) does not has access to the external network due to the fact that all the transactions must be deterministic.

You need to create an oracle service that reads an external API and feeds this information to the Ethereum smart contracts in a trusted manner.

Here is more background inform,ation How do oracle services work under the hood?

| improve this answer | |

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.