1

Let's say, there's a contract with timelock or vesting. In it there's a condition that check whether or not the right time has come, in order to release some tokens to some people. But said condition is getting checked everything second, sometimes every minute.

And there may be millions contracts on Ethereum that have such functionality.

How does these timing or vesting mechanisms work from the point of view of miners and validadators? Does EVM, of each miner or validator, work in such a way that it a) iterates over all the contracts on the blockchain, b) every second, and, in regards to timing/vestings contracts, if EVM encounters those, it c) executes them?

If so, to me it seems like a very expensive operation.

And if so, is there any low limit of how often something can be executed? Can there a contract with timing of 0.1 second? And would it work properly?

1 Answer 1

0

It does not work with time, it works with block.timestamp which is a Unix time stamp.

for example at block number XXXXXX, something happens.

Then secondly, it does not automatically execute, its more of a requirement that checks. So a user will have to click to withdraw duns, then the blockchain checks if the time is met, if not...transaction will fail. Otherwise it will work :)

8
  • for example at block number XXXXXX, something happens. -- how in Solidity, in code, can that be specified?
    – Okkun
    Jan 7, 2022 at 12:37
  • you just call "block.timestamp" and it returns the value Jan 7, 2022 at 15:52
  • therefore, a user or admin will have to call a contract#function(...) manually? Whether it be once a day, or once a minute, right?
    – Okkun
    Jan 7, 2022 at 17:24
  • Yes, when the transaction is happening, it calls it Jan 10, 2022 at 9:45
  • do you you mean "when the transaction is happening,"? What transaction?
    – Okkun
    Jan 10, 2022 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.