scrtlabs / SecretNetwork

𝕊 The Secret Network
https://scrt.network
Other
520 stars 187 forks source link

Pinger contract/service #653

Open Cashmaney opened 3 years ago

Cashmaney commented 3 years ago

There is a problem where some contracts want computation to happen every X blocks (for example, staking derivatives may want to calculate rewards every block, or every few blocks). To achieve something like this, you'd have to run external code that calls the contract periodically, manages gas, etc.

This could be streamlined by having a contract that is triggered every block that can trigger multiple other contracts, based on some criteria (e.g. call this contract once every 10 blocks, call another once every 20 blocks) etc. The challenges would be managing gas costs, and DoS resistance (what happens if one of the calls fails?).

Another idea is to have something like this as a service (off chain completely)

reuvenpo commented 3 years ago

another issue if it's on-chain is accumulating computational overhead for nodes. If a contract asks to be run once every block, indefinitely... well it's going to be there for the rest of time.