2

Ethereum contracts require someone to execute the contract and are not self aware. Are EOS contracts self executing if some external thing happens like the weather changing when detected from a weather API site?

If not do I need to have cron run every minute on my system and monitor the weather API and if it's sunny, it will execute the smart contract on EOS?

Otherwise, if it is shelf executing, won't I clog up the network if I accidentally created an infinite loop?

1 Answer 1

5

If not do I need to have cron run every minute on my system and monitor the weather api and if its sunny, it will execute the smart contract on EOS?

Yes, you'd need to make an explicit call to the blockchain yourself as the network cannot make calls to external services.

The closest native mechanism you may have to "self-execution" is deferred transactions: a contract may be programmed to schedule future transactions that do not require your input. However, as with anything else in the EOSIO, they cannot make API calls to off-chain services.

For what it's worth, oracles are the mechanism that are supposed to enable blockchains to communicate directly with the external world. Such services exist both on EOSIO and on other platforms: for instance, Oraclize simulates such activity by monitoring the chain and acting as a middleware: they see your EOSIO transaction, they make an off-chain request to the service requested, and they make an EOSIO transaction reporting the results to your contract to a callback.

won't I clog up the network if I accidentally created an infinity loop?

An infinite loop would still be bounded by the resources allocated to you based on the amount of bandwidth you staked for.

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.