0

This question already has an answer here:

I am new to Ehterum and Blockcain. I am using ehtereum smart contracts api web3.js for my front-end interaction. I am using solidity for writing contract using truffle. I want to automate the transaction on baisis of some condition such as time interval. I have posted this question on other forums such as gitter community and got answer that I can use Oraclize or Reality keys to achieve this? So I was wondering why It is called smart-contract if it is not smart enough to even execute an automated transaction? Can someone please explain that is it true that we cannot write such automated contract in ethereum or maybe I have wrong understanding of things?

marked as duplicate by Ismael, Achala Dissanayake, SteveJaxon, lungj, flygoing Nov 18 '17 at 20:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Saying smart contracts aren't smart because they can't schedule a function to run is like saying your smartphone isn't smart because it can't phone a person you don't know the number for.

Yes, it's true you can't schedule something out of the box, when we were "promised" contracts that are smart enough to check conditions and enforce certain actions without depending on humans. When you get into it you realize it is not as straightforward as you thought and there's a lot of coding involved and things we are used to in other languages do not exist in Solidity yet, you feel like you went back in time at least 20 years. You just have to understand the shortcomings and rethink the logic of your code.

Enough rant, yeah you can't schedule a function to run at a later time. You could use Oraclize or Ethereum Alarm Clock to do it. Or, as I said, rethink your logic so there's no need to schedule the function call.

  • thank you @pabloruiz55 for the answer. So I just wanted to confirm that this feature is not part of smart contracts currently or will it be added in future? Ans secondly if we use third party platforms such as Oraclize won't it make our dapp centralized again as we wil have to trust someone else again? – Shoaib Iqbal Nov 2 '17 at 4:54
  • I am not defending Ethereum's shortcoming that a contract cannot schedule a function to run. I just want to add that I feel Ethereum does not really do away with the necessity to trust someone. If you want to use a smart contract written by someone else, you are trusting the person or organization that wrote and deployed it to write bug-free code that is not malware. That trust may not be justified. Parity multi-sig wallets had a bug that someone exploited to steal about $32M. The fix for that bug introduced another, which was accidentally triggered by an Ethereum "newbie" locking away $300M. – Ajoy Bhatia Nov 16 '17 at 19:04
  • Continuing because previous comment hit max character limit .... If humans are involved in an activity, trust will be necessary. The difference is that an Ethereum app may make it possible for you to do business with many unknown people thousands of miles away. Now, you do not have to have trust in all of them but only in the company that made the app available. So a smaller trust "footprint" and the company has more motivation to be honest because it has a bigger stake in continuing to exist. – Ajoy Bhatia Nov 16 '17 at 19:04

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