Is it possible for a smart contract to autonomously execute (with no external interaction) when a certain condition is met? Say, when a certain time arrives.

My thought is that smart contracts are only executed when interacted with by an external account. Am I correct?


1 Answer 1


Short answer: no, but..

So smart contracts are always reactive, never active, you cannot have a smart contract self activate even in a very simple condition like after certain time has passed.

But there are some working solutions: Ethereum Alarm Clock is a very clever service that creates a market for scheduling calls in the future, where you can pay a very small fee and many scheduling services compete to see who can make the call for you with the most reliability and lower price. A contract can make a call to the ethereum alarm service for a date in the future and wait until it's called.

Of course, reacting to other conditions are more complicated: if it's an external condition under your control (someone making a token transfer for example) you can simply add a hook on that contract to execute something in your contract. If it's something you can't control, you can always schedule a alarm clock call that will check if the condition is met and if it's not met will schedule another call in the future, effectively creating a loop. Of course the more frequent the calls, the more expensive it gets.

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