I am looking for a way to automate the execution of a function.

Here is a very simple example of a function that will change the state of a boolean variable.

pragma solidity ^0.8.2;
contract Test{
  bool public myVar = false;
  function setBool(bool setVarBool) public
    myVar = setVarBool;

So I'm looking for a way to automate the execution of this function, so that tomorrow for example, the state of this variable changes. I searched on Google, I saw that it was necessary to use Oracles. However I didn't understand how to implement them.

Could someone here who has already worked with Oracle / Planners please help me?

  • check chainlink keepers
    – Majd TL
    Nov 23, 2021 at 12:27

1 Answer 1


You can rely on third-party services (Chainlink, Keep3rs, etc) or you can run your own bot doing it for you (using ethers or web3js with node for instance, this is basically sending a transaction when Date.now() satisfy some condition of yours or use setInterval(function() { ...your tx ...}, 3600000) for running it every 3600s)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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