0

I am willing to write a smart contract which can automatically send ether to certain addresses like it needs to work continuously. is it possible?

3 Answers 3

2

I'm assuming from the question you want to know if there is a way to fund a contract so it performs as expected, because when it runs out of funds the program stops?

Disclaimer: I am part of Chainlink Keepers team. There is a contract we created called "balance monitor" that works on EVM chains. Cryptphil is correct, the contract can't run continuously, so we solved this using the automation service (Chainlink Keepers).

You deploy the balance monitor contract, fund it, and configure it to monitor the contract(s) that you want to fund, funding thresholds, and amounts to top up. You then register an Upkeep with Chainlink Keepers, point it to your deployed balance monitor contract, and fund the Upkeep.

What this will do is check off-chain whether your contract(s) are underfunded, and if so, the node in the network assigned to the upkeep at that time will transmit the funding transaction to the balance monitor contract on-chain.

Link to the contract for you to use, code is also open source on Github. https://docs.chain.link/docs/chainlink-keepers/utility-contracts/

1

If you mean something like that your contract should always send Ether after some time period, then no, this is not possible.

Because this would mean that your contract has to continuously run and, e.g., check for the blocktime which would cost you "infinite" gas and there would be no way to pack one execution of it in one block.

The way you could implement this behavior is to trigger your contract externally by some process you've implemented for your desired logic.

3
  • let us assume I have a website running on web 2.0 in that website when some function happens I need to take that user address and automate payments to that address using smart contract is that possible?
    – tripledot
    Dec 24, 2021 at 5:59
  • like in a constant way the users comes in lets say they click play if they won the game I need to pay them in crypto to each and every player who won the game. how can I achieve this.
    – tripledot
    Dec 24, 2021 at 6:00
  • Well, but the contract would need to somehow check if a user has won and needs to be "in contact" with your website. I don't really see a use case or a necessity for a smart contract here, this only makes everything much more complicated.
    – cryptphil
    Dec 25, 2021 at 11:53
1

You can automate crypto payments with something like Gelato Ops.

Gelato Ops

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.