2

The architecture of my dapp consists of a backend (metamask + web3.js or web3.js + geth) and a smart contract that offers different services (functions). I want a function on the smart contract to run on a certain date. Can my backend call a smart contract function to be executed on a certain date?

I have been looking for an answer to my question for days but I can't find any clear explanation.

2

Not sure what you mean by

"Can I pay for a service on my backend to run on a certain date?"

What I understood from your question i.e

"I want a function on the smart contract to run on a certain date."

Yes you can run smart contract functions at a certain datetime. For that you have to run Cron Job in the back end, you can use NodeJs script + Web3js npm to run the cron job at specfic datetime.

You can write your logic in the script and call your smart contract function which will get called as per datetime specified in the Cron initialisation function.

Hope this helps.

2
  • 1
    omg thanks so much for your reply. YES what I want is to call one of the functions of my contract to run on a certain date. THANK YOU because I have been looking for a clear answer like yours. Unfortunately I am a beginner and I ask you if you can give me a code example. – Mario Roma Feb 11 at 11:16
  • You can follow this link to study about cron jobs – Antier Solutions Feb 11 at 11:45

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.