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
1
vote
1answer
83 views

How to write tests for time based contracts?

I have a function that requires 7 days to pass from the time of an event (lockTime) before the rest of it will execute: function resetGame () public onlyOwner { require (block.timestamp >= ...
3
votes
1answer
72 views

By what duration can a miner manipulate block.timestamp?

By what duration can a miner manipulate block.timestamp? Can they manipulate it by 10min, 5sec, 2hrs...? From here I can see that the average block time on the ethereum blockchain is 13 seconds. This ...
0
votes
2answers
29 views

Is it appropriate to use a timestamp to distribute tokens?

To distribute tokens daily (per 24 hours ) among my participants in my dapp, i want to use block.timestamp . is that enough safe ? or should i using block.number for estimate 24 hours? for example 24 *...
0
votes
0answers
14 views

Getting last buy timestamp for msg.sender in Solidity

I am looking for a way to implement an increased tax fee for msg.sender if they sell a smart contract token within a certain time frame from the last time they received the token. In Solidity, is it ...
0
votes
1answer
43 views

How to get block -> timestamp in bulk, incl. possible 3rd party api

I'm looking to get my hands on a historical block -> timestamp mapping. Although it's possible to get this data using web3.eth.getBlock it's rather costly to do it for all individual blocks. Since ...
1
vote
0answers
53 views

Timestamp of when address received a token

Trying to find a way or documentation in obtaining the timestamp of when an address received the token in a smart contract. I have read many reflection based contracts that apply different levels of ...
0
votes
1answer
61 views

Will the ethereum blockchain have a problem with the timestamp in 2038?

I am reading that Ethereum EVM run over 32bits systems In base to this information: https://en.wikipedia.org/wiki/Year_2038_problem Will the ethereum blockchain have a problem with the timestamp in ...
0
votes
0answers
11 views

Is it possible to stop a deposit, while being in process by the contract owner?

function disableDeposit() onlyowner public{ require(timeToWait + userdeposit[msg.sender].timeCreate < block.timestamp); ERC20(tokenContract).transfer(msg.sender, userdeposit[amount]); } Would I ...
1
vote
1answer
57 views

Is timestamp manipulation still possible? And if yes, can users spot that and did that happen?

I have readed an ethereum post from 2015 where it states that miners can manipulate the block timestamp up to 900 seconds. Can they in 2021 still do it and, if yes, can users see this and did this ...
0
votes
0answers
19 views

Reliable Time-stamp service

Is there any chainlink adapter that provides decentralized time-stamp service? I searched the Chainlink market; however, I couldn't find it.
0
votes
0answers
30 views

Time dependent functions

I'm trying to make a transfer function require X or Y dependent on time relative to the contract creation. So far this is what I have: uint256 public createTime; function Time() public { ...
3
votes
1answer
111 views

Avoid using block.timestamp

I need to define a specific time phase. Therefore, I wanted to use opening timestamp and closing timestamp using block.timestamp. I get the following warning: Linter: security/no-block-members: Avoid ...
0
votes
0answers
7 views

How critical is timing to the Proof of Stake system?

I’m imagining that in the future it may be profitable for attackers to try to undermine consensus using novel means that are yet unanticipated. So I would like to contribute to speculation on possible ...
1
vote
2answers
224 views

Can you use block times as a measure of duration?

I have read that it takes about 12 seconds for an ethereum block to be mined. Let’s us say I have a contract mined on block 100, can I set a function that can only be run at block 200 or more? Thus ...
0
votes
0answers
11 views

what will be the auction end time value? [duplicate]

what should be the auction end time value like I entered bidding time value? I had never entered anything over there if manually I have to do then how should I do it?
1
vote
0answers
16 views

Can block timestamp be smaller than the time a transaction has been sent?

I have seen cases where the time that I sent my transaction (logged on local PC) is actually 'later' (by 10s of seconds) than the block.timestamp of the block that my transaction entered. I checked if ...
0
votes
0answers
13 views

Certification of ownership and integrity of digital content : why is a signature required?

I'm currently designing a simple and largely discussed blockchain solution : certifying the ownership and integrity of a document through an immutable storage smart contract. In most of the ...
1
vote
0answers
105 views

What is the theoretical average latency of data transmission?

I concluded a pretty simple test to measure some latencies. I connected to two providers (Infura and Quiknode) with Web3.js and subscribed to new block headers. Then I compared the time of arrival and ...
0
votes
0answers
34 views

How can I call TX Timestamp info via Web3.JS

How can I call the timestamp information of the pending tx datas I tried everything I could not.?
1
vote
1answer
116 views

Can block.timestamp value change during execution?

I'm facing a doubt while developing an Smart Contract. I was getting current date from block.timestamp several times inside a function. Could this value change during an Smart Contract execution? Or ...
1
vote
1answer
515 views

Ethereum block timestamp

Is the timestamp of a block referring to the time that block is created or when it's mined by a miner? Suppose I subscribe to new incoming blocks using the following NodeJS code (with web3): web3.eth....
0
votes
1answer
27 views

Time-dependent test unexpected behavior at 1st attempt, expected behavior at 2nd attempt

I'm trying to test a contract in which functions should require certain timestamps. Parts of code are eliminated for readability: Here's the problematic part of the contract : PCE_Contract.sol pragma ...
0
votes
2answers
825 views

how estimate average time for transactions to smart contract

I have created a decentralized application on the Ethereum Blockchain network. This application receives data from different addresses on the blockchain network and saves this data in the blockchain ...
1
vote
1answer
250 views

best way to get transaction timestamps?

I'm building an analytics app that tracks transactions on Ethereum and wondering how to get the most accurate timestamp for each transaction. Using the web3.js library I'm able to see the following ...
0
votes
1answer
180 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 ...
1
vote
1answer
46 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
0answers
32 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 ...
0
votes
1answer
588 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, ...
2
votes
1answer
195 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
219 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
275 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
40 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
88 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
1answer
174 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
797 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 ...
3
votes
1answer
319 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
51 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 ...
0
votes
1answer
27 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
136 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
77 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 ...
3
votes
1answer
164 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
30 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
44 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
34 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 ...
0
votes
1answer
46 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 ...
2
votes
2answers
814 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
91 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 ...
0
votes
1answer
421 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 ...
5
votes
1answer
259 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
161 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 ...