This question is not about external solutions, but are there technical limitations to why a contract that has funds, can't schedule itself to run at a future block? Could the Ethereum protocol have been designed to include this functionality and if so, what would it have involved?
2 Answers
In a recent post by Vitalik Buterin on Reddit he mentions several proposals that were considered in the protocol design but didn't make the cut.
One of the proposals called delayed calls would introduce an opcode ALARM that allow a contract to execute in a future block. The proposal has several use cases but it was discarded due to time constraints.
I believe this was designed as a feature to minimize the burden on the network and reduce resources. There are several solutions if you want to "call on a contract":
http://www.ethereum-alarm-clock.com/
I'm proud to announce the launch of the Ethereum Alarm Clock service.
http://www.ethereum-alarm-clock.com/
The Alarm service facilitates scheduling contract function calls for a specified block number in the future. The current release should be considered alpha software.
- Schedule contract function calls to be executed at a specified block in the future.
- Trustless. No administrative API's or special access granted to anyone, including myself.
- Published verifiable source code.
- Lots of documentation with examples.
I'm very interested to hear people's feedback. Feel free to send me a message at pipermerriam on gitter.
-
1
-
If the technical limitation is network and resource usage would increase, can it be explained or quantified better to illustrate why it actually becomes a limitation? An increase in something doesn't necessarily mean it becomes a limitation.– eth ♦Commented Nov 2, 2017 at 10:16
-
Just wondering... For a contract function to be called, a transaction has to be written to the blockchain, since a function is executed when that transaction is mined and verified. So perhaps one way to implement this could be to use Events. (Just an idea). A function in a smart contract could subscribe to an Event. When that Event is triggered, transactions could be sent to the blockchain calling each function subscribed to that event - one transaction for each subscribed function. Still, it depends on an event being triggered. Not completely self-invoked. Commented Nov 17, 2017 at 18:43
-
I have another idea about implementing this functionality but this might not be the right forum for it. Will look for some place where it would get a serious consideration by the powers-that-be. Perhaps, something like this is already in the works. Will check that, too. Commented Nov 17, 2017 at 19:55