Questions tagged [timestamp]

Questions related to the timestamp value of a block, or the use of Ethereum in timestamping.

Filter by
Sorted by
Tagged with
0
votes
1answer
30 views

time order when calling functions of smart contract

How can I check that the miner actually execute the right order of smart contracts function calls, if there is a necessity of orders?
0
votes
1answer
25 views

What is the proper way to store timestamp in blockchain?

I am trying to store the timestamp in the blockchain using block.timestamp or now. But that keeps throwing warning as Use of "block.timestamp": "block.timestamp" can be influenced ...
0
votes
1answer
44 views

How to get block size and block mining time while using ganache and truffle

I am using truffle framework and Ganache (GUI) as emulator. I want to know the size of the generated block. Also I want to know the time required to mine/generate/create a block after the command. I ...
0
votes
1answer
310 views

How to map multiple time and index value on same address

I wish to map the time to the address key. But currently it is working on the index key only. I just want to map time as well. Means the current time. So that I can able to get the record with time as ...
1
vote
1answer
23 views

Why does Solidity not use the years keyword?

Solidity has keywords like seconds, minutes, hours, days and weeks that are used to specify units of time. Why do they not have years?
0
votes
1answer
54 views

How could I measure the total delay (time) to confirm the transaction?

First of all, I'm new to the Erthereum world, I need some help in measuring the total delay (time) require for confirming the transaction. I have a decentralized application over a Rinkeby network, ...
0
votes
1answer
541 views

how to define start time and end time of crowdsale in constructor

I am pretty much stuck with my crowdsale contract. I think i am missing the correct entries in the constructor like time and rate. Can someone help me on how to fill in the correct values? I am ...
2
votes
1answer
76 views

Are the timestamps of blocks for Ethereum only accepted when they are monotonically increasing?

Are the timestamps of blocks for Ethereum only accepted when they are monotonically increasing? If yes, why? And why other blockchains like Bitcoin and other blockchains with shorter block time can ...
0
votes
0answers
23 views

How does Etherscan compute mining times?

Etherscan identifies the miner that mined a block and the corresponding mining time. How does Etherscan compute the mining time? It seems that the mining time of a block is not the difference between ...
3
votes
1answer
122 views

Setting time requirements in Solidity

I want a function to only be able to be called after a certain specific period of time has passed from the contract's inception. Generally, I was using block.number for that. As in: require(block....
2
votes
1answer
40 views

How to Calculate How Long an Address Has Held A Token? (for paying interest/rewards)

I'm writing a smart contract function that rewards users some rate of interest/reward for holding my stablecoin over owning competitors (Dai, Tether, etc). What is the most efficient manner to ...
0
votes
2answers
60 views

Unit testing time sensitive Provable smart contracts

I'm currently using Provable (formerly Oraclize) to make a CRON job : constructor() public payable { OAR = OracleAddrResolverI(0x6F486C8BD6fc43eA212E93CCF8ce047C7f1Cb475); provable_query(7 ...
0
votes
1answer
16 views

Block.timestamp returning multiple values

I have a function inside my smart contract that fetches the timestamp of the block it's in: function getTime() public returns (uint256 time){ return block.timestamp;; } According to how I ...
0
votes
1answer
20 views

Using unix timestamp and making clients get token

I'm trying to make a function that uses unix timestamp for setting a limited time and after the limited time is over I would like to make clients get their token by themselves Does anyone have any ...
0
votes
0answers
26 views

Gas Estimation Failed error when scheduling Aion call

I am trying to understand the Aion scheduling system, so I tried their code example from here. Below is the code snippet: pragma solidity ^0.4.24; // interface Aion contract Aion { uint256 ...
0
votes
0answers
14 views

Do something when epoch time is [duplicate]

This is my struct where I have: timeBeforeRenew. The idea is that, if a customer does not deposit x amount of token before the time expires, his address then automatically sends all the tokens ...
0
votes
1answer
39 views

In web3, how can I fetch a range of block timestamps most efficiently?

Given a range of block numbers, how can I most efficiently fetch the timestamps for those blocks? I couldn't find a simple call to fetch the timestamp at a certain height other than fetching the full ...
0
votes
1answer
175 views

How long does an ether transaction take until verification (and where do I get this data?)

I am wondering if data is stored in the ETH blockchain on the time the transaction got send to the mempool such that I can deduce the time until it got included in a public afterwards (not to be ...
0
votes
1answer
129 views

Solidity: Is there any way to store the start time of solidity code? now() function returns block.timestamp only

I wanted to get a start time of solidity code, so I used now() previous which only returns block.timestamp whenever the solidity got started. Is there any way to store or know the start time of ...
4
votes
4answers
1k views

How to get the block number which is the closest to a given timestamp?

Is there any method(ology) in web3 which allows to get the block number at a given date? In particular, I have two dates as an input and I want to effectively get all events between those two dates. ...
0
votes
0answers
15 views

Where is AdjustTime in go-ethereum?

There are references to the go-ethereum simulated back-end to containing an "AdjustTime", e.g., here https://github.com/ethereum/go-ethereum/issues/16655. It doesn't seem to be part of the library ...
0
votes
1answer
35 views

What are some practical considerations for leap seconds?

From the solidity docs on time units: Take care if you perform calendar calculations using these units, because not every year equals 365 days and not even every day has 24 hours because of leap ...
2
votes
1answer
50 views

Can the block number be set back in ganache?

I know about tools like ganache-time-traveler that let you advance the block number. But is it possible to go back to a lower value?
0
votes
1answer
24 views

How to check state of the contract after some time?

I am writing a contract where I need to check that if in 5 minutes no new token get purchased then the sale should be ended. What I mean exactly is that, lets say user A has purchased 100 tokens and ...
2
votes
3answers
65 views

How to get the actual time of occurrence for ethereum transaction in block

I used the API of Ethereum to download some transactions info. The timestamp is included, however I found the timestamp not mean the transaction time but the block which this transaction is located ...
0
votes
1answer
47 views

Conversion from calendar format into timestamp format

I see a lot of discussion about date and time, timestamp... But they don't answer to my question: How can i convert from calendar format into timestamp format for comparing datetime? e.g: I have this ...
0
votes
0answers
26 views

How to define non-exploitability in the difficulty update algorithm?

In enter link description here, it is said that "We have already determined that our current algorithm is highly suboptimal on low volatility and non-exploitability, and at the very least we plan to ...
1
vote
0answers
42 views

Why creating a block that has slightly higher difficulty can beat out any possible forks?

It is said that "The use of (block_timestamp - parent_timestamp) // 10 (* now 9)as the main input variable rather than the time difference directly serves to maintain the coarse-grained nature of the ...
0
votes
0answers
33 views

How can I use bitcoin block stamp as seed for random number generation?

I am trying to create an ethereum based smart contract that shall generate random number. After searching around, I get to know that ethereum block stamp is vulnerable to miners hacks and false ...
2
votes
2answers
173 views

Understanding ganache timestamps

Sometimes, when I use the ganache specific evm_increaseTime method and advance to the next block, the next timestamp is NOT: current timestamp + advanced time But instead: current timestamp + ...
1
vote
2answers
56 views

Decentralized Time server to get time in Dapps? [closed]

So basically i want to ask that how can we programmatically get the accurate, exact and current time in a DApp, without relying on the system's time or a centralized time server ? Is there a ...
16
votes
3answers
4k views

How do Ethereum mining nodes maintain a time consistent with the network?

We have established that the timestamp on a parent block has to be before the timestamp of a child block in Can a child block have an earlier timestamp than the parent block?. How are differences in ...
0
votes
1answer
29 views

Can I rely on certain oracle to know the precise and reliable timestamp?

I am learning the security impact of smart contract on system properties like block.timestamp and block.number. I understood that block.timestamp can be controlled by the miner to certain degree and ...
0
votes
1answer
52 views

How do I add 7 years to a current time expressed as a block.timestamp?

Being new to solidity, I find the docs on the Internet very confusing. I simply want to add 7 years to a uint timeInSevenYearsFromNow = (block.timestamp).add(????); What is the value of ???? and ...
27
votes
4answers
21k views

Is the block.timestamp value in Solidity seconds or milliseconds?

I'm looking to use block.timestamp in one of my contracts and I want to know whether the block.timestamp is seconds like in Python or milliseconds like in Java or some other value? Also, is it safe ...
4
votes
1answer
127 views

Timestamp in Ethereum

I have a smart contract where the user inputs temperature readings, I'd like to add a time stamp to relate those reading with a current time of submission. I understand that in Ethereum we only have ...
0
votes
1answer
41 views

How can I wait if it's not possible in smart contracts? [duplicate]

From my understanding, waiting in a solidity smart contract would create a total disaster for the whole Ethereum's blockchain. I can see in some circumstances that solidity offers block.timestamp ...
8
votes
2answers
16k views

How to get current time by solidity?

I'd like to describe time like Apr15th 10:00AM . I know how to describe time range as follows, but I am not sure how to call date of time. Could you tell me about it if you know? 1 == 1 second 1 ...
2
votes
1answer
46 views

Are block timestamps decentralized?

One thing I don't understand about the Ethereum protocol is how timestamps work. If I, as miner, have a reason to fiddle with timestamps (such as adding a few minutes to decrease the mining difficulty)...
0
votes
1answer
359 views

using block.blockhash instead of block.timestamp for 30 minutes

I would like to check if the time has passed 30 minutes before executing a function in my contract. I know how it is done using block.timstamp .. But I want to use block.clockhash as it is more secure....
3
votes
1answer
313 views

Is “now” UTC time in Solidity?

The now keyword in Solidity returns a uint256 with the current block timestamp. Is the timestamp in UTC time? (ie. the number of seconds since 1st January 1970)
0
votes
2answers
406 views

How to give opening and closing time for contract in remix

I have implemented a timed crowdsale contract and it's constructor is like this: function NeoCrowdsale(uint256 _openingTime, uint256 _closingTime) public { require(_openingTime >= now); ...
0
votes
1answer
25 views

Understand the potential issue of miner controlled gaslimit

I am aware that smart contracts running on top of EVM can access certain system properties such as timestamp, block number, and gas limit. I am also aware that such properties can be controlled by ...
1
vote
1answer
83 views

Get the time a block was mined

My front-end displays the timestamps of various contract actions that have taken place. However, the current block.timestamp it's using isn't very accurate, because the miner has some leeway in ...
0
votes
1answer
190 views

converting “now” to “day”?

Consider we need to determine an expiry date for a contract such that after this date the contract will be destroyed as follows: uint256 public expiryDate; constructor(uint256 duration) ...
1
vote
1answer
219 views

How can i implement deadlines in smartContract?

Suppose I am running a gallery and ask participants to submit there paintings before a specific date. After passing that date participant should not be able to submit their entry. How can I implement ...
0
votes
1answer
291 views

crypto-signing in a smart contract -> verify the identity of a smart contract

my Question in short is: -> is it possible to digitally sign some data by a smart contract (e.g. with a secret key of the contract) and thus confirm that it was exactly this smart contract, who ...
1
vote
1answer
204 views

Ethereum extract transactions based on timestamp

I am trying to extract all transactions of Ethereum using the eth scan API. But I need transactions for specific time periods only. I tried running the API for all the blocks to try and extract all ...
1
vote
1answer
240 views

Ethereum transactions timestamp

Is it possible to extract individual timestamps of the transactions' execution time in a given block? The Ether-scan API gives only the timestamps of the block collation, doesn't mention anything ...
0
votes
1answer
30 views

Is there any protection in the Ethereum consensus or network protocol to avoid a block being mined with a timestamp 1000 years ahead of UTC time? [duplicate]

Will other nodes refuse the mined block if the timestamp is too far apart from local or UTC timestamp or will they blindely accept the block if the PoW is correct?