1

I'm working on a project that requires a scheduler(days or weeks in advance).

I've been using Aion but it's outdated and doesn't seem reliable for a commercial product.

any advice?(preferably something decentralized to avoid a single point of failure)

1
2
+50

Off-chain - Ethereum Alarm Clock

If you want a scheduler that actually sends a transaction when some time has passed, Ethereum Alarm Clock is the only one I know about.

On-chain - Block number

If you want the least ambiguity, but the exact time in seconds is not important, scheduling based on block number is likely the best. For instance, a function could only be executed if the transaction block.number is greater than or equal X. Users then know exactly when they can send their transaction simply by monitoring the block numbers.

However, with that method you do not know precisely when that event will happen (in seconds), because block time can vary. You could have a wide variation between the estimate time at which block X will be mined and the actual time at which it is mine if that block is far in the future.

On-chain - Block timestamp

Using the block.timestamp instead could be a better option if you want to know the time in seconds when the function can be executed. You could then tell users after which time and date the function will be executable.

However, there is ambiguity as to which block it will be when the time is reached, even at the very last moment. Users that would want to send a transaction precisely when the function becomes executable will not be able to do so, because you never know if the next block will be just before or just after the time.

Also note that the block.timestamp can be manipulated a little bit by miners, as mentioned here.

2
  • Do you recommend using cron jobs to activate on chain events?
    – Cristian
    Jul 1 at 22:42
  • 1
    I have never done it this way, so I don't know. I normally use web3.js (nodejs) and let it run with pm2.
    – Undead8
    Jul 1 at 23:50

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.