<
 
 
 
 
×
>
hide You are viewing an archived web page, collected at the request of Ethereum Foundation using Archive-It. This page was captured on 13:46:02 Jun 26, 2021, and is part of the Community collection. The information on this web page may be out of date. See All versions of this archived page. Loading media information

I need a smart contract function which executes every 60 seconds

trial2trytrial2try Member Posts: 9
I tired using this

function timer(){
if (now >= 60 seconds){
calledfunction();
}

function calledfunction(){
//code

timer();
}


calledfunction is not being called when i call timer() so i tired calling calledfunction() directly and it also didnt execute. When i commented timer() in calledfunction() and then invoked calledfunction() then the code worked.

Any idea to call a solidity function for every 60 seconds.

Comments

  • o0ragman0oo0ragman0o Member, Moderator Posts: 1,291 mod
    edited June 2016
    @trial2try Contracts need an external initiator so you would have to have a JS function call the contract every 60 seconds rather than the contract trying to call itself, which even if it looped would simply run out of gas.
Sign In or Register to comment.