0

how can i invoke pickVoters() each 5 minutes using react?

import React, { Component } from "react";
class Pick extends Component {
static async getInitialProps(props) {
const { address } = props.query;

const eVoting = new EVoting(address);



const accounts = await web3.eth.getAccounts();
await eVoting.methods.pickVoters().send({
  from: accounts[0],
});
return { address };
}
0

You cannot set up cron jobs in Solidity. Actually, Ethereum as a whole does not natively support this kind of operation.

You have to use an automation protocol that runs on top of Ethereum. For instance, Gelato Network.

4
  • Since he asked "with React", I imagine he'd want something like setTimeout. But no idea really Sep 14 at 15:22
  • Yes, that could be the case. We need more details from OP. Sep 14 at 15:57
  • yes, i need some operation like "useEffect" using react , is that possible? Sep 14 at 21:31
  • OP stands for "original poster", which is you. You need to update the question body and provide more details. Sep 14 at 21:32

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.