Is it possible for a smart contract to initiate actions on its own? (ie. without an external message being received?) For example, is it possible to implement a smart-contract-based reminder system that sends email notifications based on a calendar of future events? Or a smart contract that does data operations once every 24 hours, without outside prompting?

If so, where does the gas come from to execute those smart contract initiated operations?

So, if I were to create a "reminder" smart contract, where people submitted a notice time, email address and text message, they would be charged gas for the call to send in the data, but how could they be charged for the gas needed to send them the reminder a day or more later? Can a smart contract over-charge for gas and save that gas for later use by itself? Are there any other solutions?

Thanks for any help with this.


No. It is not possible for a smart contact to do anything unless that action was first initiated by an external account.

Smart contracts only 'do something' when one of their functions is called. That 'call' may come from another smart contract, which may be from yet another smart contract, but ultimately, the whole chain of invocations has to have come from an external account--and that means a human (or some other sort of off-chain process such as a shell script).

A smart contract will never wake up on its own and initiate anything. The reason is the need for the system to be 100% deterministic. The concept of time in the world of the EVM is slippery--any miner could potentially manipulate its clock and trick the smart contract into kicking off when it shouldn't. There is no internal clock in the EVM.

Not the answer you're looking for? Browse other questions tagged or ask your own question.