Skip to main content
27 votes
Accepted

Is block.timestamp safe for longer time periods?

Yes, you can guarantee long run time accuracy. Miners can't cheat that much to change the timestamp over days. Blocktime is adjusted to be constant within certain error margins, and timestamps is ...
Roland Kofler's user avatar
22 votes
Accepted

How do you work with Date and time on Ethereum platform

When a transaction is executed, it is done in the context of being part of a block. The block includes a timestamp (in seconds since 1970), which your contract code can refer to by the name block....
Edmund Edgar's user avatar
  • 16.9k
17 votes

Is block.timestamp safe for longer time periods?

The miner could cheat in the timestamp by a tolerance of 900 seconds. so if you check outside this intervall you are safe.
Badr Bellaj's user avatar
  • 18.8k
8 votes
Accepted

How does CryptoKitties track time?

now is a Solidity special variable, which equates to the current time since the epoch, in seconds. From the documentation (linked above): now (uint): current block timestamp (alias for block....
Richard Horrocks's user avatar
8 votes

How can a contract run itself at a later time?

Currently There are several options for this. The top answer is old and Ethereum Alarm Clock was down for a long time until a few weeks ago and now is managed (looks like) by the Chronologic team. I ...
Jaime's user avatar
  • 8,360
7 votes

How can a contract run itself at a later time?

You can use an external service to trigger a transaction on-chain, which triggers your contract. You can use the Chainlink Alarm Clock to do this. A full example, showing a delayed start of 5 minutes ...
Patrick Collins's user avatar
7 votes

How can a contract run itself at a later time?

You cannot set up cron jobs in Ethereum. The protocol does not natively support this kind of operation. You have to use an automation protocol that runs on top of Ethereum, e.g. Gelato Network.
Paul Razvan Berg's user avatar
6 votes

How do you work with Date and time on Ethereum platform

No, In solidty there is no Date object which will give you the actual time, we can only get the timestamp of the block in which the contract is invoked, which is deterministic. You can use now keyword ...
joifsi's user avatar
  • 1,019
6 votes

How can a contract run itself at a later time?

There is a useful interface for this which lets you easily schedule these time-based cron jobs without having to write any smart contract code called "Gelato Ops". Disclaimer: I helped built ...
Hilmar X's user avatar
  • 138
5 votes
Accepted

Block archived event inside blockchain

You have to do it without relying on anything that triggers at that moment. You use the block.number to decide if bets are allowed. function isOpen() { return(block.number <= deadline); } ...
Rob Hitchens's user avatar
  • 55.4k
4 votes

How does CryptoKitties track time?

It's worth noting that miners can manipulate now and so it shouldn't be relied upon for anything sensitive such as seeding Psuedo-Random Number Generators.
Luke's user avatar
  • 61
3 votes
Accepted

Why can't a contract wake up and run itself?

In a recent post by Vitalik Buterin on Reddit he mentions several proposals that were considered in the protocol design but didn't make the cut. One of the proposals called delayed calls would ...
Ismael's user avatar
  • 30.5k
2 votes

How can a contract run itself at a later time?

An alternative solution if you don't need to be really precise is to check for outstanding scheduled tasks in user-initiated transactions. A simple solution could be for the first transaction in any ...
David Callanan's user avatar
2 votes
Accepted

Is Ethereum Alarm Clock still alive and well?

Yes, Ethereum Alarm Clock is alive and well. It's on mainnet. In the first few months it transferred more than 1000 ETH safely. It has also been audited by BokkyPooBah. There's also new page: https://...
Daniel's user avatar
  • 359
2 votes

Is Ethereum Alarm Clock still alive and well?

I think they're reviving it. The new gitter is https://gitter.im/ethereum-alarm-clock/ethereum-alarm-clock.
ulu's user avatar
  • 740
2 votes

Is Ethereum Alarm Clock still alive and well?

Based on their gitter, no. The service is currently inactive. https://gitter.im/pipermerriam/ethereum-alarm-clock. Best to get in touch with https://github.com/pipermerriam/ to check on a reboot ...
Omkar Khair's user avatar
2 votes

How do you work with Date and time on Ethereum platform

Try https://github.com/pipermerriam/ethereum-datetime. It works with a unix-style uint timestamp under the hood. You get a DateTime object with year, month, day, hour, minute, second and even the ...
Adnan's user avatar
  • 21
2 votes
Accepted

What happens when you put an recursive schedule call with Ethereum Alarm Clock scheduler?

Solution The protocol changed since the question was posted. It is possible to do recursive calls by building a service that for example takes advantage of Proxy wallet (to fund following calls). ...
Daniel's user avatar
  • 359
2 votes

Can I record the Time taken for a transaction to complete in Test Net

On one of the major test nets, it's impossible to know the precise time that a block is generated because miners' clocks don't have to be perfectly accurate nor do the timestamps included in blocks ...
lungj's user avatar
  • 6,680
2 votes

Execute instructions later

No. A smart contract can't "wait" (make time pass), nor execute itself after some time, nor execute another smart contract at another time. You need some script or bot or cron job outside of ...
Kenzo Agada's user avatar
  • 1,226
2 votes
Accepted

how estimate average time for transactions to smart contract

From what I understand, you are trying to estimate the time spent by calling a smart-contract (specifically a read call). In other words, how long does it take for a transaction to be processed by the ...
isra's user avatar
  • 56
2 votes
Accepted

how to get input of time in solidity?

All times in the blockchain are stored in Unix epoch format (How to calculate with time and dates?). The timestamp of execution can be retrieved with keyword now. So basically you just need to ...
Lauri Peltonen's user avatar
1 vote

I want a function locked for a certain amount of time, what's the safest way to achieve this?

Time is an interesting thing on the blockchain. The two choices are to use time (or timestamp) and the block height. Block number is generally not advised, as the average block time is 15s. Because ...
Shane Fontaine's user avatar
1 vote

Backtimer in smart contract

There is a way to do this. The contract can get the time directly but cannot execute itself. You can use services like Chronos, which allows you to schedule calls to your contract in a simple way. ...
Jaime's user avatar
  • 8,360
1 vote
Accepted

Backtimer in smart contract

There is no way to have timers in smart contracts. You'll have to write a script off-chain that sends a transaction to the contract telling it to withdraw. Alternatively you could just forward all ...
natewelch_'s user avatar
  • 12.1k
1 vote
Accepted

Which is going to be the very last block of 2017?

At the moment I'm writing this answer it is: 1072718 seconds to the end of the current year in the timezone +12, block number 4757253 in Ethereum mainnet, so we will be at the block number 4820354 by ...
Roman Frolov's user avatar
  • 3,177
1 vote

What happens when you put an recursive schedule call with Ethereum Alarm Clock scheduler?

Gas assumption issue might be there? I guesstimate as long as "this function capable accepting fund for Gas", this scheduled contract would run forever.
Shogo Ochiai's user avatar
1 vote

How to deploy Ethereum Alarm Clock contract on a private ethereum network?

It got easier to deploy EAC on any network, including local network. Solution In existing or new NPM project run: npm i --save @ethereum-alarm-clock/lib Then when you have running network, run: ...
Daniel's user avatar
  • 359
1 vote
Accepted

How to deploy Ethereum Alarm Clock contract on a private ethereum network?

The version you linked (0.7.0) was released in the 31st of January, 2016. At that time, the latest Solidity release was 0.2.1 (30th of January, 2016). If you switch your compiler version to that ...
Alex Papageorgiou's user avatar
1 vote

Email Notifications

Yes, you can use the blockchain2email.com API to send emails. If you would like to schedule notifications at a set time, you can use the Oraclize API to call email sending. Here is an example: ...
k-zar's user avatar
  • 442

Only top scored, non community-wiki answers of a minimum length are eligible